Advertisement
NovaYoshi

bot sample stuff

Apr 24th, 2016
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. AddonInfo <- {
  2. "Name":"bot command package"
  3. "Summary":"bot commands"
  4. "Version":"0.01"
  5. "Author":"NovaSquirrel"
  6. };
  7.  
  8. function BotCommand(Type, OldParams, Context) {
  9. local Params = api.DecodeJSON(OldParams);
  10. local Nick = Params.Nick;
  11. local Arg = Params.Arg;
  12. local ArgSplit = api.TextParamSplit(Arg);
  13. local Command = Params.Cmd;
  14. local ReplyWith = Params.Say;
  15. local Temp;
  16.  
  17. function Say(Text) {
  18. api.Command(ReplyWith, Text, Context);
  19. }
  20.  
  21. switch(Command) {
  22. case "echo":
  23. Say(Arg);
  24. return EventReturn.DELETE;
  25. case "allcaps":
  26. Say(Arg.toupper());
  27. return EventReturn.DELETE;
  28. case "nocaps":
  29. Say(Arg.tolower());
  30. return EventReturn.DELETE;
  31. case "eval":
  32. if(Nick == "NovaSquirrel")
  33. compilestring(Arg)();
  34. else
  35. Say("no");;
  36. return EventReturn.DELETE;
  37. }
  38.  
  39. return EventReturn.NORMAL;
  40. }
  41.  
  42. api.AddEventHook("bot command", BotCommand, Priority.NORMAL, 0, 0, 0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement