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

Commit 93af954

Browse files
committed
MOD | added ranks and config files
1 parent 87748c9 commit 93af954

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

main.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
import codingame
44
import discord
55
import random
6+
import json
67
from discord.colour import Color
78
from discord.ext import commands
89

9-
bot = commands.Bot(command_prefix="!")
10+
with open("./config/config.json", "r") as cjson:
11+
config = json.load(cjson)
12+
bot = commands.Bot(command_prefix=config["prefix"])
1013
client = codingame.Client()
1114

15+
1216
@bot.event
1317
async def on_command_error(ctx, error):
1418
await ctx.send(f"An error occured: {str(error)}")
@@ -22,10 +26,13 @@ async def on_ready():
2226
await bot.change_presence(activity=discord.Game(name=presence))
2327
await asyncio.sleep(6)
2428

25-
@bot.command(name="profile")
26-
async def profile(ctx, arg):
29+
@bot.command(name="profil")
30+
async def profil(ctx, arg):
2731
codingamer = client.get_codingamer(arg)
2832
embed = discord.Embed(title=codingamer.pseudo, url="https://www.codingame.com/profile/" + codingamer.public_handle, color=0xFF5733)
33+
embed.add_field(name="Clash Of Code Global rank:", value=str(codingamer.get_clash_of_code_rank()) + " ème", inline=True)
34+
embed.add_field(name="Global Rank", value=str(codingamer.rank) + " ème", inline=True)
35+
embed.add_field(name="Level:", value=str(codingamer.level), inline=False)
2936
embed.set_thumbnail(url=codingamer.avatar_url)
3037
await ctx.send(embed=embed)
3138

@@ -40,4 +47,4 @@ async def game(ctx):
4047
embed.set_footer(text="Time before start: " + str(coc.time_before_start))
4148
await ctx.send(embed=embed)
4249

43-
bot.run("/")
50+
bot.run(config["token"])

0 commit comments

Comments
 (0)