-
Notifications
You must be signed in to change notification settings - Fork 0
/
ulhacks_bot.py
55 lines (41 loc) · 1.27 KB
/
ulhacks_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
43
44
45
46
47
48
49
50
51
52
53
54
55
"""Entry point to the ULHacks Bot
For more info on why we have both a run and a _run function, see
https://github.com/GeeTransit/joshgone/blob/main/joshgone.py and its comments.
"""
import os
import discord
from discord.ext import commands
command_prefix = commands.when_mentioned_or("$")
intents = discord.Intents.all()
def _run(token, **bot_kwargs):
bot = commands.Bot(**bot_kwargs)
bot.load_extension("cogs.store")
bot.load_extension("cogs.info")
bot.load_extension("cogs.admin")
bot.load_extension("cogs.message")
bot.load_extension("cogs.welcome")
bot.load_extension("cogs.help")
bot.load_extension("cogs.moderators")
bot.load_extension("extensions.store")
close = bot.loop.close
bot.loop.close = lambda: None
bot.run(token)
bot.loop.close = close
return bot.loop
def run(token, **bot_kwargs):
"""Runs the ULHacks Bot with the provided token and bot options"""
loop = _run(token, **bot_kwargs)
try:
loop.call_later(0.1, loop.stop)
loop.run_forever()
finally:
loop.close()
def main():
"""Entry point to run the ULHacks bot"""
run(
os.environ["ULHACKS_BOT_TOKEN"],
command_prefix=command_prefix,
intents=intents,
)
if __name__ == "__main__":
main()