Skip to content

Commit

Permalink
Type Ignore for Admin Channel
Browse files Browse the repository at this point in the history
  • Loading branch information
sinsniwal committed Oct 12, 2023
1 parent cc64262 commit 2c7c2b9
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions cogs/reaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ def __init__(self, bot: IITMBot):
self.bot = bot
self._lock = asyncio.Lock()

async def send_to_admin(self, message):
guild = self.bot.guilds[0]
await guild.get_channel(766072627311673377).send(message) # type: ignore

@commands.Cog.listener()
async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):
"""
Expand Down Expand Up @@ -161,7 +165,7 @@ async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):
await member.send("You cant take Diploma roles if you are an alum.")
else:
await member.send(f"Admins were notified about this error, please wait for them to fix it.")
await guild.get_channel(766072627311673377).send(
await self.send_to_admin(
f"New Role set detected: {new_roles}, user: {member.mention}, userid: {member.id}"
)

Expand Down Expand Up @@ -208,7 +212,7 @@ async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):
await member.send("You cant take Diploma roles if you are an alum.")
else:
await member.send(f"Admins were notified about this error, please wait for them to fix it.")
await guild.get_channel(766072627311673377).send(
await self.send_to_admin(
f"New Role set detected: {new_roles}, user: {member.mention}, userid: {member.id}"
)
# extra
Expand Down Expand Up @@ -252,14 +256,13 @@ async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):
await member.send("Theres no BSc level in ES")
else:
await member.send(f"Admins were notified about this error, please wait for them to fix it.")
await guild.get_channel(766072627311673377).send(
await self.send_to_admin(
f"New Role set detected: {new_roles}, user: {member.mention}, userid: {member.id}"
)
return

else:
await member.send(f"Admins were notified about this error, please wait for them to fix it.")
await guild.get_channel(766072627311673377).send(
await self.send_to_admin(
f"New Role set detected: {new_roles}, user: {member.mention}, userid: {member.id}"
)

Expand Down Expand Up @@ -323,7 +326,7 @@ async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):
)
else:
await member.send(f"Admins were notified about this error, please wait for them to fix it.")
await guild.get_channel(766072627311673377).send(
await self.send_to_admin(
f"New Role set detected: {new_roles}, user: {member.mention}, userid: {member.id}"
)
return
Expand Down Expand Up @@ -397,7 +400,7 @@ async def on_raw_reaction_remove(self, payload: discord.RawReactionActionEvent):
await member.send("You cant take Diploma roles if you are an alum.")
else:
await member.send(f"Admins were notified about this error, please wait for them to fix it.")
await guild.get_channel(766072627311673377).send(
await self.send_to_admin(
f"New Role set detected: {new_roles}, user: {member.mention}, userid: {member.id}"
)

Expand Down Expand Up @@ -444,7 +447,7 @@ async def on_raw_reaction_remove(self, payload: discord.RawReactionActionEvent):
await member.send("You cant take Diploma roles if you are an alum.")
else:
await member.send(f"Admins were notified about this error, please wait for them to fix it.")
await guild.get_channel(766072627311673377).send(
await self.send_to_admin(
f"New Role set detected: {new_roles}, user: {member.mention}, userid: {member.id}"
)

Expand Down Expand Up @@ -500,13 +503,12 @@ async def on_raw_reaction_remove(self, payload: discord.RawReactionActionEvent):
await member.send("Theres no BSc level in ES")
else:
await member.send(f"Admins were notified about this error, please wait for them to fix it.")
await guild.get_channel(766072627311673377).send(
await self.send_to_admin(
f"New Role set detected: {new_roles}, user: {member.mention}, userid: {member.id}"
)
return
else:
await member.send(f"Admins were notified about this error, please wait for them to fix it.")
await guild.get_channel(766072627311673377).send(
await self.send_to_admin(
f"New Role set detected: {new_roles}, user: {member.mention}, userid: {member.id}"
)

Expand Down Expand Up @@ -562,13 +564,12 @@ async def on_raw_reaction_remove(self, payload: discord.RawReactionActionEvent):
)
else:
await member.send(f"Admins were notified about this error, please wait for them to fix it.")
await guild.get_channel(766072627311673377).send(
await self.send_to_admin(
f"New Role set detected: {new_roles}, user: {member.mention}, userid: {member.id}"
)
return
else:
await member.send(f"Admins were notified about this error, please wait for them to fix it.")
await guild.get_channel(766072627311673377).send(
await self.send_to_admin(
f"New Role set detected: {new_roles}, user: {member.mention}, userid: {member.id}"
)

Expand Down

0 comments on commit 2c7c2b9

Please sign in to comment.