Skip to content
This repository was archived by the owner on Sep 7, 2021. It is now read-only.

Commit cd32e1b

Browse files
committed
MOD | add next command to join the next clash
1 parent 73de6fa commit cd32e1b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

main.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,26 @@ async def profil(ctx, arg):
3939

4040
@bot.command(name="game")
4141
async def game(ctx):
42+
coc = client.get_pending_clash_of_code()
43+
embed = discord.Embed(title="Click to join", url=coc.join_url, description="**Players online:**", color=Color.blue())
44+
embed.set_thumbnail(url="https://res.cloudinary.com/crunchbase-production/image/upload/c_lpad,f_auto,q_auto:eco,dpr_1/v1410916443/e1aka8oyy6vnsbrt8ogw.png")
45+
for player in coc.players:
46+
embed.add_field(name=player.pseudo, value="https://www.codingame.com/profile/" + player.public_handle)
47+
embed.set_footer(text="Time before start: " + str(coc.time_before_start.seconds) + "s")
48+
await ctx.send(embed=embed)
49+
50+
@bot.command(name="next")
51+
async def next(ctx):
52+
coc = client.get_pending_clash_of_code()
53+
next_battle = coc.time_before_start.seconds
54+
await ctx.send("Next battle in " + str(next_battle) + "s ~")
55+
while next_battle > 5:
56+
coc = client.get_pending_clash_of_code()
57+
next_battle = coc.time_before_start.seconds
58+
print(next_battle)
59+
await asyncio.sleep(5)
60+
await asyncio.sleep(next_battle + 5)
61+
await ctx.send(ctx.author.mention)
4262
coc = client.get_pending_clash_of_code()
4363
embed = discord.Embed(title="Click to join", url=coc.join_url, description="**Players online:**", color=Color.blue())
4464
embed.set_thumbnail(url="https://res.cloudinary.com/crunchbase-production/image/upload/c_lpad,f_auto,q_auto:eco,dpr_1/v1410916443/e1aka8oyy6vnsbrt8ogw.png")

0 commit comments

Comments
 (0)