Sha256: 12f0084546323984027ea8aaca7e21d354d1a776444604c122cda443429b2a66

Contents?: true

Size: 1.29 KB

Versions: 3

Compression:

Stored size: 1.29 KB

Contents

class SlackSmartBot

  # helpadmin: ----------------------------------------------
  # helpadmin: `stop using rules on CHANNEL_NAME`
  # helpadmin:    it will stop using the extended rules on the specified channel.
  # helpadmin:

  def stop_using_rules_on(dest, user, from, channel, typem)
    unless typem == :on_extended
      if !ADMIN_USERS.include?(from) #not admin
        respond "Only admins can extend or stop using the rules. Admins on this channel: #{ADMIN_USERS}", dest
      else
        get_bots_created()
        if @bots_created[@channel_id][:extended].include?(channel)
          @bots_created[@channel_id][:extended].delete(channel)
          update_bots_file()
          respond "<@#{user.id}> removed the access to the rules of #{CHANNEL} from #{channel}.", @master_bot_id
          if @channels_id[channel][0] == "G"
            respond "The rules won't be accessible from *#{channel}* from now on.", dest
          else
            respond "The rules won't be accessible from *<##{@channels_id[channel]}>* from now on.", dest
          end
          respond "<@#{user.id}> removed the access to the rules of <##{@channel_id}> from this channel.", @channels_id[channel]
        else
          respond "The rules were not accessible from *#{channel}*", dest
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slack-smart-bot-1.0.2 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb
slack-smart-bot-1.0.1 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb
slack-smart-bot-1.0.0 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb