Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @client.command(pass_context=True)
- async def q(ctx):
- roles = ctx.message.author.roles
- rank = getRank(roles)
- channel = ctx.message.channel
- channelRank = getChannelRank(ctx.message.channel.id)
- if rank is not None and channelRank is not None and rank == channelRank:
- if ctx.message.author not in rankQueues[rank]["queue"]:
- async with lock:
- rankQueues[rank]["queue"].append(ctx.message.author)
- embed = discord.Embed()
- embed.add_field(name="{} players are in the queue.".format(len(rankQueues[rank]["queue"])), value="{} has joined the queue. To join the queue, type .q.".format(ctx.message.author.mention))
- embed.colour = rankQueues[rank]["color"]
- await channel.send(embed=embed)
- player_check(ctx.message.author)
- if len(rankQueues[rank]["queue"]) == 4:
- message = ""
- team1 = []
- team2 = []
- random.shuffle(rankQueues[rank]["queue"])
- for index, player in enumerate(rankQueues[rank]["queue"]):
- message += f"{player.mention} "
- if index < 2:
- team1.append(player)
- else:
- team2.append(player)
- await channel.send(message)
- embed = discord.Embed()
- embed.add_field(name="Lobby {} is ready!".format(lobby_num[0]), value="You may now join the team channels.")
- embed.add_field(name="**Team 1**", value="{} {}".format(team1[0].mention, team1[1].mention), inline=False)
- embed.add_field(name="**Team 2**", value="{} {}".format(team2[0].mention, team2[1].mention), inline=False)
- embed.colour = rankQueues[rank]["color"]
- await channel.send(embed=embed)
- client.loop.create_task(create_lobby_voice(ctx.message.guild, rankQueues[rank]["parent"], lobby_num[0]))
- password = randint(1000, 9999)
- username = "{}{}{}{}".format(random.choice(string.ascii_letters), random.choice(string.ascii_letters), random.choice(string.ascii_letters), random.choice(string.ascii_letters))
- for index, player in enumerate(rankQueues[rank]["queue"]):
- embed = discord.Embed()
- if index == 0:
- embed.add_field(name="Create lobby {}!".format(lobby_num[0]), value="Use this info to create the lobby!")
- embed.add_field(name="**Username**", value="{}".format(username))
- embed.add_field(name="**Password**", value="{}".format(password))
- else:
- embed.add_field(name="Lobby {} info:".format(lobby_num[0]), value="Use this info when joining the lobby.")
- embed.add_field(name="**Username**", value="{}".format(username))
- embed.add_field(name="**Password**", value="{}".format(password))
- await player.send(embed=embed)
- queue = {
- "id": lobby_num[0],
- "queue": {
- "team1": team1,
- "team2": team2
- }
- }
- lobby_num[0] = lobby_num[0] + 1
- rankQueues[rank]["progressQueues"].append(queue)
- rankQueues[rank]["queue"] = []
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement