SHARE
TWEET

Untitled

a guest Mar 21st, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top