Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AddonInfo <- {
- "Name":"botcmd"
- "Summary":"bot commands"
- "Version":"0.01"
- "Author":"NovaSquirrel"
- };
- function BotCommand(Type, OldParams, Context) {
- local Params = api.DecodeJSON(OldParams);
- local Nick = Params.Nick;
- local Arg = Params.Arg;
- local ArgSplit = api.TextParamSplit(Arg);
- local Command = Params.Cmd;
- local ReplyWith = Params.Say;
- local ReplyWithArg = "";
- local Who = Nick;
- if("SayArg" in Params)
- ReplyWithArg = Params.SayArg;
- local Temp;
- function Say(Text) {
- api.Command(ReplyWith, ReplyWithArg+Text, Context);
- }
- switch(Command) {
- case "help":
- Say("http://t.novasquirrel.com/sparklesbot.html");
- return EventReturn.DELETE;
- case "me":
- Temp = Params.Nick;
- if("FullName" in Params)
- Temp = Params.FullName;
- Say("\x1d* "+Temp+" "+Arg+" *");
- return EventReturn.DELETE;
- case "furget":
- if(Arg.len())
- Who = split(Arg, " ")[0];
- else
- Who = Nick;
- Temp = api.LoadTextFile("furprofile/"+Who.tolower());
- if(Temp)
- Say(Who+" is: "+Temp);
- else
- Say("Person not in database");
- return EventReturn.DELETE;
- case "furset":
- api.SaveTextFile("furprofile/"+Nick.tolower(), Arg);
- Say("Saved");
- return EventReturn.DELETE;
- case "strlen":
- Say("String length is "+Arg.len());
- return EventReturn.DELETE;
- case "test":
- Say("test test test "+rand());
- return EventReturn.DELETE;
- case "echo":
- Say(Arg);
- return EventReturn.DELETE;
- case "nick":
- Say(Nick);
- return EventReturn.DELETE;
- case "params":
- Say(OldParams);
- return EventReturn.DELETE;
- case "toupper":
- Say(Arg.toupper());
- return EventReturn.DELETE;
- case "tolower":
- Say(Arg.tolower());
- return EventReturn.DELETE;
- case "urlencode":
- Say(api.URLEncode(Arg));
- return EventReturn.DELETE;
- }
- return EventReturn.NORMAL;
- }
- api.AddEventHook("bot command", BotCommand, Priority.NORMAL, 0, 0, 0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement