def _registerHelp(msg): """ Returns register help embed """ embed = Embed( colour=Color.blurple(), title='How to register?', description= f'You have to accept the rules in <#{cfg.discord_ids["rules"]}> to register' ) embed.add_field(name='If you don\'t have a Jaeger account', value='`=r no account`\n', inline=False) embed.add_field( name='If you have a Jaeger account', value='`=r charName` - If your character names have faction suffixes\n' '`=r charName1 charName2 charName3` - If your character names don\'t have faction suffixes\n', inline=False) embed.add_field( name='Notify feature', value='`=notify` - To join or leave the Notify feature\n' f'When suscribed to Notify, you can be mentionned with <@&{cfg.discord_ids["notify_role"]}> by other players\n', inline=False) try: if isAdmin(msg.author): embed.add_field( name="Staff Commands", value= '`=unregister @player` - Permanently remove player profile from the system', inline=False) except AttributeError: pass # if msg is from bot return embed
def _lobbyHelp(msg): """ Returns lobby help embed """ embed = Embed(colour=Color.blurple()) embed.add_field(name='Lobby Commands', value='`=j` - Join the lobby\n' '`=l` - Leave the lobby\n' '`=q` - See the current lobby', inline=False) if isAdmin(msg.author): embed.add_field(name="Staff Commands", value='`=clear` - Clear the lobby', inline=False) return embed
async def on_message(message): if message.author == client.user: # if bot, do nothing await client.process_commands(message) return if isinstance(message.channel, DMChannel): # if dm, print in console and ignore the message print(message.author.name + ": " +message.content) return if message.channel.id not in (cfg.discord_ids["lobby"], cfg.discord_ids["register"], *cfg.discord_ids["matches"]): return if isAllLocked(): if not isAdmin(message.author): return # Admins can still use bot when locked if await isSpam(message): return message.content = message.content.lower() await client.process_commands(message) # if not spam, process await sleep(0.5) unlock(message.author.id) # call finished, we can release user
def _matchHelp(msg): """ Returns match help embed """ embed = Embed(colour=Color.blurple(), ) embed.add_field( name='Match commands', value='`=m` - Display the match status and team composition\n', inline=False) embed.add_field(name='Team Captain commands', value='`=p @player` - Pick a player in your team\n' '`=p VS`/`NC`/`TR` - Pick a faction\n' '`=p base name` - Pick the map *base name*\n' '`=ready` - To toggle the ready status of your team', inline=False) if isAdmin(msg.author): embed.add_field(name="Staff Commands", value='`=clear` - Clear the match\n' '`=map base name` - Select a map', inline=False) return embed
async def on_raw_reaction_add(payload): # Has to be on_raw cause the message already exists when the bot starts if payload.member == None or payload.member.bot: # If bot, do nothing return if isAllLocked(): if not isAdmin(payload.member): return if payload.message_id == cfg.discord_ids["rules_msg"]: # reaction to the rule message? global rulesMsg if str(payload.emoji) == "✅": try: getPlayer(payload.member.id) except ElementNotFound: # if new player Player(payload.member.name, payload.member.id) # create a new profile await channelSend("REG_RULES", cfg.discord_ids["register"], payload.member.mention) # they can now register registered = payload.member.guild.get_role(cfg.discord_ids["registered_role"]) info = payload.member.guild.get_role(cfg.discord_ids["info_role"]) await payload.member.add_roles(registered) await payload.member.remove_roles(info) await rulesMsg.remove_reaction(payload.emoji, payload.member) # In any case remove the reaction, message is to stay clean
async def cog_check(self, ctx): return isAdmin(ctx.author)