Skip to content

Commit

Permalink
Change the way activity and status is set
Browse files Browse the repository at this point in the history
  • Loading branch information
Zalk0 committed Oct 4, 2023
1 parent 65f50d0 commit eabe5b7
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,20 @@ class ChouetteBot(discord.Client):
def __init__(self):
# Set intents for the bot
intents = discord.Intents.all()
super().__init__(intents=intents)

# Set activity of the bot
activity_type = {"playing": 0,
"streaming": 1,
"listening": 2,
"watching": 3,
"competing": 5}
activity = discord.Activity(type=activity_type.get(self.config['BOT_ACTIVITY_TYPE']),
name=self.config['BOT_ACTIVITY_NAME'])

# Apply intents, activity and status to the bot
super().__init__(intents=intents, activity=activity, status=self.config['BOT_STATUS'])

# Used to check the first time the bot does the on_ready event
self.first = True

# Associate the config to the bot
Expand All @@ -38,16 +51,6 @@ async def on_ready(self):
tasks.tasks_list(self)
self.first = False

# Set activity of the bot
activity_type = {"playing": 0,
"streaming": 1,
"listening": 2,
"watching": 3,
"competing": 5}
activity = discord.Activity(type=activity_type.get(self.config['BOT_ACTIVITY_TYPE']),
name=self.config['BOT_ACTIVITY_NAME'])
await self.change_presence(activity=activity, status=self.config['BOT_STATUS'])

# Check the number of servers the bot is a part of
logging.info(f"Number of servers I'm in : {len(self.guilds)}")

Expand Down

0 comments on commit eabe5b7

Please sign in to comment.