Skip to content

Commit ba13fc0

Browse files
committed
pull from modmail#3352
1 parent 77a5097 commit ba13fc0

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ however, insignificant breaking changes do not guarantee a major version bump, s
1717
### Added
1818

1919
- `?snippet` command now include a truncated preview of a snippet's content.
20+
- Support for custom activities with `?activity custom <text>` ([PR #3352](https://github.com/modmail-dev/Modmail/pull/3352))
2021

2122
### Fixed
2223

cogs/utility.py

+14-6
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,12 @@ async def activity(self, ctx, activity_type: str.lower, *, message: str = ""):
482482
Set an activity status for the bot.
483483
484484
Possible activity types:
485-
- `playing`
486-
- `streaming`
487-
- `listening`
488-
- `watching`
489-
- `competing`
485+
- `playing`
486+
- `streaming`
487+
- `listening`
488+
- `watching`
489+
- `competing`
490+
- `custom`
490491
491492
When activity type is set to `listening`,
492493
it must be followed by a "to": "listening to..."
@@ -498,6 +499,9 @@ async def activity(self, ctx, activity_type: str.lower, *, message: str = ""):
498499
the linked twitch page:
499500
- `{prefix}config set twitch_url https://www.twitch.tv/somechannel/`
500501
502+
When activity type is set to `custom`, you can set
503+
any custom text as the activity message.
504+
501505
To remove the current activity status:
502506
- `{prefix}activity clear`
503507
"""
@@ -528,6 +532,8 @@ async def activity(self, ctx, activity_type: str.lower, *, message: str = ""):
528532
msg += f"to {activity.name}."
529533
elif activity.type == ActivityType.competing:
530534
msg += f"in {activity.name}."
535+
elif activity.type == ActivityType.custom:
536+
msg = f"Custom activity set to: {activity.name}."
531537
else:
532538
msg += f"{activity.name}."
533539

@@ -597,7 +603,9 @@ async def set_presence(self, *, status=None, activity_type=None, activity_messag
597603
elif activity_type == ActivityType.streaming:
598604
url = self.bot.config["twitch_url"]
599605

600-
if activity_type is not None:
606+
if activity_type == ActivityType.custom:
607+
activity = discord.CustomActivity(name=activity_message)
608+
elif activity_type is not None:
601609
activity = discord.Activity(type=activity_type, name=activity_message, url=url)
602610
else:
603611
activity = None

0 commit comments

Comments
 (0)