Add help command as bot activity

This commit is contained in:
kageru 2019-11-02 10:40:18 +01:00
parent 01891ee6ef
commit 8111f1f877
Signed by: kageru
GPG Key ID: 8282A2BEA4ADA3D2

View File

@ -1,6 +1,7 @@
use serde::de::DeserializeOwned;
use serenity::model::channel::Message;
use serenity::model::id::ChannelId;
use serenity::model::gateway::{Ready,Activity};
use serenity::prelude::*;
use std::fmt;
mod apt;
@ -45,6 +46,12 @@ impl EventHandler for Handler {
};
}
}
fn ready(&self, ctx: Context, bot_data: Ready) {
println!("Bot running and serving {} servers", bot_data.guilds.len());
ctx.reset_presence();
ctx.set_activity(Activity::listening(&format!("{}pb help", PREFIX)));
}
}
fn help(ctx: Context, msg: Message, _args: Vec<&str>) {
@ -55,7 +62,7 @@ fn help(ctx: Context, msg: Message, _args: Vec<&str>) {
.collect::<Vec<_>>()
.join(", ");
send(msg.channel_id,
&format!("Usage: `<command> <search term>`\nSupported commands: `{}`\nSource code: https://git.kageru.moe/kageru/pacbot",
&format!("Usage: `<command> <search term>`\nSupported commands: `{}`\nSource code & information: https://git.kageru.moe/kageru/pacbot",
command_triggers), &ctx)
}