local discordia = require('discordia') local client = discordia.Client { gatewayIntents = 3276541, } local http = require("simple-http") local json = require('json') local prefix = "," math.randomseed(os.time()) --- https://stackoverflow.com/a/22843701 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(">","") local user = guild:getMember(b) if user.nickname == nil then return user.name else return user.nickname end else local b = str:gsub("<@",""):gsub(">","") local user = client:getUser(b) return user.name end end client:on('ready', function() print('Logged in as '.. client.user.username) end) client:on('messageCreate', function(message) if message.content == prefix .. 'ping' and message.author.id == client.owner.id then message.channel:send({embed = {title = "Ping?",description = "Pong!",color = 0x00FFFF}}) end if message.guild.id == "1209971237770498088" and string.find(message.content:lower(), "sako") and string.find(message.content:lower(), "lovely") and message.author.id ~= client.user.id then local counter = load("counter.txt") counter = tonumber(counter) message:addReaction("1️⃣") counter = counter + 1 write("counter.txt", tostring(counter)) end if message.content == prefix .. 'sacounter' and message.author.id ~= "1152611181601759326" then local counter = load("counter.txt") message.channel:send("**we have said that sako is lovely ".. counter .. " times**") end if message.content == prefix .. 'shutdown' then if message.author.id == "867901290336223242" then message.channel:send("aight byte") client:stop() end end end) client:run('Bot ' .. load("token.txt"))