Skip to content

Commit 208e3f9

Browse files
authored
Merge pull request #3 from seijinmark/dev
Added ability to configure rich presence message via environment variable
2 parents 40b4086 + 45656b3 commit 208e3f9

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.env.exemple

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ DISCORD_BOT_TOKEN=Your_Token_Here # This is the token of your bot, you can get i
22
CHANNEL_1=Your_Channel_ID_Here # The number of channels is limited to 10, you can increment here as you want, just place the new channel ID below with the same format
33
CHANNEL_2=Your_Channel_ID_Here
44
CHANNEL_3=Your_Channel_ID_Here
5-
NOTIFICATION_CHANNEL=Your_NOTIFICATION_Channel_ID_Here # This is the channel where the bot will send the notifications
5+
NOTIFICATION_CHANNEL=Your_NOTIFICATION_Channel_ID_Here # This is the channel where the bot will send the notifications
6+
RICH_PRESENCE=Katchau! # This is the rich presence of the bot (example: "Katchau!") as a string
7+
ACTIVITY=listening # This is the activity of the bot, you can use "game", "listening", "watching" or "streaming")

bot.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,16 @@
5050

5151
@client.event
5252
async def on_ready():
53-
await client.change_presence(status=discord.Status.online, activity=discord.Game(name="Katchau!"))
53+
rich_presence = os.getenv('RICH_PRESENCE', 'Katchau!')
54+
activity = os.getenv('ACTIVITY', 'playing').lower()
55+
activity_type = discord.ActivityType.playing
56+
if activity == 'listening':
57+
activity_type = discord.ActivityType.listening
58+
elif activity == 'watching':
59+
activity_type = discord.ActivityType.watching
60+
elif activity == 'streaming':
61+
activity_type = discord.ActivityType.streaming
62+
await client.change_presence(status=discord.Status.online, activity=discord.Activity(name=rich_presence, type=activity_type))
5463
print('Bot online!')
5564
print(f'Connected as {client.user.name}')
5665
print('------')

0 commit comments

Comments
 (0)