Skip to content

Commit 2095f2c

Browse files
committed
Use commands.UserInputError instead of custom error message
1 parent 0084158 commit 2095f2c

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

cogs/utility.py

+2-12
Original file line numberDiff line numberDiff line change
@@ -291,22 +291,12 @@ async def activity(self, ctx, activity_type: str, *, message: str = ''):
291291
return await ctx.send(embed=em)
292292

293293
if not message:
294-
em = discord.Embed(
295-
title='Invalid Message',
296-
description='You must set an activity message.',
297-
color=discord.Color.red()
298-
)
299-
return await ctx.send(embed=em)
294+
raise commands.UserInputError
300295

301296
try:
302297
activity_type = ActivityType[activity_type]
303298
except KeyError:
304-
em = discord.Embed(
305-
title='Invalid Activity Type',
306-
description=f'Cannot set activity to: {activity_type}.',
307-
color=discord.Color.red()
308-
)
309-
return await ctx.send(embed=em)
299+
raise commands.UserInputError
310300

311301
url = 'https://www.twitch.tv/discord-modmail/' if activity_type == ActivityType.streaming else None
312302
activity = discord.Activity(type=activity_type, name=message, url=url)

0 commit comments

Comments
 (0)