Move activity set out of Ready event

This commit is contained in:
jude
2024-07-15 16:48:40 +01:00
parent fc3b3e08f1
commit 14913deb3a
4 changed files with 1107 additions and 603 deletions

View File

@@ -1,5 +1,5 @@
use poise::serenity_prelude::{
ActionRowComponent, ActivityData, ButtonKind, Context, CreateActionRow, CreateButton,
ActionRowComponent, ButtonKind, Context, CreateActionRow, CreateButton,
EditInteractionResponse, FullEvent, Interaction,
};
@@ -18,9 +18,6 @@ use crate::{
pub async fn listener(ctx: &Context, event: &FullEvent, data: &Data) -> Result<(), Error> {
match event {
FullEvent::Ready { .. } => {
ctx.set_activity(Some(ActivityData::watching("for /play")));
}
FullEvent::VoiceStateUpdate { old, new, .. } => {
if let Some(past_state) = old {
if let (Some(guild_id), None) = (past_state.guild_id, new.channel_id) {

View File

@@ -18,7 +18,7 @@ use poise::serenity_prelude::{
gateway::GatewayIntents,
id::{GuildId, UserId},
},
ClientBuilder,
ActivityData, ClientBuilder,
};
use songbird::SerenityInit;
use sqlx::{MySql, Pool};
@@ -138,6 +138,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
&discord_token,
GatewayIntents::GUILD_VOICE_STATES | GatewayIntents::GUILDS,
)
.activity(ActivityData::watching("for /play"))
.framework(framework)
.register_songbird()
.await?;