-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
31 lines (22 loc) · 870 Bytes
/
main.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
from dotenv import load_dotenv
import os
import discord
from discord.ext import commands, tasks
import json
intents = discord.Intents.default()
bot = commands.Bot(command_prefix=commands.when_mentioned, intents=intents, help_command=None)
@tasks.loop(minutes=1)
async def watching():
await bot.wait_until_ready()
with open("./src/data/channels.json", "r") as f:
data: dict = json.load(f)
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=f"{len(data)} channels"))
for filename in os.listdir("./cogs"):
if filename.endswith(".py"):
bot.load_extension(f"cogs.{filename[:-3]}")
for filename in os.listdir("./cogs/stores"):
if filename.endswith(".py"):
bot.load_extension(f"cogs.stores.{filename[:-3]}")
watching.start()
load_dotenv("./.env")
bot.run(os.getenv("DISCORD_TOKEN"))