-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
39 lines (30 loc) · 1.3 KB
/
main.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
import asyncio
import os
import discord
from discord.ext import commands
from dotenv import load_dotenv
load_dotenv()
intents = discord.Intents.all()
intents.members = True
class Bot(commands.Bot):
def __init__(self):
super().__init__(command_prefix='/', intents=discord.Intents.all(), help_command=commands.DefaultHelpCommand())
self.extension_list = []
async def on_ready(self):
print(f'{bot.user.name} has connected to Discord :)')
synced = await self.tree.sync()
print(f"Synced {len(synced)} command(s).")
await bot.change_presence(activity=discord.Game(name='Icebreaker bot | WIP'))
@commands.command(name="hello", description="Says hello to bot, testing if it is responding to commands.")
async def hello(self, ctx):
await ctx.send(f'Hello there, {ctx.author}!')
async def setup_hook(self):
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
try:
await bot.load_extension(f'cogs.{filename[:-3]}')
print(f'Loaded cog for {filename[:-3]} successfully.')
except:
print(f"Couldn't load cog for {filename[:-3]} successfully, or no commands were added from that class.")
bot = Bot()
bot.run(os.getenv('TOKEN'))