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/
|
||||
data/
|
||||
discordia.log
|
||||
gateway.json
|
||||
token.txt
|
||||
|
|
36
bot.lua
36
bot.lua
|
@ -2,7 +2,7 @@ local discordia = require('discordia')
|
|||
local client = discordia.Client()
|
||||
local http = require("simple-http")
|
||||
local json = require('json')
|
||||
local prefix = "."
|
||||
local prefix = ";"
|
||||
math.randomseed(os.time())
|
||||
|
||||
--- https://stackoverflow.com/a/22843701
|
||||
|
@ -10,6 +10,22 @@ string.startswith = function(self, str)
|
|||
return self:find('^' .. str) ~= nil
|
||||
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)
|
||||
if guild ~= nil then
|
||||
local b = str:gsub("<@",""):gsub(">","")
|
||||
|
@ -89,11 +105,22 @@ client:on('messageCreate', function(message)
|
|||
message.channel:send("You gotta pat someone!")
|
||||
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+ 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
|
||||
if message.content == prefix .. 'source' then
|
||||
message.channel:send("**Look inside my brain at https://git.colean.cc/threeoh6000/joltik**")
|
||||
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.author.id == "867901290336223242" then
|
||||
message.channel:send("**Shutting down!** Good night mother! :heart:")
|
||||
|
@ -104,7 +131,4 @@ client:on('messageCreate', function(message)
|
|||
end
|
||||
end)
|
||||
|
||||
local f = io.open("token.txt", "r")
|
||||
local token = f:read("*a")
|
||||
f:close()
|
||||
client:run('Bot ' .. token:gsub("\n",""))
|
||||
client:run('Bot ' .. load("token.txt"))
|
||||
|
|
Reference in a new issue