forked from NTUDevSoc/Discord-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
42 lines (33 loc) · 1.31 KB
/
bot.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
32
33
34
35
36
37
38
39
40
41
42
import discord
import os
import asyncio
from discord.ext import commands
intents = discord.Intents.default()
intents.members = True
intents.typing = True
intents.presences = True
intents.messages = True
intents.guilds = True
intents.reactions = True
client = commands.Bot(command_prefix=".", owner_id=83616065854115840, description="DevBot", intents=intents)
client.remove_command('help')
TOKEN = os.environ["TOKEN"]
@client.event
async def on_ready():
print(f"\n\nLogged in as: {client.user.name} - {client.user.id}\nVersion: {discord.__version__}\n")
print("Successfully logged in")
client.botLogChannel = await client.fetch_channel(814152479100633128)
client.botCommandChannel = await client.fetch_channel(517651663729852416)
client.roomChannel = await client.fetch_channel(892436503890915438)
#function to make the bot print every 28mins so Heroku doesn't stop it
async def stay_awake():
await client.wait_until_ready()
while not client.is_closed():
print('Im awake :)')
await asyncio.sleep(1680) #runs every 28mins.
for filename in os.listdir("./cogs"):
if filename.endswith(".py"):
client.load_extension(f"cogs.{filename[:-3]}")
print(f"Loaded Cog: {filename}")
client.loop.create_task(stay_awake())
client.run(TOKEN)