-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
38 lines (30 loc) · 936 Bytes
/
main.py
File metadata and controls
38 lines (30 loc) · 936 Bytes
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
import os
import discord
from discord.ext import commands
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv("DISCORD_TOKEN")
intents = discord.Intents.default()
intents.message_content = True
intents.messages = True
intents.members = True
class RiotSocBot(commands.Bot):
def __init__(self):
super().__init__(
command_prefix='>',
intents=intents,
help_command=None
)
async def setup_hook(self):
# Load cogs
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
await self.load_extension(f'cogs.{filename[:-3]}')
await self.tree.sync()
print(f"Synced slash commands for {self.user}")
bot = RiotSocBot()
@bot.event
async def on_ready():
await bot.change_presence(activity=discord.CustomActivity(name='/help for commands'))
print(f'{bot.user} is online!')
bot.run(TOKEN)