for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
from typing import Optional
from discord import TextChannel
from discord.ext import commands
from app.bot import Bot
CHANNEL_ID = 900370744263966821
ROLE_ID = 888527962935296091
class WorkerRole(commands.Cog):
"""A simple commands cog template."""
def __init__(self, client: Bot):
"""Link to bot instance."""
self.client: Bot = client
self.channel: Optional[TextChannel] = None
@commands.Cog.listener()
async def on_ready(self):
self.channel = self.client.guild.get_channel(CHANNEL_ID)
async def on_member_update(self, before, after):
diff_roles = [
role.id for role in after.roles if role not in before.roles
]
if ROLE_ID in diff_roles:
await self.channel.send(f"{after.mention}")
def setup(client: Bot):
client.add_cog(WorkerRole(client))