poise 0.4 -> 0.5.5

main
Elnu 2 years ago
parent e370b29f86
commit faf74e7c3f

8
Cargo.lock generated

@ -914,9 +914,9 @@ checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
[[package]]
name = "poise"
version = "0.4.1"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aee439543df35482730552e7c9ed0c45a5f1d521548e6c0249967c4ba8828f60"
checksum = "6d591af1c934c29adda172665f69b837e642d4fee85598baffb95dd98110467d"
dependencies = [
"async-trait",
"derivative",
@ -933,9 +933,9 @@ dependencies = [
[[package]]
name = "poise_macros"
version = "0.4.0"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d21213ff7aeef5ab69729a5cddfb351a84a9bf3dadf9f470032440d43746c2"
checksum = "40270099e1527efae99fdc0609d397e76310b529d4980ad38ab14d81803ca0fa"
dependencies = [
"darling",
"proc-macro2",

@ -15,7 +15,7 @@ reqwest = "0.11"
slug = "0.1"
unicode_hfwidth = "0.2"
fs_extra = "1.2"
poise = "0.4"
poise = "0.5.5"
[dependencies.tokio]
version = "1.0"

@ -42,7 +42,7 @@ pub async fn submit(ctx: Context<'_>, submission: serenity::Attachment) -> Resul
Context::Prefix(ctx) => {
if ctx.msg.attachments.len() == 0 {
ctx.msg
.reply(&ctx.discord.http, "Please attach at least one image.")
.reply(&ctx.serenity_context.http, "Please attach at least one image.")
.await?;
return Ok(());
}
@ -182,7 +182,7 @@ pub async fn submit(ctx: Context<'_>, submission: serenity::Attachment) -> Resul
let mut repost_here = true;
match ctx {
Context::Application(_) => message.push_str(thank_you),
Context::Prefix(ctx) => match ctx.msg.delete(&ctx.discord.http).await {
Context::Prefix(ctx) => match ctx.msg.delete(&ctx.serenity_context.http).await {
Ok(_) => {}
// don't repost image on this server if no manage messages perm
// (if we can't delete user's image it'll be displayed twice)
@ -221,13 +221,13 @@ pub async fn submit(ctx: Context<'_>, submission: serenity::Attachment) -> Resul
.unwrap(),
);
let accent_color = ctx
.discord()
.serenity_context()
.http
.get_user(*author.id.as_u64())
.await
.unwrap()
.accent_colour;
channel.send_message(&ctx.discord().http, |m| {
channel.send_message(&ctx.serenity_context().http, |m| {
m.embed(|e| {
let username = format!("{}#{}", author.name, author.discriminator);
let n = get_challenge_number();
@ -411,14 +411,14 @@ pub async fn suggest(
// If we just do msg.author.accent_colour here, we will get None
let author = &ctx.author();
let accent_color = ctx
.discord()
.serenity_context()
.http
.get_user(*author.id.as_u64())
.await
.unwrap()
.accent_colour;
channel
.send_message(&ctx.discord().http, |m| {
.send_message(&ctx.serenity_context().http, |m| {
m.allowed_mentions(|am| {
am.empty_parse();
am

@ -142,7 +142,7 @@ pub async fn so(
if displayed_character_count >= MAX_CHARS {
ctx.channel_id()
.say(
&ctx.discord().http,
&ctx.serenity_context().http,
":warning: Maximum number of stroke order diagrams per command reached.",
)
.await?;

@ -71,7 +71,7 @@ async fn main() {
| GatewayIntents::MESSAGE_CONTENT
| GatewayIntents::GUILDS,
)
.user_data_setup(move |_ctx, _ready, _framework| Box::pin(async move { Ok(Data {}) }));
.setup(move |_ctx, _ready, _framework| Box::pin(async move { Ok(Data {}) }));
framework.run().await.unwrap();
}

@ -175,7 +175,7 @@ pub async fn send(ctx: Context<'_>, message: &str, ping: bool, pin: bool) -> Res
));
}
message_to_send.push_str(message);
let ctx = ctx.discord();
let ctx = ctx.serenity_context();
let sent_message = channel
.send_message(&ctx.http, |e| {
e.content(message_to_send);
@ -224,7 +224,7 @@ pub async fn display_kanji(ctx: Context<'_>, kanji: char, comment: &str) -> Resu
let link_validated = response != reqwest::StatusCode::NOT_FOUND;
ctx.channel_id()
.say(
&ctx.discord().http,
&ctx.serenity_context().http,
if link_validated {
&url
} else {
@ -373,7 +373,7 @@ pub async fn leaderboard(ctx: &Context<'_>) -> Result<(), Error> {
for (i, (id, count)) in top_submitters[0..LENGTH].iter().enumerate() {
let place = i + 1;
let user = serenity::UserId(id.parse::<u64>().unwrap())
.to_user(&ctx.discord().http)
.to_user(&ctx.serenity_context().http)
.await?;
let avatar = get_avatar(&user);
let profile = format!("https://discord.com/users/{id}");

Loading…
Cancel
Save