-
Notifications
You must be signed in to change notification settings - Fork 7
/
python_bot.py
139 lines (101 loc) · 5.33 KB
/
python_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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# library imports
from discord import Client #you'll need this install
import discord
import time
# local file imports
import config
import globals_file
from commands import help, weather, single_giphy_results_display, harry_potter, define, giphy, ping, clean, Mark, lunch, set_lunch, emojify, friday, vote, covid, stonks
from rules import turn_on_pc, reddit_link, pre_add_reaction, auto_triggered_messages, timecard_reminder, count_audit
from client_interactions import send_message
#from config.py file
discordApiKey = config.bot_token
giphyApiKey = config.giphy_api_key
weather_api_key = config.weather_api_key
dictionary_api = config.dictionary_api
client = discord.Client()
@client.event
async def on_ready():
#info
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
globals_file.init(client, config)
if(globals_file.game_played_config):
client_game = discord.Game(name=globals_file.game_played_config['game_played'])
await client.change_presence(activity = client_game)
@client.event
async def on_message(message):
if(globals_file.logs_config and message.channel == globals_file.logs_config['logs_channel']):
return 0
if(message.author != client.user and message.channel.name and globals_file.logs_config and message.channel.id not in globals_file.logs_config['ignored_channels']):
message_string = (message.author.name + " said : \"" + message.clean_content + "\" in #" + message.channel.name + " @ " + time.ctime())
await globals_file.logs_config['logs_channel'].send(message_string)
if(turn_on_pc.is_triggered(message)):
await turn_on_pc.apply(client, message)
await pre_add_reaction.apply(client, message)
# if(message.author != client.user and message.channel.name and globals_file.timecard_reminder_config):
# await timecard_reminder.apply(client, message)
if(globals_file.count_config and count_audit.is_triggered(message)):
await count_audit.apply(client, message)
if(auto_triggered_messages.is_triggered(message.content)):
await auto_triggered_messages.apply(client, message)
if(covid.is_triggered(message.content)):
await covid.command(client, message)
elif(message.content.lower() == ('!version')):
await send_message(message, 'Version: %s' % globals_file.version)
elif(message.content.startswith('!status')):
await send_message(message, 'I am here')
elif(message.content.startswith(help.TRIGGER)):
await help.command(client, message)
elif(ping.is_triggered(message.content)):
await ping.command(client, message)
elif(reddit_link.is_triggered(message.content)):
await reddit_link.apply(client, message)
elif(config.giphy_api_key and giphy.is_triggered(message.content)):
await giphy.command(client, message, giphyApiKey)
elif(clean.is_triggered(message.content)):
await clean.command(client, message)
elif(message.content.lower() == '!pizza'):
await send_message(message, 'Pizza? Who\'s paying for this? Definitely not me.')
elif(vote.is_downvote(message.content)):
await send_message(message, 'This command is currently unavailable')
# await vote.command(client, message, 'down')
elif(vote.is_upvote(message.content)):
await send_message(message, 'This command is currently unavailable')
# await vote.command(client, message, 'up')
elif(vote.is_display(message.content)):
await send_message(message, 'This command is currently unavailable')
#await vote.command(client, message, 'display')
elif(globals_file.lunch_time and lunch.is_triggered(message.content)):
await lunch.command(client, message)
elif(Mark.is_triggered(message.content)):
await Mark.command(client, message, globals_file.id_mark)
elif(friday.is_triggered(message.content)):
await friday.command(client, message)
elif(emojify.is_triggered(message.content)):
await emojify.command(client, message)
elif(globals_file.lunch_time and set_lunch.is_triggered(message.content)):
await set_lunch.command(client, message)
elif(message.content.startswith(single_giphy_results_display.TRIGGER)):
await single_giphy_results_display.command(client, message)
elif(config.weather_api_key and message.content.lower().startswith(weather.TRIGGER)):
await weather.command(client, message, weather_api_key)
elif(config.finnhub_api_key and stonks.is_triggered(message.content)):
await stonks.command(client, message)
elif(message.content.lower().startswith(harry_potter.TRIGGER_PAUSE)):
await send_message(message, 'This command is currently unavailable')
# await harry_potter.command(client, message, 'pause')
elif(message.content.lower().startswith(harry_potter.TRIGGER_STOP)):
await send_message(message, 'This command is currently unavailable')
# await harry_potter.command(client, message, 'stop')
elif(message.content.lower().startswith(harry_potter.TRIGGER_RESUME)):
await send_message(message, 'This command is currently unavailable')
# await harry_potter.command(client, message, 'resume')
elif(message.content.lower().startswith(harry_potter.TRIGGER_BEGIN)):
await send_message(message, 'This command is currently unavailable')
# await harry_potter.command(client, message, 'begin')
elif(config.dictionary_api and message.content.lower().startswith(define.TRIGGER)):
await define.command(client, message, dictionary_api)
client.run(discordApiKey)