Sending the message confirmation in an embed

Updating variables
Adding commentary
pull/4/head
sgoudham 4 years ago
parent c05cb6585c
commit 2fbade108d

@ -4,7 +4,7 @@ import random
from discord import DMChannel, Embed from discord import DMChannel, Embed
from discord.ext import commands from discord.ext import commands
from settings import blank_space, enso_embedmod_colours, time, enso_guild_ID from settings import blank_space, enso_embedmod_colours, time, enso_guild_ID, enso_modmail_ID, hammyMention, ensoMention
# Method to send the prompt/embed to start sending modmail to the user # Method to send the prompt/embed to start sending modmail to the user
@ -59,9 +59,6 @@ def AnonOrNot(author):
# Method to send an embed to let the user know that they have aborted the modmail process # Method to send an embed to let the user know that they have aborted the modmail process
def Abort(author): def Abort(author):
# Get my user ID
hammyID = '<@154840866496839680>'
# Set up embed to let the user know that they have aborted the modmail # Set up embed to let the user know that they have aborted the modmail
AbortEmbed = Embed(title="**Aborting ModMail!**", AbortEmbed = Embed(title="**Aborting ModMail!**",
colour=enso_embedmod_colours, colour=enso_embedmod_colours,
@ -72,7 +69,7 @@ def Abort(author):
fields = [ fields = [
(blank_space, "**If you change your mind, you can do `~mm` or `~modmail` at anytime!**", False), (blank_space, "**If you change your mind, you can do `~mm` or `~modmail` at anytime!**", False),
(blank_space, f"If you want to speak to me personally, you can DM {hammyID} anytime!", True)] (blank_space, f"If you want to speak to me personally, you can DM {hammyMention} anytime!", True)]
for name, value, inline in fields: for name, value, inline in fields:
AbortEmbed.add_field(name=name, value=value, inline=inline) AbortEmbed.add_field(name=name, value=value, inline=inline)
@ -100,6 +97,27 @@ def SendInstructions(author):
return SendModMailEmbed return SendModMailEmbed
# Method to send an embed into chat to let the user know that their mail has been sent successfully
def MessageSentConfirmation(author):
# Set up embed to let the user know that they have sent the mail
ConfirmationEmbed = Embed(title="**Message relayed to Staff!!**",
colour=enso_embedmod_colours,
timestamp=time)
ConfirmationEmbed.set_thumbnail(url=author.avatar_url)
ConfirmationEmbed.set_footer(text=f"Sent by {author}")
fields = [(blank_space,
"Thank you for your input! The staff team appreciate it very much!"
f"\n As mentioned previously, please don't be hesistant to DM {hammyMention} for anything! :P",
False)]
for name, value, inline in fields:
ConfirmationEmbed.add_field(name=name, value=value, inline=inline)
return ConfirmationEmbed
# Method to actually allow the message to be sent to #mod-mail # Method to actually allow the message to be sent to #mod-mail
def SendMsgToModMail(self, msg, author): def SendMsgToModMail(self, msg, author):
if self.anon: if self.anon:
@ -153,8 +171,9 @@ class Modmail(commands.Cog):
@commands.command(name="modmail", aliases=["mm"]) @commands.command(name="modmail", aliases=["mm"])
async def mod_mail(self, ctx): async def mod_mail(self, ctx):
self.anon = None self.anon = None
# Get the mod-mail channel # Get the mod-mail channel
channel = self.bot.get_channel(728083016290926623) channel = self.bot.get_channel(enso_modmail_ID)
# Get the guild Enso # Get the guild Enso
guild = self.bot.get_guild(enso_guild_ID) guild = self.bot.get_guild(enso_guild_ID)
# Get the member # Get the member
@ -231,8 +250,7 @@ class Modmail(commands.Cog):
msg = await self.bot.wait_for('message', check=check, timeout=300) msg = await self.bot.wait_for('message', check=check, timeout=300)
await channel.send(embed=SendMsgToModMail(self, msg, member)) await channel.send(embed=SendMsgToModMail(self, msg, member))
await ctx.send("**Message relayed to Staff!" await ctx.send(embed=MessageSentConfirmation(member))
"\nThank you for your input!**")
await instructions.delete() await instructions.delete()
if str(reaction.emoji) == "": if str(reaction.emoji) == "":
@ -252,15 +270,14 @@ class Modmail(commands.Cog):
msg = await self.bot.wait_for('message', check=check, timeout=300) msg = await self.bot.wait_for('message', check=check, timeout=300)
while len(msg.content) < 50: while len(msg.content) < 50:
await ctx.send("**Make sure your mail is above 50 characters!!**" await ctx.send("Make sure your mail is above **50*8 characters!!"
"\n**This helps us reduce spam and allows you to include more detail in your mail**") "\nThis helps us reduce spam and allows you to include more detail in your mail")
# Wait for the message from the author # Wait for the message from the author
msg = await self.bot.wait_for('message', check=check, timeout=300) msg = await self.bot.wait_for('message', check=check, timeout=300)
await channel.send(embed=SendMsgToModMail(self, msg, member)) await channel.send(embed=SendMsgToModMail(self, msg, member))
await ctx.send("**Message relayed to Staff!" await ctx.send(embed=MessageSentConfirmation(member))
"\nThank you for your input!**")
await instructions.delete() await instructions.delete()
if self.anon is None: if self.anon is None:
@ -279,12 +296,10 @@ class Modmail(commands.Cog):
await ctx.send("ModMail Timed Out! Do `~mm` or `~modmail` if you want to use the ModMail system!") await ctx.send("ModMail Timed Out! Do `~mm` or `~modmail` if you want to use the ModMail system!")
else: else:
ensoID = '<@716701699145728094>'
message = await ctx.send( message = await ctx.send(
f"{ctx.author.mention} **ModMail can only be sent through DM's!** " f"{ctx.author.mention} **ModMail can only be sent through DM's!** "
f"\nSuggestions and Opinions on the server are always appreciated!\n" f"\nSuggestions and Opinions on the server are always appreciated!\n"
f"Make sure you DM {ensoID} and then use `~modmail` or `~mm`") f"Make sure you DM {ensoMention} and then use `~modmail` or `~mm`")
# Let the User read the message for 10 seconds # Let the User read the message for 10 seconds
await asyncio.sleep(10.0) await asyncio.sleep(10.0)

Loading…
Cancel
Save