aboutsummaryrefslogtreecommitdiffstats
path: root/bot
diff options
context:
space:
mode:
authorGravatar Chris <[email protected]>2021-02-13 23:12:43 +0000
committerGravatar Chris <[email protected]>2021-02-13 23:12:43 +0000
commit2d33d53bf2c3a26e68abdcf2a2f91dac5bd495fc (patch)
tree86fc80e0467beccd95267f8922b135d9d55ad2de /bot
parentRaise user input error to reset cd (diff)
Output message in the same embed.
Diffstat (limited to 'bot')
-rw-r--r--bot/exts/valentines/be_my_valentine.py30
1 files changed, 11 insertions, 19 deletions
diff --git a/bot/exts/valentines/be_my_valentine.py b/bot/exts/valentines/be_my_valentine.py
index aac38edb..fe52936b 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)
- raise commands.UserInputError
+ 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)
- raise commands.UserInputError
+ 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:")
- raise commands.UserInputError
+ 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)
- raise commands.UserInputError
+ 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:')
- raise commands.UserInputError
+ 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,12 +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
+ 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}")