add the things!
This commit is contained in:
parent
636b989184
commit
c4423ace92
1 changed files with 41 additions and 2 deletions
43
bot.lua
43
bot.lua
|
@ -1,13 +1,52 @@
|
|||
local discordia = require('discordia')
|
||||
local client = discordia.Client()
|
||||
local http = require("simple-http")
|
||||
local json = require('json')
|
||||
local prefix = "."
|
||||
|
||||
--- https://stackoverflow.com/a/22843701
|
||||
string.startswith = function(self, str)
|
||||
return self:find('^' .. str) ~= nil
|
||||
end
|
||||
|
||||
client:on('ready', function()
|
||||
print('Logged in as '.. client.user.username)
|
||||
end)
|
||||
|
||||
client:on('messageCreate', function(message)
|
||||
if message.content == '.ping' then
|
||||
message.channel:send('Pong!')
|
||||
if message.content == prefix .. 'ping' then
|
||||
message.channel:send({embed = {title = "Ping?",description = "Pong!",color = 0x00FFFF}})
|
||||
end
|
||||
if message.content:startswith(prefix .. 'hug <@') then
|
||||
local body, res = http.request("GET", "https://nekos.life/api/v2/img/hug")
|
||||
message.channel:send({embed = {title = "Aww! " .. message.guild:getMember(message.author.id).username .. " hugged " .. message.guild:getMember(message.content:gsub(prefix .. 'hug <@', ''):gsub('>', '')).username .. "!",color = 0x00FFFF, image = {url = body.url, height = 0, width = 0}}})
|
||||
end
|
||||
if message.content:startswith(prefix .. 'cuddle <@') then
|
||||
local body, res = http.request("GET", "https://nekos.life/api/v2/img/cuddle")
|
||||
message.channel:send({embed = {title = "Aww! " .. message.guild:getMember(message.author.id).username .. " cuddled " .. message.guild:getMember(message.content:gsub(prefix .. 'cuddle <@', ''):gsub('>', '')).username .. "!",color = 0x00FFFF, image = {url = body.url, height = 0, width = 0}}})
|
||||
end
|
||||
if message.content:startswith(prefix .. 'kiss <@') then
|
||||
local body, res = http.request("GET", "https://nekos.life/api/v2/img/kiss")
|
||||
message.channel:send({embed = {title = "Aww! " .. message.guild:getMember(message.author.id).username .. " kissed " .. message.guild:getMember(message.content:gsub(prefix .. 'kiss <@', ''):gsub('>', '')).username .. "!",color = 0x00FFFF, image = {url = body.url, height = 0, width = 0}}})
|
||||
end
|
||||
if message.content:startswith(prefix .. 'slap <@') then
|
||||
local body, res = http.request("GET", "https://nekos.life/api/v2/img/slap")
|
||||
message.channel:send({embed = {title = "Aww! " .. message.guild:getMember(message.author.id).username .. " slapped " .. message.guild:getMember(message.content:gsub(prefix .. 'slap <@', ''):gsub('>', '')).username .. "!",color = 0x00FFFF, image = {url = body.url, height = 0, width = 0}}})
|
||||
end
|
||||
if message.content:startswith(prefix .. 'pat <@') then
|
||||
local body, res = http.request("GET", "https://nekos.life/api/v2/img/pat")
|
||||
message.channel:send({embed = {title = "Aww! " .. message.guild:getMember(message.author.id).username .. " patted " .. message.guild:getMember(message.content:gsub(prefix .. 'pat <@', ''):gsub('>', '')).username .. "!",color = 0x00FFFF, image = {url = body.url, height = 0, width = 0}}})
|
||||
end
|
||||
if message.content == prefix .. 'help' then
|
||||
message.channel:send("**Need help? Refer to my handy dandy help sheet!**\n\n```diff\n+ Action\nhug kiss pat cuddle slap\n\n+ Info\nping help\n```")
|
||||
end
|
||||
if message.content == prefix .. 'shutdown' then
|
||||
if message.author.id == "867901290336223242" then
|
||||
message.channel:send("**Shutting down!** Good night mother! :heart:")
|
||||
client:stop()
|
||||
else
|
||||
message.channel:send("You aren't my mother!")
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
|
Reference in a new issue