added a WhoAmI command
This commit is contained in:
+7
-9
@@ -1,12 +1,10 @@
|
||||
# Reddit Commands
|
||||
To execute a command on the Reddit bot, include `u/ByteDiceAssistant [cmd]` in a comment.
|
||||
- **`[cmd]`**: The command you want to run and its arguments.
|
||||
## `bk_week_add`
|
||||
Adds the post to the list of posts.
|
||||
To execute a command on the Reddit bot, include `u/{BOTNAME} [cmd]` in a comment. (Replace {BOTNAME} with the actual bot name, and [cmd] with any command listed below).
|
||||
|
||||
## `add_post`
|
||||
Adds a post to the bots database.
|
||||
- **Only moderators of a subreddit or the OP (Original Poster) can use this command.**
|
||||
### **Examples**
|
||||
```
|
||||
"u/ByteDiceAssistant bk_week_add"
|
||||
"Cool art, let me add that. u/ByteDiceAssistant bk_week_add"
|
||||
"Cool art. Just gonna u/ByteDiceAssistant bk_week_add so it can become featured."
|
||||
```
|
||||
* `u/{BOTNAME} add_post`
|
||||
* `Cool art, let me add that. u/{BOTNAME} weekly_art` (weekly art is an alias for add_post that is enabled by default)
|
||||
* `Cool art. Just gonna u/{BOTNAME} add_post so it can become featured.`
|
||||
@@ -55,6 +55,7 @@
|
||||
"dc_msg_update_removing_dupe": "{0}Removing duplicate posts...",
|
||||
"dc_msg_update_removing_old": "{0}Removing old posts (threshold: {1}d)...",
|
||||
"dc_msg_update_removing": "{0}Removing removed posts...",
|
||||
"dc_msg_whoami": "**Bot \"owner\":** {0}\n**BK moderator:** {1}",
|
||||
"log_lang_load_success": "Successfully loaded the english language file!",
|
||||
"none": "None",
|
||||
"py_re_response_suffix": "^(I am not an AI, I am just a bot. This action was performed automatically by the way. You can report bugs and view my source code [here](https://github.com/ByteDice/ByteDiceAssistant)!)",
|
||||
|
||||
+4
-4
@@ -8,8 +8,8 @@ use crate::{lang, messages::send_msg, Context, Cmd, Error};
|
||||
enum HelpOptions {
|
||||
Admin,
|
||||
All,
|
||||
BkWeek,
|
||||
BkWeekReddit,
|
||||
Reddit,
|
||||
RedditBot,
|
||||
Generic
|
||||
}
|
||||
|
||||
@@ -97,8 +97,8 @@ async fn send_single_help(ctx: Context<'_>, mut cmd_name: String) {
|
||||
|
||||
async fn send_category_help(ctx: Context<'_>, category: HelpOptions) {
|
||||
match category {
|
||||
HelpOptions::BkWeekReddit => send_bk_week_help_re(ctx).await,
|
||||
HelpOptions::BkWeek => send_bk_week_help (ctx).await,
|
||||
HelpOptions::RedditBot => send_bk_week_help_re(ctx).await,
|
||||
HelpOptions::Reddit => send_bk_week_help (ctx).await,
|
||||
HelpOptions::Generic => send_generic_help (ctx).await,
|
||||
HelpOptions::Admin => send_admin_help (ctx).await,
|
||||
HelpOptions::All => send_all_help (ctx).await
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
use crate::{lang, messages::send_msg, Context, Error};
|
||||
|
||||
#[poise::command(
|
||||
slash_command,
|
||||
prefix_command,
|
||||
rename = "whoami",
|
||||
category = "help",
|
||||
required_bot_permissions = "SEND_MESSAGES | VIEW_CHANNEL"
|
||||
)]
|
||||
pub async fn cmd(ctx: Context<'_>) -> Result<(), Error> {
|
||||
let data = ctx.data();
|
||||
let uid: u64 = ctx.author().id.into();
|
||||
|
||||
let is_owner = data.owners .contains(&uid);
|
||||
let is_bk_mod = data.bk_mods.contains(&uid);
|
||||
|
||||
send_msg(ctx, lang!("dc_msg_whoami", is_owner, is_bk_mod), true, true).await;
|
||||
|
||||
return Ok(());
|
||||
}
|
||||
@@ -79,6 +79,7 @@ async fn make_cmd_vec(data: &Data) -> Vec<Cmd> {
|
||||
let mut cmds = vec![
|
||||
// GENERIC
|
||||
cmds::help::cmd(),
|
||||
cmds::whoami::cmd(),
|
||||
cmds::ping::cmd(),
|
||||
cmds::eight_ball::cmd(),
|
||||
// REDDIT
|
||||
|
||||
@@ -10,6 +10,7 @@ mod cmds {
|
||||
pub mod reload_cfg;
|
||||
pub mod send;
|
||||
pub mod stop;
|
||||
pub mod whoami;
|
||||
}
|
||||
mod re_cmds {
|
||||
pub mod add;
|
||||
|
||||
Reference in New Issue
Block a user