add welon sus counter
This commit is contained in:
parent
f7d23d620e
commit
5699b8a052
2 changed files with 31 additions and 6 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
||||||
deps/
|
deps/
|
||||||
|
data/
|
||||||
discordia.log
|
discordia.log
|
||||||
gateway.json
|
gateway.json
|
||||||
token.txt
|
token.txt
|
||||||
|
|
36
bot.lua
36
bot.lua
|
@ -2,7 +2,7 @@ local discordia = require('discordia')
|
||||||
local client = discordia.Client()
|
local client = discordia.Client()
|
||||||
local http = require("simple-http")
|
local http = require("simple-http")
|
||||||
local json = require('json')
|
local json = require('json')
|
||||||
local prefix = "."
|
local prefix = ";"
|
||||||
math.randomseed(os.time())
|
math.randomseed(os.time())
|
||||||
|
|
||||||
--- https://stackoverflow.com/a/22843701
|
--- https://stackoverflow.com/a/22843701
|
||||||
|
@ -10,6 +10,22 @@ string.startswith = function(self, str)
|
||||||
return self:find('^' .. str) ~= nil
|
return self:find('^' .. str) ~= nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function load(filename)
|
||||||
|
local f = io.open(filename, "r")
|
||||||
|
if not f then return false end
|
||||||
|
local token = f:read("*a")
|
||||||
|
f:close()
|
||||||
|
return token:gsub("\n","")
|
||||||
|
end
|
||||||
|
|
||||||
|
function write(filename, inp)
|
||||||
|
local f = io.open(filename, "w")
|
||||||
|
if not f then return false end
|
||||||
|
local token = f:write(inp)
|
||||||
|
f:close()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
function getnick(str, guild)
|
function getnick(str, guild)
|
||||||
if guild ~= nil then
|
if guild ~= nil then
|
||||||
local b = str:gsub("<@",""):gsub(">","")
|
local b = str:gsub("<@",""):gsub(">","")
|
||||||
|
@ -89,11 +105,22 @@ client:on('messageCreate', function(message)
|
||||||
message.channel:send("You gotta pat someone!")
|
message.channel:send("You gotta pat someone!")
|
||||||
end
|
end
|
||||||
if message.content == prefix .. 'help' then
|
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+ Fun\n8ball\n\n+ Info\nping help source\n```")
|
message.channel:send("**Need help? Refer to my handy dandy help sheet!**\n\n```diff\n+ Action\nhug kiss pat cuddle slap\n\n+ Fun\n8ball counter\n\n+ Info\nping help source\n```")
|
||||||
|
end
|
||||||
|
if message.content:lower() == "welon sus" then
|
||||||
|
local welonsus = load("data/welon.txt")
|
||||||
|
welonsus = tonumber(welonsus)
|
||||||
|
message:addReaction("🗿")
|
||||||
|
welonsus = welonsus + 1
|
||||||
|
write("data/welon.txt", tostring(welonsus))
|
||||||
end
|
end
|
||||||
if message.content == prefix .. 'source' then
|
if message.content == prefix .. 'source' then
|
||||||
message.channel:send("**Look inside my brain at https://git.colean.cc/threeoh6000/joltik**")
|
message.channel:send("**Look inside my brain at https://git.colean.cc/threeoh6000/joltik**")
|
||||||
end
|
end
|
||||||
|
if message.content == prefix .. 'counter' then
|
||||||
|
local weloncounter = load("data/welon.txt")
|
||||||
|
message.channel:send("**Times Welon has been sus:** ".. weloncounter)
|
||||||
|
end
|
||||||
if message.content == prefix .. 'shutdown' then
|
if message.content == prefix .. 'shutdown' then
|
||||||
if message.author.id == "867901290336223242" then
|
if message.author.id == "867901290336223242" then
|
||||||
message.channel:send("**Shutting down!** Good night mother! :heart:")
|
message.channel:send("**Shutting down!** Good night mother! :heart:")
|
||||||
|
@ -104,7 +131,4 @@ client:on('messageCreate', function(message)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local f = io.open("token.txt", "r")
|
client:run('Bot ' .. load("token.txt"))
|
||||||
local token = f:read("*a")
|
|
||||||
f:close()
|
|
||||||
client:run('Bot ' .. token:gsub("\n",""))
|
|
||||||
|
|
Reference in a new issue