Advertisement
Guest User

test

a guest
Mar 29th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.77 KB | None | 0 0
  1. local discordia = require('discordia')
  2. local client = discordia.Client()
  3. local http = require('coro-http')
  4. local json = require("json")
  5. local base64 = require('base64')
  6. local pp = require('pretty-print')
  7. local prefix = ';'
  8. local command = prefix..'eval'
  9. local sandbox = setmetatable({
  10.     os = {}
  11. }, {__index = _G})
  12.  
  13.  
  14.  
  15. client:on('ready', function()
  16.     print('Logged in as '.. client.user.username)
  17. end)
  18.  
  19. client:on('messageCreate', function(msg)
  20.     if msg.author.id ~= client.user.id then return end
  21.     local user = msg.author.username
  22.     local guild = msg.guild
  23.  
  24.         local function exec(arg, msg)
  25.  
  26.             if not arg then return end
  27.             if msg.author ~= msg.client.owner then return end
  28.  
  29.             arg = arg:gsub('```\n?', '')
  30.  
  31.             local lines = {}
  32.  
  33.             sandbox.message = msg
  34.  
  35.             sandbox.print = function(...)
  36.                 table.insert(lines, printLine(...))
  37.             end
  38.  
  39.             sandbox.p = function(...)
  40.                 table.insert(lines, prettyLine(...))
  41.             end
  42.  
  43.             local fn, syntaxError = load(arg, 'DiscordBot', 't', sandbox)
  44.             if not fn then return msg:reply(code(syntaxError)) end
  45.  
  46.             local success, runtimeError = pcall(fn)
  47.             if not success then return msg:reply(code(runtimeError)) end
  48.  
  49.             lines = table.concat(lines, '\n')
  50.  
  51.             if #lines > 1990 then
  52.                 lines = lines:sub(1, 1990)
  53.             end
  54.  
  55.             return msg:reply(code(lines))
  56.            
  57.             if string.sub(msg.content, 1, string.len(command)) == command then
  58.         local arg = string.sub(command, 7);
  59.         loadstring(arg)()
  60.         exec()
  61.    
  62.         end
  63.     end
  64.    
  65.        
  66. end)
  67.  
  68. client:run("MjAyOTU0MjA3MTczNjcyOTYx.C5DukA.9h__QCIO_ijcSVWv0XHyZ41rAEA")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement