Skip to content

Commit ec651dd

Browse files
sebkuipkhakers
authored andcommitted
Add support for custom activities (modmail-dev#3352)
(cherry picked from commit 26d73f5)
1 parent 0058fca commit ec651dd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cogs/utility.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ async def activity(self, ctx, activity_type: str.lower, *, message: str = ""):
466466
- `listening`
467467
- `watching`
468468
- `competing`
469+
- `custom`
469470
470471
When activity type is set to `listening`,
471472
it must be followed by a "to": "listening to..."
@@ -477,6 +478,9 @@ async def activity(self, ctx, activity_type: str.lower, *, message: str = ""):
477478
the linked twitch page:
478479
- `{prefix}config set twitch_url https://www.twitch.tv/somechannel/`
479480
481+
When activity type is set to `custom`, you can set
482+
any custom text as the activity message.
483+
480484
To remove the current activity status:
481485
- `{prefix}activity clear`
482486
"""
@@ -576,7 +580,9 @@ async def set_presence(self, *, status=None, activity_type=None, activity_messag
576580
elif activity_type == ActivityType.streaming:
577581
url = self.bot.config["twitch_url"]
578582

579-
if activity_type is not None:
583+
if activity_type == ActivityType.custom:
584+
activity = discord.CustomActivity(name=activity_message)
585+
elif activity_type is not None:
580586
activity = discord.Activity(type=activity_type, name=activity_message, url=url)
581587
else:
582588
activity = None

0 commit comments

Comments
 (0)