Set bot status

This commit is contained in:
2025-08-21 22:05:58 -03:00
parent 5e3201e7c5
commit 55ae1c8937
+38 -4
View File
@@ -115,6 +115,10 @@ use tokio::net::TcpListener;
use tower_http::services::ServeDir; use tower_http::services::ServeDir;
use twilight_cache_inmemory::ResourceType; use twilight_cache_inmemory::ResourceType;
use twilight_gateway::{Intents, ShardId}; use twilight_gateway::{Intents, ShardId};
use twilight_model::gateway::{
payload::outgoing::update_presence::UpdatePresencePayload,
presence::{Activity, ActivityType, Status},
};
use crate::{ use crate::{
cli::{Args, Commands}, cli::{Args, Commands},
@@ -125,13 +129,17 @@ use crate::{
runtime::Runtime, runtime::Runtime,
}, },
groups::{ groups::{
about::{commands::HelpCommand, components::HelpGoBackButton}, calls::{ about::{commands::HelpCommand, components::HelpGoBackButton},
calls::{
commands::{CallCommand, FriendRequestCommand, HangupCommand, SkipCommand}, commands::{CallCommand, FriendRequestCommand, HangupCommand, SkipCommand},
events::{CallMessageDeleteHandler, CallMessageEditHandler, CallMessageHandler}, events::{CallMessageDeleteHandler, CallMessageEditHandler, CallMessageHandler},
}, gateway::events::{ReadyHandler, ReconnectHandler}, leveling::{commands::LeaderboardCommand, events::MessageLevelingHandler}, servers::{ },
gateway::events::{ReadyHandler, ReconnectHandler},
leveling::{commands::LeaderboardCommand, events::MessageLevelingHandler},
servers::{
commands::PrefixCommand, commands::PrefixCommand,
events::{ServerCreateHandler, ServerDeleteHandler, ServerUpdateHandler}, events::{ServerCreateHandler, ServerDeleteHandler, ServerUpdateHandler},
} },
}, },
state::State, state::State,
}; };
@@ -265,7 +273,33 @@ async fn start(
.on_message_delete(CallMessageDeleteHandler) .on_message_delete(CallMessageDeleteHandler)
.on_server_create(ServerCreateHandler) .on_server_create(ServerCreateHandler)
.on_server_update(ServerUpdateHandler) .on_server_update(ServerUpdateHandler)
.on_server_delete(ServerDeleteHandler); .on_server_delete(ServerDeleteHandler)
.presence(
UpdatePresencePayload::new(
vec![Activity {
application_id: None,
assets: None,
buttons: vec![],
created_at: None,
details: None,
emoji: None,
flags: None,
id: None,
instance: None,
kind: ActivityType::Listening,
name: format!("p.help - {}/{}", shard.number() + 1, shard.total()),
party: None,
secrets: None,
state: None,
timestamps: None,
url: None,
}],
false,
None,
Status::Online,
)
.expect("Could not set bot presence since the parameters passed were invalid"),
);
bot.run(&token).await.expect("Could not run bot!"); bot.run(&token).await.expect("Could not run bot!");
} }