implemented DM when it's time to BeReal.

This commit is contained in:
2024-03-02 23:18:11 +01:00
parent 540a61fb45
commit 7de887038d
5 changed files with 44 additions and 26 deletions

View File

@@ -1,3 +1,4 @@
import time
import discord, asyncio
import os
from discord.ext import commands
@@ -11,13 +12,22 @@ intents.dm_messages = True
app = commands.Bot(command_prefix=",", intents=intents)
app.db = database.controller.Database("database.db")
# load cogs
async def load_cogs():
for filename in os.listdir("bot/commands"):
if filename.endswith(".py"):
await app.load_extension(f"bot.commands.{filename[:-3]}")
async def time_to_bereal():
# Get subscribers
subscribers = app.db.get_subscribers()
# Send message to all subscribers
for subscriber in subscribers:
user = await app.fetch_user(subscriber.user_id)
await user.send(f"# :warning: It's time to BeReal.\nOpen BeReal. to post what you are doing right now.\n<t:{int(time.time())}:R>")
app.time_to_bereal = time_to_bereal
@app.event
async def on_ready():