each module in src/commands must have a function with this signature:
async fn command(ctx: &Context, replyer: &Replyer/*, args: Args*/) -> Result<(), &'static str>(where Context is serenity::client::Context, Message is utils::reply::Replyer, Args is utils::arg::Args.)
The commented part is optional.
and, to support slash commands, contain the function:
fn register() -> CreateCommand(where CreateCommand is serenity::builder::CreateCommand)
or be a module that re-exports other modules that conform to above.
note that new modules in src/commands must be reflected in crate::handlers::CommandHandler manually.
- install songbird's dependencies (
apt install build-essential autoconf automake libtool m4) - install mold
- create file
tokenat project root and put your bot token in - create file
cat_apikeyat project root and put your cat api key in - create file
dog_apikeyat project root and put your dog api key in - for the command
getsong:- if you have a folder you want to put files larger than 10mb, set the
ABC_SHARED_DIRenvironment variable to that folder. - if you have an external host url, create file
external_hostand put the base url in. if you don't, justtouch external_host - get your spotify oauth credentials, put your client_id and secret in files
spotify_clientidandspotify_secretrespectively. - get your youtube oauth credentials, put your client_id and secret in files
yt_clientidandyt_secretrespectively.
- if you have a folder you want to put files larger than 10mb, set the
- install yt-dlp and make sure the binary is available in
/usr/bin - if on windows, building might not work.
cargo build -r
- be careful using
ctx.data.read(): it can deadlock sincectx.datais an instance ofArc<RwLock<..>>. a way to make these locks more clear is to usectx.data.try_read(), and handle its result accordingly. crate::utils::context::Extincludes extension methods toserenity::client::Contextcrate::serenity_ctrlcis taken mostly from yehuthi/serenity_ctrlc (thanks!). i have changed it to make it work with serenity 0.12.1, and also providectx.datato handlers.clippy.tomlincludes "forbidden" methods. these are only checked for when usingclippyinstead ofcargo checkCross.tomlis used by cross to cross-compile.cargo/config.tomlmakes cargo use clang to link. this makes it faster to compile, but can be omitted.