-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.py
77 lines (53 loc) · 1.88 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import discord
import os
from data.keep_alive import keep_alive
from discord.ext import commands
client = commands.Bot(command_prefix = "#", case_insensitive=True)
client.remove_command("help")
@client.event
async def on_member_join(ctx,member):
await ctx.send( f'Hi {member.name}, welcome to cul-Ahem server')
await member.dm_channel.send(
f'Hi {member.name}, welcome to cul-Ahem server'
)
@client.event
async def on_ready():
print("Bot is online!")
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name='#help'))
#COGS ====>
modules = ['games', 'corona', 'admin', 'events', 'fun', 'help', 'info', 'weather', 'api', 'anime', 'meme']
try:
for module in modules:
client.load_extension('cogs.' + module)
print(f'Loaded: {module}.')
except Exception as e:
print(f'Error loading {module}: {e}')
print('Bot.....Activated')
#====START ====>
#EVENTS====>
### --SHIFTED TO COGS ---###
#GAMES ====>
### --SHIFTED TO COGS ---###
#CORONA ====>
### --SHIFTED TO COGS ---###
#ADMINISTRATOR COMMANDS====>
### --SHIFTED TO COGS ---###
#HELP====>
### --SHIFTED TO COGS ---###
#ERROR HANDLING====>
@client.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandNotFound):
await ctx.send("Command not found. Please type in a valid command.")
elif isinstance(error, commands.MissingRequiredArgument):
await ctx.send("Missing required arguments. Please type in *all* arguments.")
elif isinstance(error, commands.MissingPermissions):
await ctx.send("You do not have the necessary permissions.")
elif isinstance(error, commands.CommandOnCooldown):
msg = "You are on cooldown, please try again in {:.2f}s".format(error.retry_after)
await ctx.send(msg)
#API====>
### --SHIFTED TO COGS ---###
#<====END====
keep_alive()
client.run(os.getenv('TOKEN'))