poise 0.4 -> 0.5.5

This commit is contained in:
Elnu 2023-06-10 12:45:05 -07:00
parent e370b29f86
commit faf74e7c3f
6 changed files with 16 additions and 16 deletions

View file

@ -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

View file

@ -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?;

View file

@ -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();
}

View file

@ -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}");