Added custom activity types

This commit is contained in:
Profitroll 2023-05-06 19:06:04 +02:00
parent 5ff49ed052
commit df1732fa97
2 changed files with 36 additions and 4 deletions

View File

@ -3,7 +3,10 @@
"owner": 0,
"guild": 0,
"admins": [],
"status": "crying clowns",
"status": {
"type": "playing",
"message": "on your nerves"
},
"database": {
"user": null,
"password": null,

35
main.py
View File

@ -31,9 +31,38 @@ except ImportError:
@client.event
async def on_ready():
logger.info(f"Logged in as {client.user}")
await client.change_presence(
activity=Activity(type=ActivityType.listening, name=await config_get("status"))
)
activity_type = await config_get("type", "status")
activity_message = await config_get("message", "status")
if activity_type == "playing":
await client.change_presence(
activity=Activity(type=ActivityType.playing, name=activity_message)
)
elif activity_type == "watching":
await client.change_presence(
activity=Activity(type=ActivityType.watching, name=activity_message)
)
elif activity_type == "listening":
await client.change_presence(
activity=Activity(type=ActivityType.listening, name=activity_message)
)
elif activity_type == "streaming":
await client.change_presence(
activity=Activity(type=ActivityType.streaming, name=activity_message)
)
elif activity_type == "competing":
await client.change_presence(
activity=Activity(type=ActivityType.competing, name=activity_message)
)
elif activity_type == "custom":
await client.change_presence(
activity=Activity(type=ActivityType.custom, name=activity_message)
)
else:
return
logger.info(f"Set activity type to {activity_type} with message {activity_message}")
def main():