-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.lua
More file actions
331 lines (276 loc) · 10.8 KB
/
bot.lua
File metadata and controls
331 lines (276 loc) · 10.8 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
local discordia = require("discordia")
local json = require("json")
local http = require("coro-http")
local client = discordia.Client()
local unpack = table.unpack or unpack
local token = os.getenv("token")--your own bot's token here
local affirmations = {
"Don’t sweat the small stuff.",
"You are love. You are purpose. You were made with divine intention.",
"You can. You will. End of story.",
"You are adventurous. You overcome fears by following your dreams.",
"You feed your spirit. You train your body. You focus your mind. It’s your time.",
"You are in charge of how you feel and today you are choosing happiness.",
"You are your own superhero.",
"You will not compare myself to strangers on the Internet.",
"You are choosing and not waiting to be chosen.",
"You are enough.",
"You are whole.",
"You have the power to create change.",
"You let go of all things that no longer serve you.",
"You can do all things.",
"You refuse to give up because you haven’t tried all possible ways.",
"You deserve the best and you will accept the best now.",
"You're going to make everyone so proud.",
"Your presence is your power.",
"When you really want it, you are unstoppable."}
local jokes = {
"kunal","mohsen","Yashas","Andrea","Ronnie","Marc Yu", "jacob", "ze", "jake", "noah", "groovy", "michelle"
}
local dice = {
"1", "2", "3", "4", "5", "6"
}
local hug = {
"I love hugs, thanks!", "I\'m always here for you!", "embraces you", "*hug*"
}
--[[
Notes
bot page: https://top.gg/bot/786804598835904543
]]
function Joke(message)
coroutine.wrap(function()
local link = "https://icanhazdadjoke.com/slack"
local result, body = http.request("GET", link)
body = json.parse(body)
-- $ curl -H "Accept: application/json" https://icanhazdadjoke.com/
-- print(body["joke"])
message:reply("<@!"..message.member.id.."> "..body["attachments"][1].fallback)
end)()
end
function cute(message)
coroutine.wrap(function()
local link = "https://www.reddit.com/r/eyebleach/new.json?limit=100"
local result, body = http.request("GET", link)
body = json.parse(body)
message:reply(body["data"]["children"][math.random(1, 100)]["data"].url)
end)()
end
function meme(message)
coroutine.wrap(function()
local link = "https://www.reddit.com/r/wholesomememes/new.json?limit=100"
local result, body = http.request("GET", link)
body = json.parse(body)
message:reply(body["data"]["children"][math.random(1, 100)]["data"].url)
end)()
end
function food(message)
coroutine.wrap(function()
local link = "https://www.reddit.com/r/food/new.json?limit=100"
local result, body = http.request("GET", link)
local postnum = math.random(1, 100)
body = json.parse(body)
message:reply(
body["data"]["children"][postnum]["data"].title.."\n"..
body["data"]["children"][postnum]["data"].url)
end)()
end
function showerthought(message)
coroutine.wrap(function()
local link = "https://www.reddit.com/r/showerthoughts/new.json?limit=100"
local result, body = http.request("GET", link)
local postnum = math.random(1, 100)
body = json.parse(body)
message:reply(
body["data"]["children"][postnum]["data"].title)
end)()
end
function cat(message)
coroutine.wrap(function()
local link = "https://www.reddit.com/r/illegallysmolcats/new.json?limit=100"
local result, body = http.request("GET", link)
local postnum = math.random(1, 100)
body = json.parse(body)
message:reply(
body["data"]["children"][postnum]["data"].url)
end)()
end
function info(message)
coroutine.wrap(function()
local ts=tostring
local cpu=uv.cpu_info()
local threads=#cpu
local cpumodel=cpu[1].model
local mem=math.floor(collectgarbage('count')/1000)
message:reply {
embed = {
title = "Info",
fields = {
{name = "OS: ", value = ts(operatingsystem),inline = false},
{name = "CPU Threads: ", value = ts(threads),inline = false},
{name = "CPUT Mode: ", value = ts(cpumodel), inline = false},
{name = "Memory Usage: ", value = ts(mem).." MB", inline = false}
}
}
}
end)()
end
client:on('ready', function()
-- client.user is the path for your bot
print('Logged in as '.. client.user.username)
end)
-- message create
client:on("messageCreate", function(message)
if message.author.bot then return end -- Make sure a bot cannot execute this command.
local content = message.content
local member = message.member
local memberid = message.member.id
-- Ping
if content:find("ping") then
message:reply("🏓pong")
-- local otime = os.time - message.createdAt
-- local ctime = client:ping
-- message:reply("🏓Latency is "..otime.."ms. API Latency is " ..ctime.."ms")
end
-- Joke
if content:lower() == "~joke" then
Joke(message)
end
-- Cute
if content:lower() == "~cute" then
cute(message)
end
-- Meme
if content:lower() == "~meme" then
meme(message)
end
-- Food
if content:lower() == "~food" then
food(message)
end
-- Sad
if content:lower() == "~sad" then
message:reply("don't be sad!")
message:reply(affirmations[ math.random( #affirmations ) ])
cute(message)
end
-- Coin
if content:lower() == "~coin" then
local coin1 = math.random(1,100)
if coin1 > 50 then
message:reply("Heads (\\*^▽^\\*)")
elseif coin1 == 50 then
message:reply("THE COIN LANDED ON ITS EDGE (╯°□°)╯︵ ┻━┻")
else
message:reply("Tails (✿◡‿◡)")
end
end
-- Dice
if content:lower() == "~dice" then
message:reply(dice[math.random(#dice)])
end
-- Hug
if content:lower() == "~hug" then
message:reply(hug[math.random(#hug)])
end
-- showerthought
if content:lower() == "~showerthought" then
showerthought(message)
end
-- cat
if content:lower() == "~cat" then
cat(message)
end
-- Info
if content:lower() == "~info" then
-- info(message)
message:reply("na")
end
-- Help Menu
if content:lower() == "~help" then
if message.guild.id ~= "724363919035990106" then
message:reply {
embed = {
title = "Invite to your Server",
url = "https://discord.com/api/oauth2/authorize?client_id=786804598835904543&permissions=388161&scope=bot",
description = "Command List",
author = {
name = "Help Menu",
icon_url = "https://i.imgur.com/dqsdblw.png"
},
thumbnail = {url = "https://i.imgur.com/2RQ2OlG.jpg"},
fields = {
{name = "~joke", value = "jokes",inline = false},
{name = "~cute", value = "cute pictures",inline = false},
{name = "~meme", value = "wholesome memes", inline = false},
{name = "~food", value = "yumyum", inline = false},
{name = "~sad", value = "sad no more", inline = false},
{name = "~coin", value = "flip a coin", inline = false},
{name = "~dice", value = "rolls a dice", inline = false},
{name = "~hug", value = "bot gives you a hug", inline = false},
{name = "~dice", value = "rolls a dice", inline = false},
{name = "~showerthought", value = "Showerthoughts", inline = false},
{name = "-----", value = "Other messages will be sent based on message context", inline = false}
},
color = discordia.Color(85, 211, 197).value,
-- timestamp = os.date('!%Y-%m-%dT%H:%M:%S'),
footer = {text = message.author.name.." | Made by Marshmallows7920 - version 1.0.1 2021"}
}
}
else
message:reply {
embed = {
title = "Invite to your Server",
url = "https://discord.com/api/oauth2/authorize?client_id=786804598835904543&permissions=388161&scope=bot",
description = "Command List",
author = {
name = "Help Menu",
icon_url = "https://i.imgur.com/dqsdblw.png"
},
thumbnail = {url = "https://i.imgur.com/2RQ2OlG.jpg"},
fields = {
{name = "~joke", value = "jokes",inline = false},
{name = "~cute", value = "cute pictures",inline = false},
{name = "~meme", value = "wholesome memes", inline = false},
{name = "~food", value = "yumyum", inline = false},
{name = "~sad", value = "sad no more", inline = false},
{name = "~coin", value = "flip a coin", inline = false},
{name = "~dice", value = "rolls a dice", inline = false},
{name = "~hug", value = "bot gives you a hug", inline = false},
{name = "~showerthought", value = "Showerthoughts", inline = false},
{name = "-----", value = "Automated messages disabled on this server", inline = false}
},
color = discordia.Color(85, 211, 197).value,
-- timestamp = os.date('!%Y-%m-%dT%H:%M:%S'),
footer = {text = message.author.name.." | Made by Marshmallows7920 - version 1.0.1 2021"}
}
}
end
end
-- disabled on cs server
if message.guild.id ~= "724363919035990106" then
-- Sad
if content:find("I'm sad") then
message:reply("don't be sad!")
message:reply(affirmations[ math.random( #affirmations ) ])
cute(message)
end
-- Bad
if content:find("bad") then
message:reply("not bad")
end
-- Love
if content:find("I love") then
message:reply("I love you")
end
-- Wholesome
if content:find("wholesome") then
message:reply("Quite Wholesome")
end
-- Kunal
if content:lower() == "tell me a joke" then
message:reply(jokes[math.random(#jokes)])
end
end
end)
-- client:run("Bot "..io.open("./login.txt"):read())
client:run("Bot "..token)