each module in src/commands
must have a function with this signature:
async fn command(ctx: &Context, msg: &Message) -> Result<(), &'static str>
(where Context
is serenity::client::Context
, and Message
is serenity::model::channel::Message
)
or be a module that re-exports other modules.
note that new modules in src/commands
must be reflected in crate::handlers::CommandHandler
manually.
- 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 - 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.