This repository was archived by the owner on May 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.lua
More file actions
449 lines (405 loc) · 19.1 KB
/
bot.lua
File metadata and controls
449 lines (405 loc) · 19.1 KB
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
local discordia = require('discordia')
local client = discordia.Client()
client:on('ready', function()
print('Logged in as User: '.. client.user.username)
print('Printing Server List:')
for guild in client.guilds do
print(guild.name)
end
local f = io.open("DEFAULT_GAME", "rb")
local content = f:read("*all")
local game = string.gsub(content, "%s+", "")
f:close()
client:setGameName(game)
end)
local f = io.open("PREFIX", "rb")
local content = f:read("*all")
local prefix = string.gsub(content, "%s+", "")
f:close()
--Dev Var
CHRONOMLY = "251383432331001856"
JDENDER = "250432205145243649"
ROMTYPO = "186295030388883456"
SPACEX = "220568440161697792"
--TechTeam Var
serverbug = 0
KAYDAX = "142782417994907648"
PUFFLE = "201389895694942210"
STAR = "156019409658314752"
ORANGE = "269543926803726336"
--Commands
client:on('messageCreate', function(message)
-- exit early if the author is the same as the client
if message.author == client.user then return end
-- split the message content into a command and everything else
local cmd, arg = message.content:match('(%S+)%s+(.*)')
cmd = cmd or message.content
if cmd == (string.format(prefix .. 'ping')) then
local x = os.clock()
local s = 0
for i=1,100000 do s = s + i end
local ccolor = discordia.Color(math.random(255), math.random(255), math.random(255)).value
local embedmessage = message.channel:sendMessage {
embed = {
title = ":ping_pong: pong!",
color = ccolor,
timestamp = os.date('!%Y-%m-%dT%H:%M:%S'),
footer = {text = message.author.name}
}
}
if not embedmessage then noembedmsg = message.channel:sendMessage(luacode("pong")) end
if not embedmessage then noembedmsg.content = luacode("pong"..string.format(" - time taken: %.2fs", os.clock() - x)) end
if embedmessage then embedmessage.embed = {
title = ":ping_pong: pong!",
description = string.format("time taken: %.2fs", os.clock() - x),
color = ccolor,
timestamp = os.date('!%Y-%m-%dT%H:%M:%S'),
footer = {text = message.author.name}
} end
end
if cmd == (string.format(prefix .. 'donate')) then
message.channel:sendMessage('Please donate to our host here: https://www.patreon.com/shellshock')
end
if cmd == (string.format(prefix .. 'google')) then
message.channel:sendMessage('Searching!')
text="https://www.google.com/search?q=" .. arg
search = (string.gsub(text, "%s+", '%%20'))
message.channel:sendMessage {
embed = {
title = ":satellite: Here are the results",
fields = {
{name = "URL:", value = search, inline = true},
},
color = discordia.Color(114, 137, 218).value,
timestamp = os.date('!%Y-%m-%dT%H:%M:%S')
}
}
end
if cmd == (string.format(prefix .. 'smore')) then
message.channel:sendMessage('https://www.poptarts.com/content/NorthAmerica/pop_tarts/en_US/pages/flavors/bakery/frosted-s-mores-toaster-pastries/jcr:content/productContent/par/responsiveimage.img.png/1475703429032.png')
print(string.format('s.smore command was used by %s', message.author.id))
end
if cmd == (string.format(prefix .. 'meme')) then
message.channel:sendMessage('https://i.imgflip.com/p4v25.jpg')
print(string.format('s.memez command was used by %s', message.author.id))
end
if cmd == (string.format(prefix .. 'quote')) then
message.channel:sendMessage([[**fam i am a profeshanl factorio player**
**automate EVRYTHING** -Jdenderplays 2017]])
print(string.format('s.quote command was used by %s', message.author.id))
end
if cmd == (string.format(prefix .. 'fail')) then
message.channel:sendMessage(string.format('%s, you clearly havent been burdened by the overobundence of education have you?', arg))
print(string.format('s.fail command was used by %s', message.author.id))
end
if cmd == (string.format(prefix .. 'upvoteme')) then
message:addReaction("👍")
print(string.format('s.upvoteme command was used by %s', message.author.id))
end
--Bug Command
if cmd == (string.format(prefix .. 'bug')) then
if serverbug == 1 then
message.channel:sendMessage('Someone already reported a bug please wait for a dev to clear it.')
end
if serverbug == 0 then
message.channel:sendMessage('Bug reported. A helpful person will join your server to help soon')
local channel = client:getTextChannel("296030986708451328")
local maxUses = 1
local maxAge = 1800
local invite = message.channel:createInvite(maxAge, maxUses)
channel:sendMessage(string.format('In %s', message.guild.name));
channel:sendMessage(string.format(' User: %s reported:', message.author.username));
channel:sendMessage(arg);
channel:sendMessage('Invite: https://discord.gg/' .. invite.code)
print(string.format('s.bug command was used by %s to say', message.author.id))print(arg)
serverbug = 1
end
end
if cmd == (string.format(prefix .. 'clearbug')) then
if serverbug == 0 then
message.channel:sendMessage('No bug to clear :face_palm:')
end
if serverbug == 1 then
if message.author.id == CHRONOMLY or message.author.id == ROMTYPO or message.author.id == JDENDER or message.author.id == SPACEX or message.author.id == KAYDAX or message.author.id == PUFFLE or message.author.id == STAR or message.author.id == ORANGE then
message.channel:sendMessage(':thumbsup:')
local channel = client:getTextChannel("296030986708451328")
channel:sendMessage(string.format(message.author.username .. ' cleared a bug in %s', message.guild.name));
channel:sendMessage(string.format('with the reason, %s', arg))
print(string.format('s.clearbug command was used by %s with the reason,', message.author.id))print(arg)
serverbug = 0
end
end
end
--Echo Command
if cmd == (string.format(prefix .. 'echo')) then
if arg == nil then return end
message.channel:sendMessage(arg)
print(string.format('s.echo command was used by %s to say', message.author.id))print(arg)
end
--Info Command
if cmd == (string.format(prefix .. 'info')) then
message.channel:sendMessage(string.format([[
Hello, I am SmoreBot,
I am a Discord Bot made in **Lua** using **Discordia**, I am developed by Chronomly6 and jdenderplays, with a js version being made by SpaceX and ROM Typo, also I am in %s servers.]], client.guildCount
))
print(string.format('s.info was used by %s', message.author.id))
end
--Help Command
if cmd == 's.@290228059599142913>' then
message.channel:sendMessage('Help Sent! :mailbox_with_mail:')message.author:sendMessage{
embed = {
title = "Command List",
fields = {
{name = "Main Commands", value = [[
s.echo (text) - says what you say where it says "text"
s.memez - shows you the memes
s.ping - pings the bot
s.smore - shows you some poptarts
s.quote - a quote from jdenderplays
s.help - this message
s.fail - insults you in DMs
s.partners - dm's you a list of discord servers partnered with SmoreBot!]], inline = true},
{name = "Bot Info & s.bug", value = [[
s.join - some important links
s.info - some info about the bot
s.bug (the issue) - Reports a bug - help will come as soon as the team can.]], inline = true},
{name = "Music", value = "Sorry, really buggy", inline = true},
{name = "Utility", value = [[
s.google (your search) - searches google :face_palm:
]], inline = true},
},
color = discordia.Color(114, 137, 218).value,
timestamp = os.date('!%Y-%m-%dT%H:%M:%S')
}
}
print(string.format('s.help command was used by %s', message.author.id))
end
if cmd == (string.format(prefix .. 'help')) then
message.channel:sendMessage('Help Sent! :mailbox_with_mail:')message.author:sendMessage{
embed = {
title = "Command List",
fields = {
{name = "Main Commands", value = [[
s.echo (text) - says what you say where it says "text"
s.memez - shows you the memes
s.ping - pings the bot
s.smore - shows you some poptarts
s.quote - a quote from jdenderplays
s.help - this message
s.fail - insults you in DMs
s.partners - dm's you a list of discord servers partnered with SmoreBot!]], inline = true},
{name = "Bot Info & s.bug", value = [[
s.join - some important links
s.info - some info about the bot
s.bug (the issue) - Reports a bug - help will come as soon as the team can.]], inline = true},
{name = "Music", value = "Sorry, really buggy", inline = true},
{name = "Utility", value = [[
s.google (your search) - searches google :face_palm:
]], inline = true},
},
color = discordia.Color(114, 137, 218).value,
timestamp = os.date('!%Y-%m-%dT%H:%M:%S')
}
}
print(string.format('s.help command was used by %s', message.author.id))
end
if cmd == (string.format(prefix .. 'help')) then
if message.author.id == CHRONOMLY or message.author.id == ROMTYPO or message.author.id == JDENDER or message.author.id == SPACEX then
message.author:sendMessage{
embed = {
title = "Dev Commands",
fields = {
{name = "List", value = [[
s.sendall - sends a message to every server the bot is in
s.reboot - reboots the bot ;)
s.game - sets the bots playing status
s.announce (text) - announces something in #announcecements
s.leaveserver (id) - leaves the server
s.update - grabs changes from github
s.ban - what you think it does
s.kick - what you think it does]], inline = true},
},
color = discordia.Color(114, 137, 218).value,
timestamp = os.date('!%Y-%m-%dT%H:%M:%S')
}
}
print(string.format('a dev used s.help, known as %s', message.author.id))
end
end
--Partners Command
if cmd == (string.format(prefix .. 'partners')) then
message.channel:sendMessage('List Sent! :mailbox_with_mail:')message.author:sendMessage([[
**Partner List**
```
Coder Lounge - Chronomly6's Server - https://discord.gg/XCmxErJ
Project Placeholder5 - IDK WHAT THIS PLACE IS - https://discord.gg/ZtgQ62X
Chillax Zone - A pretty chill server - https://discord.gg/YabxP6P
Fun Message Lite - a chill and chat server - discord.gg/hVDzyZd
FireTrap - A cool bot - https://discordapp.com/oauth2/authorize?client_id=278539150699790347&scope=bot&permissions=8
Single Helix - the server of DNA - https://discord.gg/hZGhcxJ
Irish Squad - "Come be potatoes with us" Jackraw 2017 - https://discord.gg/qBMuYrx
```
__`ShellShock`__
• With the shutdown of Helix, and me (ROM Typo) being a dev of it, I've decided to keep the bot alive for everyone.
Add the bot here:
• http://romtypo.com/bots/helix
Join my server:
• http://discord.gg/ywBWwh6
]])
print(string.format('s.partners command was used by %s', message.author.id, '/', message.author.username))
end
--Bot Adding Info
if message.content == (string.format(prefix .. 'join')) then
message.channel:sendMessage {
embed = {
title = "Here are some important links",
fields = {
{name = "here is the link to add the bot: ", value = "https://discordapp.com/oauth2/authorize?client_id=290228059599142913&scope=bot&permissions=2146958463", inline = true},
{name = "here is the link to our website: ", value = "http://www.chronomly6.tk/smorebot.html", inline = true},
{name = "here is a link to our support/updates discord:", value = "https://discord.gg/6P6MNAU", inline = true},
{name = "Our official Twitter:", value = "https://twitter.com/smorebtofficial", inline = true},
},
color = discordia.Color(114, 137, 218).value,
timestamp = os.date('!%Y-%m-%dT%H:%M:%S')
}
}
end
--Dev Commands
if cmd == (string.format(prefix .. 'kick')) then
if message.author.id == CHRONOMLY or message.author.id == ROMTYPO or message.author.id == JDENDER or message.author.id == SPACEX then
local id = arg:match('s.@!?([0-9]+)>')
if id then
user = client:getUser(id)
message.guild:kickUser(user)
message.channel:sendMessage(string.format('SUMMONING THE KICK HAMMER ON: %s', id))
print(string.format('s.kick command was used by %s', message.author.id))
end
end
if message.author.id ~= CHRONOMLY and message.author.id ~= ROMTYPO and message.author.id ~= JDENDER and message.author.id ~= SPACEX then
message.channel:sendMessage('```Error2.1``````You do not have Role: Dev```')
print(string.format('%s tried to use s.kick', message.author.id))
end
end
if cmd == (string.format(prefix .. 'ban')) then
if message.author.id == CHRONOMLY or message.author.id == ROMTYPO or message.author.id == JDENDER or message.author.id == SPACEX then
local id = arg:match('s.@!?([0-9]+)>')
if id then
user = client:getUser(id)
message.guild:banUser(user)
message.channel:sendMessage(string.format('SUMMONING THE BAN HAMMER ON: %s', id))
print(string.format('s.ban command was used by %s', message.author.id))
end
end
if message.author.id ~= CHRONOMLY and message.author.id ~= ROMTYPO and message.author.id ~= JDENDER and message.author.id ~= SPACEX then
message.channel:sendMessage('```Error2.1``````You do not have Role: Dev```')
print(string.format('%s tried to use s.ban', message.author.id))
end
end
if cmd == (string.format(prefix .. 'host')) then
local handle = io.popen("hostname")
local result = handle:read("*a")
handle:close()
message.channel:sendMessage(string.format("I am hosted on `%s`",result))
end
if cmd == (string.format(prefix .. 'update')) then
if message.author.id == CHRONOMLY or message.author.id == ROMTYPO or message.author.id == JDENDER or message.author.id == SPACEX then
message.channel:sendMessage(":wave: grabbing from github!")
client:stop(true)
end
if message.author.id ~= CHRONOMLY and message.author.id ~= ROMTYPO and message.author.id ~= JDENDER and message.author.id ~= SPACEX then
message.channel:sendMessage('```Error2.1``````You do not have Role: Dev```')
print(string.format('%s tried to use s.reboot', message.author.id))
end
end
if cmd == (string.format(prefix .. 'leaveserver')) then
if message.author.id == CHRONOMLY or message.author.id == ROMTYPO or message.author.id == JDENDER or message.author.id == SPACEX then
local guild = client:getGuild(arg)
guild:leave()
end
if message.author.id ~= CHRONOMLY and message.author.id ~= ROMTYPO and message.author.id ~= JDENDER and message.author.id ~= SPACEX then
message.channel:sendMessage('```Error2.1``````You do not have Role: Dev```')
print(string.format('%s tried to use s.leaveserver', message.author.id))
print(arg)
end
end
if cmd == (string.format(prefix .. 'announce')) then
if message.author.id == CHRONOMLY or message.author.id == ROMTYPO or message.author.id == JDENDER or message.author.id == SPACEX then
local channel = client:getTextChannel("282977399761666059")
channel:sendMessage(string.format('**MESSAGE FROM THE DEV, %s**', message.author.username))channel:sendMessage(arg)
end
if cmd == (string.format(prefix .. 'announce')) then
if message.author.id ~= CHRONOMLY and message.author.id ~= ROMTYPO and message.author.id ~= JDENDER and message.author.id ~= SPACEX then
message.channel:sendMessage('```Error 404.5``````You do not have Role: Dev```')
print(string.format('%s tried to use s.announce to send', message.author.id))
print(arg)
end
end
end
if cmd == (string.format(prefix .. 'sendall')) then
if message.author.id == CHRONOMLY or message.author.id == ROMTYPO or message.author.id == JDENDER or message.author.id == SPACEX then
message.channel:sendMessage('')
for guild in client.guilds do
guild.defaultChannel:sendMessage(arg)
print('Message Sent to all servers')
end
end
if message.author.id ~= CHRONOMLY and message.author.id ~= ROMTYPO and message.author.id ~= JDENDER and message.author.id ~= SPACEX then
message.channel:sendMessage('```Error 404.5``````You do not have Role: Dev```')
print(string.format('%s tried to use s.sendall to send', message.author.id))
print(arg)
end
end
if cmd == (string.format(prefix .. 'game')) then
if message.author.id == CHRONOMLY or message.author.id == ROMTYPO or message.author.id == JDENDER or message.author.id == SPACEX then
client:setGameName(arg)message.channel:sendMessage('Set "playing status" to:')message.channel:sendMessage(arg)
print('s.game command was used')
end
if message.author.id ~= CHRONOMLY and message.author.id ~= ROMTYPO and message.author.id ~= JDENDER and message.author.id ~= SPACEX then
message.channel:sendMessage('```Error 404.5``````You do not have Role: Dev```')
print(string.format('%s tried to use s.game to set', message.author.id))
print(arg)
end
end
if message.content == (string.format(prefix .. 'reboot')) then
if message.author.id == CHRONOMLY or message.author.id == ROMTYPO or message.author.id == JDENDER or message.author.id == SPACEX then
message.channel:sendMessage(':wave: BRB!')
client:stop(true)
end
if message.author.id ~= CHRONOMLY and message.author.id ~= ROMTYPO and message.author.id ~= JDENDER and message.author.id ~= SPACEX then
message.channel:sendMessage('```Error2.1``````You do not have Role: Dev```')
print(string.format('%s tried to use s.reboot', message.author.id))
end
end
if cmd == (string.format(prefix .. 'guildlist')) then
if message.author.id == CHRONOMLY or message.author.id == ROMTYPO or message.author.id == JDENDER or message.author.id == SPACEX then
for guild in client.guilds do
message.channel:sendMessage(guild.name)
end
end
if message.author.id ~= CHRONOMLY and message.author.id ~= ROMTYPO and message.author.id ~= JDENDER and message.author.id ~= SPACEX then
message.channel:sendMessage('```Error2.1``````You do not have Role: Dev```')
print(string.format('%s tried to use s.guildlist', message.author.id))
end
end
--Music
if message.content == (string.format(prefix .. 'supported')) then
message.channel:sendMessage('```Chronomly has given up on music: please add ShellShock here:``` http://romtypo.com/bots/helix ```Or FireTrap here:``` https://goo.gl/SDbmyW')
end
if cmd == (string.format(prefix .. 'pause')) then
message.channel:sendMessage('```Chronomly has given up on music: please add ShellShock here:``` http://romtypo.com/bots/helix ```Or FireTrap here:``` https://goo.gl/SDbmyW')
end
if cmd == (string.format(prefix .. 'resume')) then
message.channel:sendMessage('```Chronomly has given up on music: please add ShellShock here:``` http://romtypo.com/bots/helix ```Or FireTrap here:``` https://goo.gl/SDbmyW')
end
if cmd == (string.format(prefix .. 'spawn')) then
message.channel:sendMessage('```Chronomly has given up on music: please add ShellShock here:``` http://romtypo.com/bots/helix ```Or FireTrap here:``` https://goo.gl/SDbmyW')
end
if cmd == (string.format(prefix .. 'play')) then
message.channel:sendMessage('```Chronomly has given up on music: please add ShellShock here:``` http://romtypo.com/bots/helix ```Or FireTrap here:``` https://goo.gl/SDbmyW')
end
end)
local f = io.open("LOGIN_TOKEN", "rb")
local content = f:read("*all")
local token = string.gsub(content, "%s+", "")
f:close()
client:run(token)