Update to Tokio 1 and Serenity 0.10 (#9)

This commit is contained in:
Natsu Kagami 2021-01-15 18:50:33 +00:00 committed by GitHub
parent 40f6c6e553
commit 901d55814d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 238 additions and 281 deletions

View file

@ -3,7 +3,7 @@ use serenity::framework::standard::CommandError as Error;
use serenity::{
framework::standard::{
macros::{check, command},
Args, CheckResult, CommandOptions, CommandResult, Reason,
Args, CommandOptions, CommandResult, Reason,
},
model::channel::{Channel, Message},
};
@ -29,15 +29,20 @@ pub async fn image(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
#[check]
#[name = "nsfw"]
async fn nsfw_check(ctx: &Context, msg: &Message, _: &mut Args, _: &CommandOptions) -> CheckResult {
async fn nsfw_check(
ctx: &Context,
msg: &Message,
_: &mut Args,
_: &CommandOptions,
) -> Result<(), Reason> {
let channel = msg.channel_id.to_channel(&ctx).await.unwrap();
if !(match channel {
Channel::Guild(guild_channel) => guild_channel.nsfw,
_ => true,
}) {
CheckResult::Failure(Reason::User("😣 YOU FREAKING PERVERT!!!".to_owned()))
Err(Reason::User("😣 YOU FREAKING PERVERT!!!".to_owned()))
} else {
CheckResult::Success
Ok(())
}
}