feat: Status changes whenever it's time to BeReal and if it's too late
This commit is contained in:
19
bot/utils/ChangeStatus.py
Normal file
19
bot/utils/ChangeStatus.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import asyncio
|
||||
import discord, time
|
||||
from discord.ext import commands
|
||||
|
||||
|
||||
async def switch_to_online(app: commands.Bot, expiration: int):
|
||||
await app.change_presence(
|
||||
status=discord.Status.online,
|
||||
activity=discord.Activity(name="⚠️ Time to BeReal. | /subscribe", type=discord.ActivityType.watching),
|
||||
)
|
||||
await asyncio.sleep(expiration - time.time())
|
||||
await switch_to_dnd(app)
|
||||
|
||||
|
||||
async def switch_to_dnd(app: commands.Bot):
|
||||
await app.change_presence(
|
||||
status=discord.Status.do_not_disturb,
|
||||
activity=discord.Activity(name="BeReal. Notifications | /subscribe", type=discord.ActivityType.watching),
|
||||
)
|
Reference in New Issue
Block a user