Sha256: 2719065c4e1cfbb4d45dc52bc82236fb28f4878c0ca5d83f45a402f449dc3e41

Contents?: true

Size: 1.52 KB

Versions: 20

Compression:

Stored size: 1.52 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:    <https://github.com/MarioRuiz/slack-smart-bot#extending-rules-to-other-channels|more info>
  # helpadmin: command_id: :stop_using_rules_on
  # helpadmin:

  def stop_using_rules_on(dest, user, from, channel, typem)
    save_stats(__method__)
    unless typem == :on_extended
      if !is_admin?
        respond "Only admins can extend or stop using the rules. Admins on this channel: #{config.admins}", dest
      else
        get_bots_created()
        channel = @channels_name[channel] if @channels_name.key?(channel)
        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 #{config.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

20 entries across 20 versions & 1 rubygems

Version Path
slack-smart-bot-1.15.25 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb
slack-smart-bot-1.15.1 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb
slack-smart-bot-1.15.0 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb
slack-smart-bot-1.14.2 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb
slack-smart-bot-1.14.1 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb
slack-smart-bot-1.14.0 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb
slack-smart-bot-1.13.2 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb
slack-smart-bot-1.13.1 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb
slack-smart-bot-1.13.0 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb
slack-smart-bot-1.12.9 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb
slack-smart-bot-1.12.8 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb
slack-smart-bot-1.12.7 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb
slack-smart-bot-1.12.6 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb
slack-smart-bot-1.12.5 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb
slack-smart-bot-1.12.4 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb
slack-smart-bot-1.12.3 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb
slack-smart-bot-1.12.2 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb
slack-smart-bot-1.12.1 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb
slack-smart-bot-1.12.0 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb
slack-smart-bot-1.11.0 lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb