-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.py
More file actions
28 lines (25 loc) · 980 Bytes
/
client.py
File metadata and controls
28 lines (25 loc) · 980 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from stats import read_stat
from art import *
from discord import CustomActivity
from chess import get_elo
import discord
import os
import time
import logging
# https://github.com/dolfies/discord.py-self#quick-example
class MyClient(discord.Client):
async def on_ready(self):
os.system("cls || clear")
print("\033[1;96m", end="")
tprint("chess.py", space=1)
print("\033[0m", end="")
print(" \033[1;96m[*]\033[0m Now managing your Discord account's status with your elo.")
print(" \033[1;96m[*]\033[0m Press \"CTRL + C\" to stop the script.")
mode = read_stat('mode')
while True:
await self.change_presence(activity=CustomActivity(emoji="♟️", name=f"{mode.title()}: {get_elo(read_stat("username"), mode)} • Chess.com"))
time.sleep(25)
def start_discord_client():
logging.getLogger('discord').disabled = True
client = MyClient()
client.run(read_stat("token"))