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

1694
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
name = "soundfx-rs" name = "soundfx-rs"
description = "Discord bot for custom sound effects and soundboards" description = "Discord bot for custom sound effects and soundboards"
license = "AGPL-3.0-only" license = "AGPL-3.0-only"
version = "1.5.17" version = "1.5.18"
authors = ["jellywx <judesouthworth@pm.me>"] authors = ["jellywx <judesouthworth@pm.me>"]
edition = "2018" edition = "2018"
@ -12,12 +12,12 @@ poise = "0.6.1-rc1"
sqlx = { version = "0.7.3", default-features = false, features = ["runtime-tokio-rustls", "macros", "mysql", "bigdecimal", "migrate"] } sqlx = { version = "0.7.3", default-features = false, features = ["runtime-tokio-rustls", "macros", "mysql", "bigdecimal", "migrate"] }
tokio = { version = "1", features = ["fs", "process", "io-util", "rt-multi-thread"] } tokio = { version = "1", features = ["fs", "process", "io-util", "rt-multi-thread"] }
lazy_static = "1.4" lazy_static = "1.4"
reqwest = "0.11" reqwest = "0.12"
env_logger = "0.10" env_logger = "0.11"
regex = "1.10" regex = "1.10"
log = "0.4" log = "0.4"
serde_json = "1.0" serde_json = "1.0"
dashmap = "5.5" dashmap = "6.0"
serde = "1.0" serde = "1.0"
dotenv = "0.15.0" dotenv = "0.15.0"
prometheus = { version = "0.13.3", optional = true } prometheus = { version = "0.13.3", optional = true }

View File

@ -1,5 +1,5 @@
use poise::serenity_prelude::{ use poise::serenity_prelude::{
ActionRowComponent, ActivityData, ButtonKind, Context, CreateActionRow, CreateButton, ActionRowComponent, ButtonKind, Context, CreateActionRow, CreateButton,
EditInteractionResponse, FullEvent, Interaction, EditInteractionResponse, FullEvent, Interaction,
}; };
@ -18,9 +18,6 @@ use crate::{
pub async fn listener(ctx: &Context, event: &FullEvent, data: &Data) -> Result<(), Error> { pub async fn listener(ctx: &Context, event: &FullEvent, data: &Data) -> Result<(), Error> {
match event { match event {
FullEvent::Ready { .. } => {
ctx.set_activity(Some(ActivityData::watching("for /play")));
}
FullEvent::VoiceStateUpdate { old, new, .. } => { FullEvent::VoiceStateUpdate { old, new, .. } => {
if let Some(past_state) = old { if let Some(past_state) = old {
if let (Some(guild_id), None) = (past_state.guild_id, new.channel_id) { 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, gateway::GatewayIntents,
id::{GuildId, UserId}, id::{GuildId, UserId},
}, },
ClientBuilder, ActivityData, ClientBuilder,
}; };
use songbird::SerenityInit; use songbird::SerenityInit;
use sqlx::{MySql, Pool}; use sqlx::{MySql, Pool};
@ -138,6 +138,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
&discord_token, &discord_token,
GatewayIntents::GUILD_VOICE_STATES | GatewayIntents::GUILDS, GatewayIntents::GUILD_VOICE_STATES | GatewayIntents::GUILDS,
) )
.activity(ActivityData::watching("for /play"))
.framework(framework) .framework(framework)
.register_songbird() .register_songbird()
.await?; .await?;