mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-05-24 09:10:49 +00:00
Update to Tokio 1 and Serenity 0.10 (#9)
This commit is contained in:
parent
40f6c6e553
commit
901d55814d
19 changed files with 238 additions and 281 deletions
|
@ -53,7 +53,7 @@ async fn clean(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult {
|
|||
};
|
||||
msg.react(&ctx, '🌋').await?;
|
||||
if let Channel::Guild(_) = &channel {
|
||||
tokio::time::delay_for(std::time::Duration::from_secs(2)).await;
|
||||
tokio::time::sleep(std::time::Duration::from_secs(2)).await;
|
||||
msg.delete(&ctx).await.ok();
|
||||
}
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ pub async fn watch_soft_bans(cache_http: Arc<CacheAndHttp>, data: AppData) {
|
|||
}
|
||||
}
|
||||
// Sleep the thread for a minute
|
||||
tokio::time::delay_for(std::time::Duration::from_secs(60)).await
|
||||
tokio::time::sleep(std::time::Duration::from_secs(60)).await
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ pub async fn choose(ctx: &Context, m: &Message, mut args: Args) -> CommandResult
|
|||
.push_bold(format!("{}", users.len()))
|
||||
.push(" ")
|
||||
.push(
|
||||
role.map(|r| r.mention() + "s")
|
||||
role.map(|r| format!("{}s", r.mention()))
|
||||
.unwrap_or("potential prayers".to_owned()),
|
||||
)
|
||||
.push(", ")
|
||||
|
|
|
@ -195,7 +195,7 @@ pub async fn vote(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult
|
|||
.push(
|
||||
votes
|
||||
.into_iter()
|
||||
.map(|v| v.mention())
|
||||
.map(|v| v.mention().to_string())
|
||||
.collect::<Vec<_>>()
|
||||
.join(", "),
|
||||
);
|
||||
|
|
|
@ -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(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue