File tree Expand file tree Collapse file tree 2 files changed +39
-41
lines changed
Expand file tree Collapse file tree 2 files changed +39
-41
lines changed Original file line number Diff line number Diff line change 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 )
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments