-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathauto-status.py
33 lines (28 loc) · 1.39 KB
/
auto-status.py
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
29
30
31
32
33
import discord
import json
import datetime
import asyncio
dClient = discord.Client()
# Load config
config = {}
with open("config.json", "r") as f:
config = json.loads(f.read())
async def statusTask():
while True:
for status in config["statuses"]:
if status["type"] == "game":
await dClient.change_presence(activity=discord.Game(name=status["name"], start=datetime.datetime.now()-datetime.timedelta(status["duration"]), end=datetime.datetime.now()))
if status["type"] == "stream":
await dClient.change_presence(activity=discord.Streaming(name=status["name"], platform="YouTube", url=status["url"]))
if status["type"] == "competing":
await dClient.change_presence(activity=discord.Activity(name=status["name"], type=5, details=status["description"]))
if status["type"] == "watching":
await dClient.change_presence(activity=discord.Activity(name=status["name"], type=3, details=status["description"]))
if status["type"] == "listening":
await dClient.change_presence(activity=discord.Activity(name=status["name"], type=2))
await asyncio.sleep(status["delay"])
@dClient.event
async def on_ready():
print(f"logged in as {dClient.user} and changing status!")
dClient.loop.create_task(statusTask())
dClient.run(config["config"]["token"], bot=False)