Advertisement
NovaYoshi

botcommands.nut

Apr 7th, 2017
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. AddonInfo <- {
  2. "Name":"botcmd"
  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 ReplyWithArg = "";
  16. local Who = Nick;
  17. if("SayArg" in Params)
  18. ReplyWithArg = Params.SayArg;
  19. local Temp;
  20.  
  21. function Say(Text) {
  22. api.Command(ReplyWith, ReplyWithArg+Text, Context);
  23. }
  24.  
  25. switch(Command) {
  26. case "help":
  27. Say("http://t.novasquirrel.com/sparklesbot.html");
  28. return EventReturn.DELETE;
  29. case "me":
  30. Temp = Params.Nick;
  31. if("FullName" in Params)
  32. Temp = Params.FullName;
  33. Say("\x1d* "+Temp+" "+Arg+" *");
  34. return EventReturn.DELETE;
  35. case "furget":
  36. if(Arg.len())
  37. Who = split(Arg, " ")[0];
  38. else
  39. Who = Nick;
  40. Temp = api.LoadTextFile("furprofile/"+Who.tolower());
  41. if(Temp)
  42. Say(Who+" is: "+Temp);
  43. else
  44. Say("Person not in database");
  45. return EventReturn.DELETE;
  46. case "furset":
  47. api.SaveTextFile("furprofile/"+Nick.tolower(), Arg);
  48. Say("Saved");
  49. return EventReturn.DELETE;
  50. case "strlen":
  51. Say("String length is "+Arg.len());
  52. return EventReturn.DELETE;
  53. case "test":
  54. Say("test test test "+rand());
  55. return EventReturn.DELETE;
  56. case "echo":
  57. Say(Arg);
  58. return EventReturn.DELETE;
  59. case "nick":
  60. Say(Nick);
  61. return EventReturn.DELETE;
  62. case "params":
  63. Say(OldParams);
  64. return EventReturn.DELETE;
  65. case "toupper":
  66. Say(Arg.toupper());
  67. return EventReturn.DELETE;
  68. case "tolower":
  69. Say(Arg.tolower());
  70. return EventReturn.DELETE;
  71. case "urlencode":
  72. Say(api.URLEncode(Arg));
  73. return EventReturn.DELETE;
  74. }
  75.  
  76. return EventReturn.NORMAL;
  77. }
  78.  
  79. api.AddEventHook("bot command", BotCommand, Priority.NORMAL, 0, 0, 0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement