pluralsync/updatediscordavatar.py

25 lines
647 B
Python
Raw Permalink Normal View History

2023-11-26 09:20:09 +00:00
#!/usr/bin/env python3
import os
import json
import discord
config_dir = os.getenv('APPDATA') if os.name == "nt" else os.path.expanduser('~') + "/.config"
config_dir += "/pluralsync/config.json"
f = open(config_dir)
json = json.load(f)
class MyClient(discord.Client):
async def on_ready(self):
print('Logged on as', self.user)
2024-01-14 00:57:56 +00:00
avatar_path = json["avatar_module"]["avatar_output_path"]
fp = open(avatar_path, 'rb')
avatar = fp.read()
await self.user.edit(avatar=avatar)
2023-11-26 09:58:47 +00:00
print('Discord module finished')
2023-11-26 09:20:09 +00:00
await self.close()
client = MyClient()
client.run(json["disc_module"]["token"])