Changed verification.py to work with reactions

pull/4/head
sgoudham 4 years ago
parent bb7f8d28ae
commit 33c8b1ac4e

@ -14,46 +14,32 @@ class Verification(commands.Cog):
self.bot = bot self.bot = bot
self.guild = None self.guild = None
# Listens to every message sent
@commands.Cog.listener() @commands.Cog.listener()
async def on_message(self, message): async def on_raw_reaction_add(self, payload):
# Making sure that the bot doesn't reply to itself # Get the guild
if message.author == message.author.bot: guild = self.bot.get_guild(payload.guild_id)
return # Get the member
member = guild.get_member(payload.user_id)
# Get the 'Lucid' role and then give it to the user
role = discord.utils.get(guild.roles, name='Lucid')
# Defining the message content in a variable if payload.channel_id == 728034083678060594:
msg = message.content if payload.emoji.name == "":
await member.add_roles(role)
# If the message sent is within #verification # Set hamothyID equal to my id in discord
if message.channel.id == 728034083678060594: hamothyID = '<@&715412394968350756>'
# if the user has typed ~verify # Set the channel id to "general"
if "~verify" in msg.lower(): general = self.bot.get_channel(663651584399507481)
await message.delete()
# Get the 'Lucid' role and then give it to the user # String for welcoming people in the #general channel
role = discord.utils.get(message.guild.roles, name='Lucid') general_welcome = f"Welcome to the server! {member.mention} I hope you enjoy your stay here <a:huh:676195228872474643> <a:huh:676195228872474643> " \
await message.author.add_roles(role) f"\nPlease go into <#722347423913213992> to choose some ping-able roles for events! " \
f"\nPlease ping {hamothyID} for any questions about the server and of course, the other staff members!"
# if the person has the "lucid" role # Send welcome message to #general
if role in message.author.roles: await general.send(general_welcome)
# Set hamothyID equal to my id in discord
hamothyID = '<@&715412394968350756>'
# Set the channel id to "general"
general = self.bot.get_channel(663651584399507481)
# String for welcoming people in the #general channel
general_welcome = f"Welcome to the server! {message.author.mention} I hope you enjoy your stay here <a:huh:676195228872474643> <a:huh:676195228872474643> " \
f"\nPlease go into <#722347423913213992> to choose some ping-able roles for events! " \
f"\nPlease ping {hamothyID} for any questions about the server and of course, the other staff members!"
# Send welcome message to #general
await general.send(general_welcome)
# Delete the message no matter what message they send
else:
await message.delete()
# Allowing people to get ping-able self roles # Allowing people to get ping-able self roles
@command(name="verification") @command(name="verification")
@ -68,8 +54,8 @@ class Verification(commands.Cog):
"/image1.jpg?width=658&height=658") "/image1.jpg?width=658&height=658")
embed.set_author(name=ctx.author, icon_url=ctx.author.avatar_url) embed.set_author(name=ctx.author, icon_url=ctx.author.avatar_url)
embed.add_field( embed.add_field(
name="Type `~verify` to gain access to the rest of the server!", name="\u200b",
value="\u200b", value="React with ✅ to gain access to the rest of the server!",
inline=False) inline=False)
# Send embed to the channel it was called in # Send embed to the channel it was called in

Loading…
Cancel
Save