Sha256: d6d3b74631cf4c10573b0c0ae7901ddee1e089d555a20c85d350f271818403e1

Contents?: true

Size: 964 Bytes

Versions: 3

Compression:

Stored size: 964 Bytes

Contents

class SlackSmartBot

    # helpadmin: ----------------------------------------------
    # helpadmin: `delete message URL`
    # helpadmin:    It will delete the SmartBot message supplied
    # helpadmin:    You can use this command only if you are a Master admin user and if you are in a private conversation with the bot
    # helpadmin: command_id: :delete_message
    # helpadmin:
    def delete_message(user, typem, url)
      save_stats(__method__)
      channel, ts = url.scan(/\/archives\/(\w+)\/(\w\d+)/)[0]
      if config.team_id_masters.include?("#{user.team_id}_#{user.name}") and typem==:on_dm and !channel.nil? #master admin user
        ts = "#{ts[0..-7]}.#{ts[-6..-1]}"
        succ = delete(channel, ts)
        if succ
          react :heavy_check_mark
        else
          react :x
        end
      else
        respond "Only master admin users on a private conversation with the SmartBot can delete SmartBot messages"
      end
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slack-smart-bot-1.15.25 lib/slack/smart-bot/commands/on_bot/admin_master/delete_message.rb
slack-smart-bot-1.15.1 lib/slack/smart-bot/commands/on_bot/admin_master/delete_message.rb
slack-smart-bot-1.15.0 lib/slack/smart-bot/commands/on_bot/admin_master/delete_message.rb