Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Discord
- module Commands
- extend Discordrb::Commands::CommandContainer
- def self.handle_errors(e)
- if e.is_a?(Discordrb::Errors::MessageTooLong)
- "Message too long"
- else
- str = "#{Format.inline(e.message}\n"
- str += Format.code(e.backtrace.grep(/#{Rails.root.to_s}/).map { |s| s.gsub(Rails.root.to_s, "") }.join("\n"))
- str
- end
- end
- old_command = method(:command)
- def self.command(*args, &block)
- old_command(*args, &block)
- rescue => e
- handle_errors(e)
- rescue SyntaxError => e
- handle_errors(e)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement