aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/exts/valentines/be_my_valentine.py29
1 files changed, 11 insertions, 18 deletions
diff --git a/bot/exts/valentines/be_my_valentine.py b/bot/exts/valentines/be_my_valentine.py
index d79b28e8..f3392bcb 100644
--- a/bot/exts/valentines/be_my_valentine.py
+++ b/bot/exts/valentines/be_my_valentine.py
@@ -84,19 +84,16 @@ class BeMyValentine(commands.Cog):
"""
if ctx.guild is None:
# This command should only be used in the server
- msg = "You are supposed to use this command in the server."
- await ctx.send(msg)
- return
+ raise commands.UserInputError("You are supposed to use this command in the server.")
if Lovefest.role_id not in [role.id for role in user.roles]:
- message = f"You cannot send a valentine to {user} as they do not have the lovefest role!"
- await ctx.send(message)
- return
+ raise commands.UserInputError(
+ f"You cannot send a valentine to {user} as they do not have the lovefest role!"
+ )
if user == ctx.author:
# Well a user can't valentine himself/herself.
- await ctx.send("Come on, you can't send a valentine to yourself :expressionless:")
- return
+ raise commands.UserInputError("Come on, you can't send a valentine to yourself :expressionless:")
emoji_1, emoji_2 = self.random_emoji()
channel = self.bot.get_channel(Channels.community_bot_commands)
@@ -125,18 +122,14 @@ class BeMyValentine(commands.Cog):
Iceman in DM making you anonymous)
"""
if Lovefest.role_id not in [role.id for role in user.roles]:
- message = f"You cannot send a valentine to {user} as they do not have the lovefest role!"
await ctx.message.delete()
- try:
- await ctx.author.send(message)
- except discord.Forbidden:
- await ctx.send(message)
- return
+ raise commands.UserInputError(
+ f"You cannot send a valentine to {user} as they do not have the lovefest role!"
+ )
if user == ctx.author:
# Well a user cant valentine himself/herself.
- await ctx.send('Come on, you can\'t send a valentine to yourself :expressionless:')
- return
+ raise commands.UserInputError("Come on, you can't send a valentine to yourself :expressionless:")
emoji_1, emoji_2 = self.random_emoji()
valentine, title = self.valentine_check(valentine_type)
@@ -146,11 +139,11 @@ class BeMyValentine(commands.Cog):
description=f'{valentine} \n **{emoji_2}From anonymous{emoji_1}**',
color=Colours.pink
)
+ await ctx.message.delete()
try:
await user.send(embed=embed)
- await ctx.message.delete()
except discord.Forbidden:
- await ctx.send(f"{user} has DMs disabled, so I couldn't send the message. Sorry!")
+ raise commands.UserInputError(f"{user} has DMs disabled, so I couldn't send the message. Sorry!")
else:
await ctx.author.send(f"Your message has been sent to {user}")