-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
61 lines (47 loc) · 1.59 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
import discord
import global_vars
import json
import os
from commands.Admin import *
from commands.Menu import *
from commands.Quotes import *
from discord.ext import commands
''' Initialize global variables '''
global_vars.init()
bot = commands.Bot(command_prefix='!')
bot.add_cog(Admin(bot))
bot.add_cog(Menu(bot))
bot.add_cog(Quotes(bot))
@bot.event
async def on_message(msg):
''' Ignore Bot messages '''
if msg.author.bot:
return
''' Print message to console '''
print('{0}\t | {1} | {2}'.format(msg.author.name,
msg.created_at.now(), msg.content))
''' Process !prefix commands '''
await bot.process_commands(msg)
@bot.event
async def on_message_edit(before_msg, after_msg):
''' Ignore Bot messages '''
if after_msg.author.bot:
return
''' Print message to console '''
print('{0}\t | {1} | {2}'.format(after_msg.author.name,
after_msg.created_at.now(), after_msg.content))
''' Process !prefix commands '''
await bot.process_commands(after_msg)
@bot.event
async def on_ready():
if global_vars.PROD:
await bot.user.edit(username='Squidy Bot Reborn')
else:
await bot.user.edit(username='Test Bot Reborn')
await bot.change_presence(status=discord.Status.online,
activity=discord.Activity(name='v{0}'.format(version)))
print('-----------------------------------------------------------')
print('Bot "{0}:{1}" logged in'.format(bot.user.name, bot.user.id))
print('-----------------------------------------------------------')
''' Start Bot '''
bot.run(global_vars.TOKEN)