Advertisement
Guest User

t

a guest
Mar 29th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.28 KB | None | 0 0
  1. client:on('messageCreate', function(msg)
  2.     if msg.author.id ~= client.user.id then return end
  3.     local user = msg.author.username
  4.     local guild = msg.guild
  5.  
  6.         local function exec(arg, msg)
  7.  
  8.             if not arg then return end
  9.             if msg.author ~= msg.client.owner then return end
  10.  
  11.             arg = arg:gsub('```\n?', '')
  12.  
  13.             local lines = {}
  14.  
  15.             sandbox.message = msg
  16.  
  17.             sandbox.print = function(...)
  18.                 table.insert(lines, printLine(...))
  19.             end
  20.  
  21.             sandbox.p = function(...)
  22.                 table.insert(lines, prettyLine(...))
  23.             end
  24.  
  25.             local fn, syntaxError = load(arg, 'DiscordBot', 't', sandbox)
  26.             if not fn then return msg:reply(code(syntaxError)) end
  27.  
  28.             local success, runtimeError = pcall(fn)
  29.             if not success then return msg:reply(code(runtimeError)) end
  30.  
  31.             lines = table.concat(lines, '\n')
  32.  
  33.             if #lines > 1990 then
  34.                 lines = lines:sub(1, 1990)
  35.             end
  36.  
  37.             return msg:reply(code(lines))
  38.        
  39.  
  40.         end
  41.     end
  42.    
  43.          if string.sub(msg.content, 1, string.len(command)) == command then
  44.         local arg = string.sub(command, 7);
  45.         loadstring(arg)()
  46.             exec()
  47. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement