-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
37 lines (26 loc) · 928 Bytes
/
main.py
File metadata and controls
37 lines (26 loc) · 928 Bytes
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
import os
import sys
import discord
from discord.ext import commands
def create_bot():
intents = discord.Intents.default()
intents.message_content = True
intents.reactions = True
intents.voice_states = True
bot = commands.Bot(command_prefix="!", intents=intents, help_command=None)
return bot
async def load_cogs(bot: commands.Bot):
await bot.load_extension("discord_yt_bot.cogs.commands.help")
await bot.load_extension("discord_yt_bot.cogs.commands.music")
await bot.load_extension("discord_yt_bot.cogs.events.ready")
await bot.load_extension("discord_yt_bot.cogs.events.reactions")
def main():
bot = create_bot()
token = os.getenv("DISCORD_BOT_TOKEN")
if not token:
print("Error: Please set the DISCORD_BOT_TOKEN environment variable!")
sys.exit(1)
bot.loop.create_task(load_cogs(bot))
bot.run(token)
if __name__ == "__main__":
main()