Advertisement
Terrah

template

May 3rd, 2017
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.19 KB | None | 0 0
  1. --[[
  2.  
  3. sqlite GetDB()
  4. void SetStartupScript(pastebintag)
  5. void SetEvent(key, func) : MSG, TICK
  6.  
  7. ]]
  8.  
  9. local UserType = {};
  10. UserType[0] = "Viewer";
  11. UserType[1] = "Moderator";
  12. UserType[2] = "GlobalModerator";
  13. UserType[3] = "Broadcaster";
  14. UserType[4] = "Admin";
  15. UserType[5] = "Staff";
  16.  
  17. local commands = {};
  18. local msgdata={};
  19.  
  20. function GetMessageData()
  21.     return msgdata;
  22. end
  23.  
  24. commands["!kitsunebot"] = function(rest,data)
  25.  
  26.     if data.DisplayName:lower() ~= "terrahkitsune" then
  27.         print("HeyGuys "..data.DisplayName);
  28.         return;
  29.     end
  30.  
  31.     local func,error = load(rest);
  32.    
  33.     if type(func)=="function" then
  34.         local ok, error = pcall(func);
  35.         if not ok then
  36.             Send(tostring(error));
  37.         end
  38.     elseif not func then
  39.         Send(error);
  40.     end
  41. end
  42.  
  43. local function CMD(data)
  44.    
  45.     local cmd, cmddata = data.Message:match("^(.-) (.-)$");
  46.     if not cmd then
  47.         cmd = data.Message;
  48.     end
  49.  
  50.     local exe = commands[cmd:lower()];
  51.  
  52.     if exe then
  53.         exe(cmddata,data);
  54.         return true;
  55.     else
  56.         return false;
  57.     end
  58. end
  59.  
  60. SetEvent("MSG", function(data)
  61.     msgdata = data;
  62.     CMD(data);
  63.     print(data.DisplayName .." ("..UserType[data.UserType].."): "..data.Message);
  64. end);
  65.  
  66. SetEvent("TICK", function()
  67.    
  68. end);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement