async def parse_vote_args(args, channel, member, message): if not args: members = get_member_in_channel(member.voice) else: try: members = get_member_in_channel(member.voice) except: members = [member] diff_members = message.mentions added = [] removed = [] for member in diff_members: if member in members: removed.append(member) members.remove(member) else: added.append(member) members.append(member) if removed: await channel.send( "The following player has been removed from the vote: " + ', '.join(i.mention for i in removed)) if added: await channel.send( "The following player has been added to the vote: " + ', '.join(i.mention for i in added)) if not members: raise BotError("Trying to run a vote without members") return members
async def cmd_draft(self, *args: str, channel, client, member, guild, **_): if not args: raise InvalidArgs("Command should take at least one parameter") if args[0].lower() == 'ffa': members = get_member_in_channel(member.voice) nb = len(members) generator = (m.mention for m in members) else: if not args[0].isdigit(): raise InvalidArgs( "1st Argument must be a integer (exemple: ``/draft 2``) or 'FFA'" ) nb = int(args[0]) if nb > 100: raise AntiRelouException( "Atempting to run a draft with more than 100 lines") generator = (f"n°{i+1}" for i in range(nb)) if guild and guild.id in [ 291751672106188800, 746790444171657347, 745407180638912582, 365593396548730883, 470335770972913664 ]: drafts = get_draft(nb, *args[1:], client=client, display_name="cpl") else: drafts = get_draft(nb, *args[1:], client=client) await draw_draft(drafts, generator, channel)
async def cmd_vote(self, *args, member, message: nextcord.Message, channel, client, **_): if not args: members = get_member_in_channel(member.voice) else: members = message.mentions if not members: raise InvalidArgs( "Vous devez sois laisser la commande vide, ou bien notifier chacune des personnes participant au vote" ) voting = Voting(members) await voting.run(channel, client)
async def cmd_draft(self, *args : str, channel, client, member, **_): if not args: raise InvalidArgs("Command should take at least one parameter") if args[0].lower() == 'ffa': members = get_member_in_channel(member.voice) nb = len(members) generator = (m.mention for m in members) else: if not args[0].isdigit(): raise InvalidArgs("1st Argument must be a integer (exemple: ``/draft 2``) or 'FFA'") nb = int(args[0]) generator = (f"n°{i+1}" for i in range(nb)) drafts = get_draft(nb, *args[1:], client=client) await draw_draft(drafts, generator, channel)
async def cmd_pingvocal(self, *args, channel, member, **_): members = get_member_in_channel(member.voice) if not members: raise NotFound("Member not found in channels") await channel.send(' '.join(member.mention for member in members))
async def cmd_blinddraft(self, *args : str, channel, client, member, **_): bd = BlindDraft(get_member_in_channel(member.voice), *args) await bd.run(channel, client=client)
async def cmd_teambuilder(self, *args, member, channel, message : nextcord.Message, **kwargs): pls = get_member_in_channel(member.voice) if member in pls: pls.remove(member) view = TeamBuilderView((member, member), pls) await channel.send(view=view, embed=view.to_embed())