|
|
@ -7,45 +7,63 @@ from discord.ext.commands import command, is_owner
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Set up Cog
|
|
|
|
# Set up Cog
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Verification(commands.Cog):
|
|
|
|
class Verification(commands.Cog):
|
|
|
|
def __init__(self, bot):
|
|
|
|
def __init__(self, bot):
|
|
|
|
self.bot = bot
|
|
|
|
self.bot = bot
|
|
|
|
self.guild = None
|
|
|
|
self.guild = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Setting up Listener to listen for reactions within the Verification channel
|
|
|
|
@commands.Cog.listener()
|
|
|
|
@commands.Cog.listener()
|
|
|
|
async def on_raw_reaction_add(self, payload):
|
|
|
|
async def on_raw_reaction_add(self, payload):
|
|
|
|
# Get the guild
|
|
|
|
# Get the guild
|
|
|
|
guild = self.bot.get_guild(payload.guild_id)
|
|
|
|
guild = self.bot.get_guild(payload.guild_id)
|
|
|
|
# Get the member
|
|
|
|
# Get the member
|
|
|
|
member = guild.get_member(payload.user_id)
|
|
|
|
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')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if payload.channel_id == 728034083678060594:
|
|
|
|
# Getting the channel verification by setting it to #verification
|
|
|
|
if payload.emoji.name == "✅":
|
|
|
|
channel = guild.get_channel(728034083678060594)
|
|
|
|
await member.add_roles(role)
|
|
|
|
|
|
|
|
|
|
|
|
# If the channel is not #verification, do nothing
|
|
|
|
|
|
|
|
if not channel:
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
# If the channel is #verification
|
|
|
|
|
|
|
|
elif channel:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# A check that makes sure that the reaction is done by the bot
|
|
|
|
|
|
|
|
def check(m):
|
|
|
|
|
|
|
|
return m == payload.member
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# If the member is not a user, do nothing
|
|
|
|
|
|
|
|
if not check(member):
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Get the 'Lucid' role and then give it to the user
|
|
|
|
|
|
|
|
role = discord.utils.get(guild.roles, name='Lucid')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# if the emoji that was reacted is the tick mark.
|
|
|
|
|
|
|
|
if payload.emoji.name == "✅":
|
|
|
|
|
|
|
|
await member.add_roles(role)
|
|
|
|
|
|
|
|
|
|
|
|
# Set hamothyID equal to my id in discord
|
|
|
|
# Set hamothyID equal to my id in discord
|
|
|
|
hamothyID = '<@&715412394968350756>'
|
|
|
|
hamothyID = '<@&715412394968350756>'
|
|
|
|
|
|
|
|
|
|
|
|
# Set the channel id to "general"
|
|
|
|
# Set the channel id to "general"
|
|
|
|
general = self.bot.get_channel(663651584399507481)
|
|
|
|
general = guild.get_channel(663651584399507481)
|
|
|
|
|
|
|
|
|
|
|
|
# String for welcoming people in the #general channel
|
|
|
|
# String for welcoming people in the #general channel
|
|
|
|
general_welcome = f"Welcome to the server! {member.mention} I hope you enjoy your stay here <a:huh:676195228872474643> <a:huh:676195228872474643> " \
|
|
|
|
general_welcome = f"Welcome to the server! {member.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 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!"
|
|
|
|
f"\nPlease ping {hamothyID} for any questions about the server and of course, the other staff members!"
|
|
|
|
|
|
|
|
|
|
|
|
# Send welcome message to #general
|
|
|
|
# Send welcome message to #general
|
|
|
|
await general.send(general_welcome)
|
|
|
|
await general.send(general_welcome)
|
|
|
|
|
|
|
|
|
|
|
|
# Allowing people to get ping-able self roles
|
|
|
|
# Allowing people to get ping-able self roles
|
|
|
|
@command(name="verification")
|
|
|
|
@command(name="verification")
|
|
|
|
@is_owner()
|
|
|
|
@is_owner()
|
|
|
|
async def verification(self, ctx):
|
|
|
|
async def verification(self, ctx):
|
|
|
|
# Set up embed to let the user know that they have to type ~verify
|
|
|
|
# Set up embed to let the user know that they have to react with ✅
|
|
|
|
embed = Embed(title="**Verification**",
|
|
|
|
embed = Embed(title="**Verification**",
|
|
|
|
colour=Colour(0xFF69B4),
|
|
|
|
colour=Colour(0xFF69B4),
|
|
|
|
timestamp=datetime.datetime.utcnow())
|
|
|
|
timestamp=datetime.datetime.utcnow())
|
|
|
@ -54,12 +72,13 @@ 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="\u200b",
|
|
|
|
name="Remember to read the rules!",
|
|
|
|
value="React with ✅ to gain access to the rest of the server!",
|
|
|
|
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 and automatically add the reaction ✅
|
|
|
|
await ctx.send(embed=embed)
|
|
|
|
verif = await ctx.send(embed=embed)
|
|
|
|
|
|
|
|
await verif.add_reaction('✅')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def setup(bot):
|
|
|
|
def setup(bot):
|
|
|
|