-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
56 lines (39 loc) · 1.07 KB
/
bot.py
File metadata and controls
56 lines (39 loc) · 1.07 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Standard Libraries
import configparser
# Third-party Libraries
import discord
from discord.ext import commands
# Bot Data
# Bot Modules
# Bot Cogs
from cogs.temp_channel import TempChannel
from cogs.utils import Utils
# ==============================
# CONFIGURATION
# ==============================
# Configuration File Parsing
config = configparser.ConfigParser()
try:
config.read('config.ini')
TOKEN = config['Bot']['Token']
except (configparser.Error, KeyError) as e:
raise SystemExit("Error reading configuration file.") from e
# Bot Command Intents
intents = discord.Intents.default()
intents.message_content = True
intents.members = True
# Bot initialization
bot = commands.Bot(command_prefix='!', intents=intents)
bot.remove_command('help')
# ==============================
# BOT EVENTS
# ==============================
@bot.event
async def on_ready():
print(f'Logged in as {bot.user}')
await bot.add_cog(TempChannel(bot))
await bot.add_cog(Utils(bot))
@bot.event
async def on_message(message):
await bot.process_commands(message)
bot.run(TOKEN)