def do_direct_message(dm, opts = {})
      return if dm.sender.screen_name == $bot[:config][:screen_name]
      return do_callbacks(:direct_message, dm, opts) unless dm.text.start_with? $bot[:config][:dm_command_prefix]
      dm_text = dm.text.sub($bot[:config][:dm_command_prefix], '').strip
      return if dm_text.empty?

      return unless /(?<command>[A-Za-z0-9]+)(?:\s*)(?<args>.*)/m =~ dm_text
      command = Regexp.last_match(:command).to_sym
      args = Regexp.last_match :args

      cmd = $bot[:commands][command]
      return say_status :dm, "#{dm.sender.screen_name} tried to issue non-existent command :#{command}, ignoring", :cyan if cmd.nil?
      return say_status :dm, "#{dm.sender.screen_name} tried to issue admin command :#{command}, ignoring", :cyan if cmd[:admin] and !dm.sender.admin?

      say_status :dm, "#{dm.sender.screen_name} issued command :#{command}", :cyan
      cmd[:block].call(args, dm.sender)
    end
def do_direct_message(dm, opts = {})
      return if dm.sender.screen_name == $bot[:config][:screen_name]
      return do_callbacks(:direct_message, dm, opts) unless dm.text.start_with? $bot[:config][:dm_command_prefix]
      dm_text = dm.text.sub($bot[:config][:dm_command_prefix], '').strip
      return if dm_text.empty?

      return unless /(?<command>[A-Za-z0-9]+)(?:\s*)(?<args>.*)/m =~ dm_text
      command = Regexp.last_match(:command).to_sym
      args = Regexp.last_match :args

      cmd = $bot[:commands][command]
      return say_status :dm, "#{dm.sender.screen_name} tried to issue non-existent command :#{command}, ignoring", :cyan if cmd.nil?
      return say_status :dm, "#{dm.sender.screen_name} tried to issue admin command :#{command}, ignoring", :cyan if cmd[:admin] and !dm.sender.admin?

      say_status :dm, "#{dm.sender.screen_name} issued command :#{command}", :cyan
      cmd[:block].call(args, dm.sender)
    end
Processes a direct message.
 @param dm [Twitter::DirectMessage] received direct message