Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[Dependencies:
- https://luvit.io/install.html
- https://github.com/SinisterRectus/Discordia
- If you need help:
- Cy#5148
- ]]
- local Discordia = require('discordia')
- local Afk = false
- local Client = Discordia.Client{
- cacheAllMembers = true;
- syncGuilds = true;
- }
- local Enums = Discordia.enums
- local LogMessages = false
- local Cmds = {}
- Discordia.extensions()
- local BallTable = {"[ 8ball ] says Yes.","[ 8ball ] says No.","[ 8ball ] says Maybe.","[ 8ball ] says I can't answer right now."}
- local Token = "" -- your token (for the SelfBot to actually function)
- Client:on('ready',function()
- print'Say shelp for help!'
- Client:setGame("CyBot Client Is Running.")
- end)
- local function RunCmd(Msg,Member)
- local CommandName
- local NewCommandName
- local Arguments = {}
- local Content = Msg.content:lower()
- local NewMsg = string.match(Content,"")
- if NewMsg then
- Content = string.gsub(Content,""..NewMsg,"",1)
- for Arguments2 in string.gmatch(Content,"[^%s]+") do
- table.insert(Arguments,Arguments2)
- end
- CommandName = Arguments[1]
- table.remove(Arguments,1)
- NewCommandName = Cmds[CommandName]
- if NewCommandName then
- NewCommandName(Arguments,Member,Msg)
- end
- end
- end
- Client:on('messageCreate',function(Message)
- if LogMessages and Message.author ~= Client.user then
- print("Message Author: "..Message.author.tag.."\nMessage Content: "..Message.content.."\nMessage Id: "..Message.id)
- end
- if Message.author == Client.user then
- RunCmd(Message,Message.author)
- end
- if Message.author == Client.user and Afk and not string.find(Message.content:lower(),'afk') then
- Afk = false
- Client:setGame("CyBot Client Is Running.")
- end
- end)
- Cmds.sstop = function(Arguments,Member,Message)
- Client:setGame(nil)
- Client:stop()
- end
- Cmds.slogmessages = function(Arguments,Member,Message)
- if Arguments[1] then
- if tostring(string.lower(Arguments[1])) == "on" then
- LogMessages = true
- elseif tostring(string.lower(Arguments[1])) == "off" then
- LogMessages = false
- end
- end
- end
- Cmds.afk = function(Arguments,Member,Message)
- Client:setGame(Member.name.." is Afk.")
- Afk = true
- end
- Cmds.serverinfo = function(Arguments,Member,Message)
- local VoiceChannels
- local TextChannels
- local Categories
- local Emojis
- local RoleAmount
- local BotAmount
- local BotTable = {}
- local Normies = {}
- local Humans
- local CreatedAt = Message.guild.createdAt
- local Date = os.date("*t", CreatedAt)
- local Online
- for i,v in pairs(Message.guild.members) do
- if v.bot then
- table.insert(BotTable,v)
- else
- table.insert(Normies,v)
- end
- end
- for i = 1,#Message.guild.emojis do
- Emojis = i
- end
- for i = 1,#Message.guild.voiceChannels do
- VoiceChannels = i
- end
- for i = 1,#Message.guild.categories do
- Categories = i
- end
- for i = 1,#Message.guild.textChannels do
- TextChannels = i
- end
- for i = 1,#Message.guild.roles do
- RoleAmount = i
- end
- for i = 1,#BotTable do
- BotAmount = i
- end
- for i = 1,#Normies do
- Normies = i
- end
- Message:reply{
- embed = {
- author = {name = Message.guild.name;url = "https://pastebin.com/3NABhEEw";icon_url = Message.guild.iconURL or "http://cyhost.x10.mx/Gallery/80cf2ec6a5.png";};
- fields = {
- {name = "Owner";value = Message.guild.owner.tag;inline = true;};
- {name = "Region";value = Message.guild.region;inline = true;};
- {name = "Channel Categories";value = Categories;inline = true;};
- {name = "Text Channels";value = TextChannels;inline = true;};
- {name = "Voice Channels";value = VoiceChannels;inline = true;};
- {name = "Members";value = Message.guild.totalMemberCount;inline = true;};
- {name = "People";value = Normies or 0;inline = true;};
- {name = "Bots";value = BotAmount or 0;inline = true;};
- {name = "Created At";value = Date.year.."-".."0"..Date.month.."-"..Date.day;inline = true;};
- {name = "Roles";value = RoleAmount;inline = true;};
- {name = "Emojis";value = Emojis or 0;inline = true;};
- {name = "Joined At";value = Message.member.joinedAt:sub(1,10);inline = true;};
- };
- color = Discordia.Color.fromRGB(139,0,0).value;
- footer = {text = "Made by Cy#5148 | Server Id "..Message.guild.id};
- };
- }
- end
- Cmds.servericon = function(Arguments,Member,Message)
- Message:reply("Server icon: "..Message.guild.iconURL)
- end
- Cmds.enlarge = function(Arguments,Member,Message)
- if Arguments[1] then
- if not tostring(Arguments[1]).animated then
- Message:reply("https://cdn.discordapp.com/emojis/"..tostring(Arguments[1]:match"%d+")..".png")
- else
- Message:reply("https://cdn.discordapp.com/emojis/"..tostring(Arguments[1]:match"%d+")..".gif")
- end
- end
- end
- Cmds.sban = function(Arguments,Member,Message)
- if Arguments[1] and Message.guild and Message.guild.me:hasPermission(Message.channel,Enums.permission.banMembers) or Message.guild.me:hasPermission(Message.channel,Enums.permission.administrator) then
- if Arguments[2] then
- for user in Message.mentionedUsers:iter() do
- local Ban = table.concat(Arguments, " ")
- user:send("You were banned from: "..Message.guild.name..". For: "..Ban:sub(23))
- Message.guild:banUser(user,Ban:sub(23))
- end
- elseif not Arguments[2] then
- for user in Message.mentionedUsers:iter() do
- user:send("You were banned from: "..Message.guild.name..". For: Unspecified Reason.")
- Message.guild:banUser(user,"Unspecified Reason.")
- end
- end
- end
- end
- Cmds.skick = function(Arguments,Member,Message)
- if Arguments[1] and Message.guild and Message.guild.me:hasPermission(Message.channel,Enums.permission.kickMembers) or Message.guild.me:hasPermission(Message.channel,Enums.permission.administrator) then
- if Arguments[2] then
- for user in Message.mentionedUsers:iter() do
- local Kick = table.concat(Arguments, " ")
- user:send("You were kicked from: "..Message.guild.name..". For: "..Kick:sub(23))
- Message.guild:kickUser(user,Kick:sub(23))
- end
- elseif not Arguments[2] then
- for user in Message.mentionedUsers:iter() do
- user:send("You were kicked from: "..Message.guild.name..". For: Unspecified Reason.")
- Message.guild:kickUser(user,"Unspecified Reason.")
- end
- end
- end
- end
- Cmds.sunban = function(Arguments,Member,Message)
- if Arguments[1] and Message.guild then
- if Message.member:hasPermission(Message.channel,Enums.permission.banMembers) or Message.member:hasPermission(Message.channel,Enums.permission.administrator) then
- local Unban = table.concat(Arguments, " ")
- Message:reply("<@"..Unban.."> has been unbanned.")
- Message.member.guild:unbanUser(Unban)
- end
- end
- end
- Cmds.everyoneping = function(Arguments,Member,Message)
- for a in Message.guild.members.toArray() do
- print(a)
- Message:reply("<@"..a..">")
- end
- end
- Cmds["8ball"] = function(Arguments,Member,Message)
- if Arguments[1] then
- Message:reply{embed = { author = { name = "CyBot Client"; url = "https://pastebin.com/3NABhEEw";icon_url = "http://cyhost.x10.mx/Gallery/80cf2ec6a5.png";};fields = {{name = "8ball says";value = BallTable[math.random(1,#BallTable)];inline = false;};};color = Discordia.Color.fromRGB(139,0,0).value;timestamp = os.date("!%Y-%m-%dT%H:%M:%S");footer = {text = "Made by Cy#5148"};}}
- end
- end
- Cmds.avatar = function(Arguments,Member,Message)
- if Arguments[1] then
- for user in Message.mentionedUsers:iter() do
- Message:reply("<@"..user.id..">'s Avatar is "..user.avatarURL)
- end
- else
- Message:reply("Your Avatar is "..Member.avatarURL)
- end
- end
- Cmds.shelp = function(Arguments,Member,Message)
- Message:reply{
- embed = {
- author = {
- name = "CyBot Client";
- url = "https://pastebin.com/3NABhEEw";
- icon_url = "http://cyhost.x10.mx/Gallery/80cf2ec6a5.png";
- };
- fields = {
- {name = "Sstop";value = "Stops the bot.";inline = false;};
- {name = "SLogMessages";value = "[On/Off], Prints Messages that have been sent in any guilds/chats";inline = false;};
- {name = "Afk";value = "(just say afk to turn it on) it auto-turns off when you're back";inline = false;};
- {name = "SBan";value = "sban @user [Optional Reason]";inline = false;};
- {name = "SKick";value = "skick @user [Optional Reason]";inline = false;};
- {name = "SUnban";value = "sunban UserId";inline = false;};
- {name = "8ball";value = "8ball [Question]";inline = false;};
- {name = "HowGay";value = "Howgay [Optional @user], Tells how gay you or someone else is.";inline = false;};
- {name = "Ping";value = "returns the amount of milliseconds it took for the bot to respond.";inline = false;};
- {name = "Avatar";value = "Gives you your avatar URL or [Optional @user] - gives you their Avatar URL";inline = false};
- {name = "ServerInfo";value = "Shows you info about the server.";inline = false;};
- {name = "ServerIcon";value = "Returns the Server Icon URL";inline = false;};
- {name = "Enlarge";value = "Enlarges an emoji (put it after the command)";inline = false;};
- };
- color = Discordia.Color.fromRGB(139,0,0).value;
- timestamp = os.date('!%Y-%m-%dT%H:%M:%S');
- footer = {text = "Made by Cy#5148"};
- };
- };
- end
- Cmds.howgay = function(Arguments,Member,Message)
- if Arguments[1] then
- for user in Message.mentionedUsers:iter() do
- Message:reply("<@"..user.id.."> is "..math.random(0,100).."% homosexual.")
- end
- else
- Message:reply("You are "..math.random(0,100).."% homosexual.")
- end
- end
- Cmds.ping = function(Arguments,Member,Message)
- local Tick = os.clock()
- Message:reply{
- embed = {
- author = {
- name = "CyBot Client";
- url = "https://pastebin.com/3NABhEEw";
- icon_url = "http://cyhost.x10.mx/Gallery/80cf2ec6a5.png";
- };
- fields = {
- {name = "Pong!";value = "It took "..tostring(os.clock() - Tick):sub(1,1).."ms to return this message.";inline = false;};
- };
- color = Discordia.Color.fromRGB(139,0,0).value;
- timestamp = os.date("!%Y-%m-%dT%H:%M:%S");
- footer = {text = "Made by Cy#5148"};
- };
- };
- end
- Client:run(Token)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement