-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
41 lines (31 loc) · 1.03 KB
/
bot.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
40
41
import os
import discord
from dotenv import load_dotenv
from discord.ext import commands, tasks
from itertools import cycle
load_dotenv()
TOKEN = os.getenv('TOKEN')
client = commands.Bot(command_prefix='!')
client.remove_command('help')
@client.event
async def on_ready():
print(f"{client.user} has connected to Discord's API")
change_status.start()
@client.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandNotFound):
await ctx.send(f'Invalid command used perhaps take a look at: ''!help''?')
status = cycle(['Play.64Stacks.com', 'Minecraft: Java Edition', 'Minecraft: Secret Edition'])
@tasks.loop(seconds=45, minutes=0, hours=0, count=None, reconnect=True, loop=None)
async def change_status():
await client.change_presence(activity=discord.Game(next(status)))
client.cog_list = [
"cogs.server_management",
"cogs.user_management",
"cogs.useful",
"cogs.fun"
]
for cog in client.cog_list:
client.load_extension(cog)
print(f"\nAll {len(client.cog_list)} cogs loaded!\n")
client.run(TOKEN)