working bot but commands dont get registered on the guilds yet.
This commit is contained in:
parent
2eb74ad89a
commit
4c15168fde
1 changed files with 16 additions and 10 deletions
16
pybot-f.py
16
pybot-f.py
|
@ -3,6 +3,7 @@
|
||||||
import os
|
import os
|
||||||
import configparser
|
import configparser
|
||||||
import discord
|
import discord
|
||||||
|
import asyncio
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
description = '''Testing this bot stuff :)'''
|
description = '''Testing this bot stuff :)'''
|
||||||
|
@ -37,15 +38,20 @@ async def joined(ctx, member: discord.Member):
|
||||||
"""Says when a member joined."""
|
"""Says when a member joined."""
|
||||||
await ctx.send(f'{member.name} joined {discord.utils.format_dt(member.joined_at)}')
|
await ctx.send(f'{member.name} joined {discord.utils.format_dt(member.joined_at)}')
|
||||||
|
|
||||||
with os.scandir('./ext/') as dirs:
|
async def scanext():
|
||||||
|
with os.scandir('./ext/') as dirs:
|
||||||
for entry in dirs:
|
for entry in dirs:
|
||||||
if entry.name.endswith('.py'):
|
if entry.name.endswith('.py'):
|
||||||
try:
|
try:
|
||||||
print(entry.name)
|
print(f"Loading extension: {entry.name}")
|
||||||
await bot.load_extension('ext.' + entry.name)
|
await bot.load_extension('ext.' + os.path.splitext(entry.name)[0])
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
print(f'Error loading {entry.name}: {error}')
|
print(f'Error loading {entry.name}: {error}')
|
||||||
|
|
||||||
|
|
||||||
bot.load_extension('ext/test.py')
|
async def main():
|
||||||
bot.run(bottoken)
|
async with bot:
|
||||||
|
await scanext()
|
||||||
|
await bot.start(bottoken)
|
||||||
|
|
||||||
|
asyncio.run(main())
|
Loading…
Add table
Reference in a new issue