Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if direction == ">"
- if decoy["done"] and data
- if data.getAttr("t")
- if data.getAttr("t")[0..1] == "//"
- args = data.getAttr("t").strip.split(" ")
- cmd = args[0].delete("^[a-zA-Z0-9\/\?]")[2..-1]
- argu = args[1..-1].join(" ")
- xdata = deepCopy(data)
- data = false #Making your message completely silent.
- Dir.mkdir("filters/commands") unless File.directory?("filters/commands")
- cmd_c = [Dir["#{File.expand_path(File.dirname(__FILE__))}/filters/commands/#{cmd}.rb"][0],Dir["#{File.expand_path(File.dirname(__FILE__))}/filters/commands/#{cmd}-*.rb"][0],Dir["#{File.expand_path(File.dirname(__FILE__))}/filters/commands/*-#{cmd}-*.rb"][0],Dir["#{File.expand_path(File.dirname(__FILE__))}/filters/commands/*-#{cmd}.rb"][0]].reject{|c|c == nil}[0] rescue (cmd_c = false)
- if cmd_c
- begin
- eval(File.binread(cmd_c))
- rescue Exception
- decoy["<"].print(
- packet(
- {
- "m"=>{
- "t"=>"An error occured in "#{cmd}" command.",
- "u"=>"0"
- }
- }
- )
- )
- end
- elsif cmd == "" or cmd == "?"
- decoy["<"].print(
- packet(
- {
- "m"=>{
- "t"=>"To create commands, you must create a file or files named command_name.rb in the filters folder, replace command_name with the command name of your choosing, you can also do command-cmd-cmnd.rb which will trigger when "//command" or "//cmd" or "//cmnd" is typed.",
- "u"=>"0"
- }
- }
- )
- )
- else
- decoy["<"].print(
- packet(
- {
- "m"=>{
- "t"=>"The command "#{cmd}" does not exist.",
- "u"=>"0"
- }
- }
- )
- )
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment