added activity

This commit is contained in:
jude 2022-05-07 19:42:59 +01:00
parent 27f678b978
commit fe85f82a09

View File

@ -1,12 +1,15 @@
use std::{collections::HashMap, env}; use std::{collections::HashMap, env};
use poise::serenity::{ use poise::{
model::{ serenity::{
channel::Channel, model::{
interactions::{Interaction, InteractionResponseType}, channel::Channel,
interactions::{Interaction, InteractionResponseType},
},
prelude::Context,
utils::shard_id,
}, },
prelude::Context, serenity_prelude::Activity,
utils::shard_id,
}; };
use crate::{ use crate::{
@ -17,6 +20,9 @@ use crate::{
pub async fn listener(ctx: &Context, event: &poise::Event<'_>, data: &Data) -> Result<(), Error> { pub async fn listener(ctx: &Context, event: &poise::Event<'_>, data: &Data) -> Result<(), Error> {
match event { match event {
poise::Event::CacheReady { .. } => {
ctx.set_activity(Activity::watching("for /play")).await;
}
poise::Event::GuildCreate { guild, is_new, .. } => { poise::Event::GuildCreate { guild, is_new, .. } => {
if *is_new { if *is_new {
if let Ok(token) = env::var("DISCORDBOTS_TOKEN") { if let Ok(token) = env::var("DISCORDBOTS_TOKEN") {