-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBRBot.py
More file actions
61 lines (52 loc) · 1.53 KB
/
BRBot.py
File metadata and controls
61 lines (52 loc) · 1.53 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
57
58
59
60
61
import os
import traceback
import discord
from discord import Intents, \
NoEntryPointError, \
ExtensionNotFound, \
ExtensionFailed
from discord.ext.bridge import \
Bot as BotBase
from CustomHelpCommand import CustomHelpCommand
from Utils.JsonHandler import settings
initial_extensions = [f'Cogs.{x}' for x in [
"PickCog",
"VoiceCog",
"StateCog",
"DraftCog",
"AdminCog"
]]
class BRBot(BotBase):
def __init__(self):
intents = Intents.default()
intents.members = True
intents.message_content = True
super().__init__(
command_prefix=settings['prefix'],
case_insensitive=False,
help_command=CustomHelpCommand(),
intents=intents,
debug_guilds=settings["guilds"]
)
self.bot_version = '0.0.0'
def load_cogs(self) -> None:
for ext in initial_extensions:
try:
self.load_extension(ext)
except (
ExtensionNotFound,
NoEntryPointError,
ExtensionFailed,
):
print(f'Failed to load extension {ext}.')
traceback.print_exc()
async def change_presence_to_help(self) -> None:
activity_type = discord.ActivityType.listening
await self.change_presence(activity=discord.Activity(
type=activity_type,
name=f"{settings['prefix']}help "
))
def runBRo() -> None:
bot = BRBot()
bot.load_cogs()
bot.run(os.getenv('TOKEN'))