refactor!: use poise 0.6.1

This commit is contained in:
seth 2024-01-27 22:29:56 -05:00
parent 203ba111cc
commit 7252ced3cb
No known key found for this signature in database
GPG key ID: D31BD0D494BBEE86
16 changed files with 700 additions and 512 deletions

View file

@ -2,8 +2,8 @@ use crate::{api, Data};
use color_eyre::eyre::{Report, Result};
use log::*;
use poise::serenity_prelude::{Activity, Context, OnlineStatus};
use poise::{Event, FrameworkContext};
use poise::serenity_prelude::{ActivityData, Context, FullEvent, OnlineStatus};
use poise::FrameworkContext;
mod analyze_logs;
mod delete_on_reaction;
@ -14,22 +14,22 @@ mod support_onboard;
pub async fn handle(
ctx: &Context,
event: &Event<'_>,
event: &FullEvent,
_framework: FrameworkContext<'_, Data, Report>,
data: &Data,
) -> Result<()> {
match event {
Event::Ready { data_about_bot } => {
FullEvent::Ready { data_about_bot } => {
info!("Logged in as {}!", data_about_bot.user.name);
let latest_minecraft_version = api::prism_meta::get_latest_minecraft_version().await?;
let activity = Activity::playing(format!("Minecraft {}", latest_minecraft_version));
let activity = ActivityData::playing(format!("Minecraft {}", latest_minecraft_version));
info!("Setting presence to activity {activity:#?}");
ctx.set_presence(Some(activity), OnlineStatus::Online).await;
ctx.set_presence(Some(activity), OnlineStatus::Online);
}
Event::Message { new_message } => {
FullEvent::Message { new_message } => {
// ignore new messages from bots
// NOTE: the webhook_id check allows us to still respond to PK users
if new_message.author.bot && new_message.webhook_id.is_none() {
@ -52,11 +52,13 @@ pub async fn handle(
analyze_logs::handle(ctx, new_message, data).await?;
}
Event::ReactionAdd { add_reaction } => {
delete_on_reaction::handle(ctx, add_reaction).await?
FullEvent::ReactionAdd { add_reaction } => {
delete_on_reaction::handle(ctx, add_reaction).await?;
}
Event::ThreadCreate { thread } => support_onboard::handle(ctx, thread).await?,
FullEvent::ThreadCreate { thread } => {
support_onboard::handle(ctx, thread).await?;
}
_ => {}
}