Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. module Discord
  2. module Commands
  3. extend Discordrb::Commands::CommandContainer
  4.  
  5. def self.handle_errors(e)
  6. if e.is_a?(Discordrb::Errors::MessageTooLong)
  7. "Message too long"
  8. else
  9. str = "#{Format.inline(e.message}\n"
  10. str += Format.code(e.backtrace.grep(/#{Rails.root.to_s}/).map { |s| s.gsub(Rails.root.to_s, "") }.join("\n"))
  11. str
  12. end
  13. end
  14.  
  15. old_command = method(:command)
  16.  
  17. def self.command(*args, &block)
  18. old_command(*args, &block)
  19. rescue => e
  20. handle_errors(e)
  21. rescue SyntaxError => e
  22. handle_errors(e)
  23. end
  24. end
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement