Skip to content

Commit ddbe9d3

Browse files
Migrated app.py -> __init__.py
1 parent d1b7002 commit ddbe9d3

File tree

2 files changed

+39
-41
lines changed

2 files changed

+39
-41
lines changed

src/__init__.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import os
2+
import asyncio
3+
import discord
4+
from discord.ext import commands
5+
6+
from .config import Config
7+
8+
9+
client = commands.Bot(
10+
command_prefix = Config.COMMAND_PREFIX,
11+
intents = discord.Intents.all()
12+
)
13+
14+
# Configuration
15+
@client.event
16+
async def on_ready():
17+
print(f'Client [{client.user}] UP')
18+
19+
@client.event
20+
async def on_message(message: str):
21+
# Allow text to invoke comamnds
22+
await client.process_commands(message)
23+
24+
25+
# Loading cogs
26+
async def load_cogs():
27+
for filename in os.listdir(os.path.join(os.getcwd(), 'src', 'cogs')):
28+
if filename.endswith('.py'):
29+
await client.load_extension(
30+
f'.cogs.{filename.split("/")[-1][:-3]}',
31+
package = 'src'
32+
)
33+
34+
35+
# Main runner
36+
async def main():
37+
async with client:
38+
await load_cogs()
39+
await client.start(Config.BOT_TOKEN)

src/app.py

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)