-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathloader.py
More file actions
35 lines (29 loc) · 1.3 KB
/
loader.py
File metadata and controls
35 lines (29 loc) · 1.3 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
from .modules import *
import CubeHelper.ListsLogic.MaterialLists as MaterialLists
async def load(client: commands.Bot):
print(f'\nLoading\t\tAddon\t\t{addon_name}')
cogs = [os.path.join(addon_name, 'Commands'), os.path.join(addon_name, 'ContextMenus')]
for cog in cogs:
scripts = [filename for filename in os.listdir(cog) if filename.endswith('.py')]
for script in scripts:
try:
await client.load_extension(f'{cog.replace(os.sep,".")}.{script[:-3]}')
print(f' • Loaded {os.path.basename(cog[:-1])} {script[:-3]}')
except Exception:
print(f' • Unable to load {os.path.basename(cog[:-1])} {script[:-3]}')
if under_maintenance:
presence_message = 'Under Maintenance'
else:
presence_message = 'Use /help'
await client.change_presence(
activity = discord.CustomActivity(
name = presence_message,
status = discord.Status.online)
)
print(f' • Updating Logs...')
await MaterialLists.updateStates(client)
print(f' • Logs updated')
print(f' • Reactivating lists...')
await MaterialLists.reactiveLists(client)
print(f' • Lists reactivated')
print(' Loading Complete')