forked from Senor-Ducky/Chintubot-public
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
47 lines (33 loc) · 1.29 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
40
41
42
43
44
45
46
47
import os
from itertools import cycle
import discord
from discord.ext import commands, tasks
from dotenv import load_dotenv
# import praw
load_dotenv()
bot = commands.Bot(command_prefix='$')
@bot.event
async def on_ready():
print('We have logged in as {0.user}'.format(bot))
change_status.start()
status = cycle(['WhiteHatJr SEO', ' with wolf gupta', 'with Lana Rhoades'])
@tasks.loop(seconds=300)
async def change_status():
await bot.change_presence(activity=discord.Game(next(status)))
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CheckFailure):
embed = discord.Embed(title=':x: oops! You do not have permission to use this command.',
color=discord.Colour.red())
await ctx.send(embed=embed)
elif isinstance(error, commands.MissingRequiredArgument):
embed = discord.Embed(
title=':x:You are missing the required arguements. Please check if your command requires an addition arguement.',
color=discord.Colour.red())
await ctx.send(embed=embed)
elif isinstance(error, commands.CommandNotFound):
pass
for filename in os.listdir('./cogs'):
if filename.endswith(".py"):
bot.load_extension(f'cogs.{filename[:-3]}')
bot.run(os.getenv("TOKEN"))