implemented DM when it's time to BeReal.
This commit is contained in:
12
bot/app.py
12
bot/app.py
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user