11import asyncio
2- from asyncio .tasks import wait
3- from datetime import date
42import codingame
53import discord
6- import random
74import json
85from discord .colour import Color
96from discord .ext import commands
@@ -22,13 +19,9 @@ async def on_command_error(ctx, error):
2219@bot .event
2320async def on_ready ():
2421 print ('Le bot est pret' )
25- presences = ["!game to join a game" , "!profile to get a profile" , "coding ..." ]
26- while not bot .is_closed :
27- presence = random .choice (presences )
28- await bot .change_presence (activity = presence )
29- await asyncio .sleep (6 )
22+ await bot .change_presence (activity = discord .Game (name = "!help" ))
3023
31- @bot .command (name = "unlink" )
24+ @bot .command (name = "unlink" , description = "Unlink you from your actual profil" )
3225async def unlink (ctx ):
3326 with open ("./config/db.json" , "r+" ) as file :
3427 file_data = json .load (file )
@@ -44,7 +37,7 @@ async def unlink(ctx):
4437 with open ("./config/db.json" , "w+" ) as fp :
4538 json .dump (file_data , fp , sort_keys = True , indent = 4 )
4639
47- @bot .command (name = "link" )
40+ @bot .command (name = "link" , description = "link you to a codingame profil" )
4841async def link (ctx , arg ):
4942 with open ("./config/db.json" , "r+" ) as file :
5043 file_data = json .load (file )
@@ -60,7 +53,7 @@ async def link(ctx, arg):
6053 with open ("./config/db.json" , "w+" ) as fp :
6154 json .dump (file_data , fp , sort_keys = True , indent = 4 )
6255
63- @bot .command (name = "profil" )
56+ @bot .command (name = "profil" , description = "See an user profil from codingame" )
6457async def profil (ctx , arg = None ):
6558 if not arg :
6659 file = open ("./config/db.json" , "r+" )
@@ -79,7 +72,7 @@ async def profil(ctx, arg=None):
7972 embed .set_thumbnail (url = codingamer .avatar_url )
8073 await ctx .send (embed = embed )
8174
82- @bot .command (name = "game" )
75+ @bot .command (name = "game" , description = "Join the actual game of clash of code" )
8376async def game (ctx ):
8477 coc = client .get_pending_clash_of_code ()
8578 embed = discord .Embed (title = "Click to join" , url = coc .join_url , description = "**Players online:**" , color = Color .blue ())
@@ -89,7 +82,7 @@ async def game(ctx):
8982 embed .set_footer (text = "Time before start: " + str (coc .time_before_start .seconds ) + "s" )
9083 await ctx .send (embed = embed )
9184
92- @bot .command (name = "next" )
85+ @bot .command (name = "next" , description = "Join the next game of clash of code" )
9386async def next (ctx ):
9487 coc = client .get_pending_clash_of_code ()
9588 next_battle = coc .time_before_start .seconds
0 commit comments