pluralsync/updatepfp.py

24 lines
588 B
Python
Raw 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)
pfp_path = json["pfp_module"]["pfp_output_path"]
fp = open(pfp_path, 'rb')
pfp = fp.read()
await self.user.edit(avatar=pfp)
await self.close()
client = MyClient()
client.run(json["disc_module"]["token"])