Advertisement
notcyrusrock1

Self Bot [Easy to edit]

May 23rd, 2019
563
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.88 KB | None | 0 0
  1. --[[Dependencies:
  2. https://luvit.io/install.html
  3. https://github.com/SinisterRectus/Discordia
  4. If you need help:
  5. Cy#5148
  6. ]]
  7. local Discordia = require('discordia')
  8. local Afk = false
  9. local Client = Discordia.Client{
  10.     cacheAllMembers = true;
  11.     syncGuilds = true;
  12. }
  13. local Enums = Discordia.enums
  14. local LogMessages = false
  15. local Cmds = {}
  16. Discordia.extensions()
  17. local BallTable = {"[ 8ball ] says Yes.","[ 8ball ] says No.","[ 8ball ] says Maybe.","[ 8ball ] says I can't answer right now."}
  18. local Token = "" -- your token (for the SelfBot to actually function)
  19.  
  20. Client:on('ready',function()
  21.     print'Say shelp for help!'
  22.     Client:setGame("CyBot Client Is Running.")
  23. end)
  24.  
  25. local function RunCmd(Msg,Member)
  26. local CommandName
  27. local NewCommandName
  28. local Arguments = {}
  29. local Content = Msg.content:lower()
  30. local NewMsg = string.match(Content,"")
  31.     if NewMsg then
  32.         Content = string.gsub(Content,""..NewMsg,"",1)
  33.         for Arguments2 in string.gmatch(Content,"[^%s]+") do
  34.             table.insert(Arguments,Arguments2)
  35.         end
  36.         CommandName = Arguments[1]
  37.         table.remove(Arguments,1)
  38.         NewCommandName = Cmds[CommandName]
  39.         if NewCommandName then
  40.             NewCommandName(Arguments,Member,Msg)
  41.         end
  42.     end
  43. end
  44.  
  45.  
  46. Client:on('messageCreate',function(Message)
  47.     if LogMessages and Message.author ~= Client.user then
  48.         print("Message Author: "..Message.author.tag.."\nMessage Content: "..Message.content.."\nMessage Id: "..Message.id)
  49.     end
  50.     if Message.author == Client.user then
  51.         RunCmd(Message,Message.author)
  52.     end
  53.     if Message.author == Client.user and Afk and not string.find(Message.content:lower(),'afk') then
  54.         Afk = false
  55.         Client:setGame("CyBot Client Is Running.")
  56.     end
  57. end)
  58.  
  59.  
  60. Cmds.sstop = function(Arguments,Member,Message)
  61.     Client:setGame(nil)
  62.     Client:stop()
  63. end
  64.  
  65. Cmds.slogmessages = function(Arguments,Member,Message)
  66.     if Arguments[1] then
  67.         if tostring(string.lower(Arguments[1])) == "on" then
  68.             LogMessages = true
  69.         elseif tostring(string.lower(Arguments[1])) == "off" then
  70.             LogMessages = false
  71.         end
  72.     end
  73. end
  74.  
  75. Cmds.afk = function(Arguments,Member,Message)
  76.     Client:setGame(Member.name.." is Afk.")
  77.     Afk = true
  78. end
  79.  
  80. Cmds.serverinfo = function(Arguments,Member,Message)
  81. local VoiceChannels
  82. local TextChannels
  83. local Categories
  84. local Emojis
  85. local RoleAmount
  86. local BotAmount
  87. local BotTable = {}
  88. local Normies = {}
  89. local Humans
  90. local CreatedAt = Message.guild.createdAt
  91. local Date = os.date("*t", CreatedAt)
  92. local Online
  93. for i,v in pairs(Message.guild.members) do
  94.     if v.bot then
  95.         table.insert(BotTable,v)
  96.     else
  97.         table.insert(Normies,v)
  98.     end
  99. end
  100. for i = 1,#Message.guild.emojis do
  101.     Emojis = i
  102. end
  103. for i = 1,#Message.guild.voiceChannels do
  104.     VoiceChannels = i
  105. end
  106. for i = 1,#Message.guild.categories do
  107.     Categories = i
  108. end
  109. for i = 1,#Message.guild.textChannels do
  110.     TextChannels = i
  111. end
  112. for i = 1,#Message.guild.roles do
  113.     RoleAmount = i
  114. end
  115. for i = 1,#BotTable do
  116.     BotAmount = i
  117. end
  118. for i = 1,#Normies do
  119.     Normies = i
  120. end
  121.     Message:reply{
  122.         embed = {
  123.         author = {name = Message.guild.name;url = "https://pastebin.com/3NABhEEw";icon_url = Message.guild.iconURL or "http://cyhost.x10.mx/Gallery/80cf2ec6a5.png";};
  124.         fields = {
  125.                 {name = "Owner";value = Message.guild.owner.tag;inline = true;};
  126.                 {name = "Region";value = Message.guild.region;inline = true;};
  127.                 {name = "Channel Categories";value = Categories;inline = true;};
  128.                 {name = "Text Channels";value = TextChannels;inline = true;};
  129.                 {name = "Voice Channels";value = VoiceChannels;inline = true;};
  130.                 {name = "Members";value = Message.guild.totalMemberCount;inline = true;};
  131.                 {name = "People";value = Normies or 0;inline = true;};
  132.                 {name = "Bots";value = BotAmount or 0;inline = true;};
  133.                 {name = "Created At";value = Date.year.."-".."0"..Date.month.."-"..Date.day;inline = true;};
  134.                 {name = "Roles";value = RoleAmount;inline = true;};
  135.                 {name = "Emojis";value = Emojis or 0;inline = true;};
  136.                 {name = "Joined At";value = Message.member.joinedAt:sub(1,10);inline = true;};
  137.             };
  138.             color = Discordia.Color.fromRGB(139,0,0).value;
  139.             footer = {text = "Made by Cy#5148 | Server Id "..Message.guild.id};
  140.         };
  141.     }
  142. end
  143.  
  144. Cmds.servericon = function(Arguments,Member,Message)
  145.     Message:reply("Server icon: "..Message.guild.iconURL)
  146. end
  147.  
  148. Cmds.enlarge = function(Arguments,Member,Message)
  149.     if Arguments[1] then
  150.         if not tostring(Arguments[1]).animated then
  151.             Message:reply("https://cdn.discordapp.com/emojis/"..tostring(Arguments[1]:match"%d+")..".png")
  152.         else
  153.             Message:reply("https://cdn.discordapp.com/emojis/"..tostring(Arguments[1]:match"%d+")..".gif")
  154.         end
  155.     end
  156. end
  157.  
  158. Cmds.sban = function(Arguments,Member,Message)
  159.     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
  160.         if Arguments[2] then
  161.             for user in Message.mentionedUsers:iter() do
  162.                 local Ban = table.concat(Arguments, " ")
  163.                 user:send("You were banned from: "..Message.guild.name..". For: "..Ban:sub(23))
  164.                 Message.guild:banUser(user,Ban:sub(23))
  165.             end
  166.         elseif not Arguments[2] then
  167.             for user in Message.mentionedUsers:iter() do
  168.                 user:send("You were banned from: "..Message.guild.name..". For: Unspecified Reason.")
  169.                 Message.guild:banUser(user,"Unspecified Reason.")
  170.             end
  171.         end
  172.     end
  173. end
  174.    
  175. Cmds.skick = function(Arguments,Member,Message)
  176.     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
  177.         if Arguments[2] then
  178.             for user in Message.mentionedUsers:iter() do
  179.                 local Kick = table.concat(Arguments, " ")
  180.                 user:send("You were kicked from: "..Message.guild.name..". For: "..Kick:sub(23))
  181.                 Message.guild:kickUser(user,Kick:sub(23))
  182.             end
  183.         elseif not Arguments[2] then
  184.             for user in Message.mentionedUsers:iter() do
  185.                 user:send("You were kicked from: "..Message.guild.name..". For: Unspecified Reason.")
  186.                 Message.guild:kickUser(user,"Unspecified Reason.")
  187.             end
  188.         end
  189.     end
  190. end
  191.  
  192. Cmds.sunban = function(Arguments,Member,Message)
  193.     if Arguments[1] and Message.guild then
  194.         if Message.member:hasPermission(Message.channel,Enums.permission.banMembers) or Message.member:hasPermission(Message.channel,Enums.permission.administrator)  then
  195.             local Unban = table.concat(Arguments, " ")
  196.             Message:reply("<@"..Unban.."> has been unbanned.")
  197.             Message.member.guild:unbanUser(Unban)
  198.         end
  199.     end
  200. end
  201.  
  202. Cmds.everyoneping = function(Arguments,Member,Message)
  203.     for a in Message.guild.members.toArray() do
  204.     print(a)
  205.         Message:reply("<@"..a..">")
  206.     end
  207. end
  208.  
  209. Cmds["8ball"] = function(Arguments,Member,Message)
  210.     if Arguments[1] then
  211.         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"};}}
  212.     end
  213. end
  214.  
  215. Cmds.avatar = function(Arguments,Member,Message)
  216.     if Arguments[1] then    
  217.         for user in Message.mentionedUsers:iter() do
  218.             Message:reply("<@"..user.id..">'s Avatar is "..user.avatarURL)
  219.         end
  220.     else
  221.         Message:reply("Your Avatar is "..Member.avatarURL)
  222.     end
  223. end
  224.    
  225. Cmds.shelp = function(Arguments,Member,Message)
  226.         Message:reply{
  227.             embed = {
  228.                 author = {
  229.                     name = "CyBot Client";
  230.                     url = "https://pastebin.com/3NABhEEw";
  231.                     icon_url = "http://cyhost.x10.mx/Gallery/80cf2ec6a5.png";
  232.                 };
  233.                 fields = {
  234.                     {name = "Sstop";value = "Stops the bot.";inline = false;};
  235.                     {name = "SLogMessages";value = "[On/Off], Prints Messages that have been sent in any guilds/chats";inline = false;};
  236.                     {name = "Afk";value = "(just say afk to turn it on) it auto-turns off when you're back";inline = false;};
  237.                     {name = "SBan";value = "sban @user [Optional Reason]";inline = false;};
  238.                     {name = "SKick";value = "skick @user [Optional Reason]";inline = false;};
  239.                     {name = "SUnban";value = "sunban UserId";inline = false;};
  240.                     {name = "8ball";value = "8ball [Question]";inline = false;};
  241.                     {name = "HowGay";value = "Howgay [Optional @user], Tells how gay you or someone else is.";inline = false;};
  242.                     {name = "Ping";value = "returns the amount of milliseconds it took for the bot to respond.";inline = false;};
  243.                     {name = "Avatar";value = "Gives you your avatar URL or [Optional @user] - gives you their Avatar URL";inline = false};
  244.                     {name = "ServerInfo";value = "Shows you info about the server.";inline = false;};
  245.                     {name = "ServerIcon";value = "Returns the Server Icon URL";inline = false;};
  246.                     {name = "Enlarge";value = "Enlarges an emoji (put it after the command)";inline = false;};
  247.                 };
  248.                     color = Discordia.Color.fromRGB(139,0,0).value;
  249.                     timestamp = os.date('!%Y-%m-%dT%H:%M:%S');
  250.                     footer = {text = "Made by Cy#5148"};
  251.                 };
  252.             };
  253. end
  254.    
  255. Cmds.howgay = function(Arguments,Member,Message)
  256.     if Arguments[1] then
  257.         for user in Message.mentionedUsers:iter() do
  258.             Message:reply("<@"..user.id.."> is "..math.random(0,100).."% homosexual.")
  259.         end
  260.     else
  261.         Message:reply("You are "..math.random(0,100).."% homosexual.") 
  262.     end
  263. end
  264.  
  265. Cmds.ping = function(Arguments,Member,Message)
  266.     local Tick = os.clock()
  267.     Message:reply{
  268.         embed = {
  269.             author = {
  270.                 name = "CyBot Client";
  271.                 url = "https://pastebin.com/3NABhEEw";
  272.                 icon_url = "http://cyhost.x10.mx/Gallery/80cf2ec6a5.png";
  273.             };
  274.             fields = {
  275.                 {name = "Pong!";value = "It took "..tostring(os.clock() - Tick):sub(1,1).."ms to return this message.";inline = false;};
  276.             };
  277.             color = Discordia.Color.fromRGB(139,0,0).value;
  278.             timestamp = os.date("!%Y-%m-%dT%H:%M:%S");
  279.             footer = {text = "Made by Cy#5148"};
  280.         };
  281.     };
  282. end
  283.  
  284. Client:run(Token)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement