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
token
at project root and put your bot token in - create file
cat_apikey
at project root and put your cat api key in - create file
dog_apikey
at 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_DIR
environment variable to that folder. - if you have an external host url, create file
external_host
and 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_clientid
andspotify_secret
respectively. - get your youtube oauth credentials, put your client_id and secret in files
yt_clientid
andyt_secret
respectively.
- 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.data
is 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::Ext
includes extension methods toserenity::client::Context
crate::serenity_ctrlc
is taken mostly from yehuthi/serenity_ctrlc (thanks!). i have changed it to make it work with serenity 0.12.1, and also providectx.data
to handlers.clippy.toml
includes "forbidden" methods. these are only checked for when usingclippy
instead ofcargo check
Cross.toml
is used by cross to cross-compile.cargo/config.toml
makes cargo use clang to link. this makes it faster to compile, but can be omitted.