Sha256: 3f5f3393749b7194ef7325266d09c5cc40e6c782839cff3acc8853b1241b6dfa
Contents?: true
Size: 1.63 KB
Versions: 16
Compression:
Stored size: 1.63 KB
Contents
class SlackSmartBot # helpmaster: ---------------------------------------------- # helpmaster: `publish announcements` # helpmaster: It will publish on all channels the announcements added by using 'add announcement' command. # helpmaster: It won't be published if less than 11 messages published on the channel since last time this command was called. # helpmaster: Only works if you are on Master channel and you are a master admin user # helpmaster: The messages stored on a DM won't be published. # helpmaster: This is very convenient to be called from a *Routine* for example every weekday at 09:00. # helpmaster: <https://github.com/MarioRuiz/slack-smart-bot#announcements|more info> # helpmaster: command_id: :publish_announcements # helpmaster: def publish_announcements(user) save_stats(__method__) if config.on_master_bot if config.masters.include?(user.name) #admin user channels = Dir.entries("#{config.path}/announcements/") channels.select! {|i| i[/\.csv$/]} channels.each do |channel| channel.gsub!('.csv','') unless channel[0]== 'D' or (@announcements_activity_after.key?(channel) and @announcements_activity_after[channel] <= 10) see_announcements(user, '', channel, false, true) @announcements_activity_after[channel] = 0 sleep 0.5 # to avoid reach ratelimit end end react :heavy_check_mark else respond 'Only master admins on master channel can use this command.' end else respond 'Only master admins on master channel can use this command.' end end end
Version data entries
16 entries across 16 versions & 1 rubygems