Template creation program when using the reminder function in slack

I became the host of the meeting that day!

I think you'll have the opportunity to host somehow a group of slacks that day and post the zoom URL for the meeting hourly.

problem

・ Forget to post the ZOOM URL at that time ・ I have to post! And concentration becomes zero

Solution

-Use the slack reminder function. If you reserve all the things you want to post on that day in the morning, they will be posted as you set. Please refer to the following page for details. https://lab.sonicmoov.com/tool/slack-reminder/

Problems using the slack reminder feature

To use the reminder function, you need to set one reminder for each post. In other words, it is necessary to rewrite the sentences and time to be copied and written as gonyogonyo. (Please let me know if there is a function that you don't have to do.)

Solution

I created the following program.

riminder.rb


#Setting
outputs = ["10:00","11:00","13:00","15:00","16:00","17:00","18:00","19:00"]#zoom url posting time
channel_name = "#〇〇"#Notification channel
notification = "@here"#Person to notify
notification_time = "3"#How many minutes in advance
word = ["Morning assembly","Lunch","Please come together"] #Words you want to post

class Riminder #A class that generates reminders
  def initialize(times,zoom,channel,notification,pre_time,word) #Instance variable? Define
    @times = times
    @zoom = zoom
    @channel = channel
    @notification = notification
    @pre_time = pre_time
    @word = word
  end

  def sentence #Create a sentence to actually output
    n = 0
    @times.each do |time| 
        if n == 0 #Array number of outputs? The words output by
          sentence = @word[n]
        elsif n == 1
          sentence = @word[n]
        else
          sentence = @word[2]
        end
      bot = "/remind #{@channel} ”\n#{sentence}#{time}\n#{@zoom}\n#{@notification}\n” #{@times3[n]}\n " #This sentence is output
      puts bot
      n += 1
    end
  end

  def timechanger #I want to be notified 3 minutes before, so I output the value 3 minutes before the output time
    @times3=[]
    @times.each do |time|
      a = time.split(":") #"10:00"of:Is deleted
      time1 = Time.local(2020,10,1,a[0],a[1],00) #Use the time class that comes standard with ruby for time
      time2 = time1 - (@pre_time.to_i * 60) #3 minutes ago(180 seconds)(Time you want to be notified)
      @times3 << "#{time2.hour}:#{time2.min}"#10:Change to a time notation like 10 and put it in the times3 array
    end
  end
end


puts "The output time is#{outputs}is"
puts "The channel to post is#{channel_name}is"
puts "Notification members#{notification}is"
puts "Notification time is the output#{notification_time}Minutes ago"
puts "Please enter the url of your zoom"
url = gets.chomp
riminder = Riminder.new(outputs,url,channel_name,notification,notification_time,word)
# riminder.bot
riminder.timechanger
riminder.sentence
puts "Post the generated reminders to Slack"




When I run this in the terminal, I get the zoom url, and when I enter it,

Post the generated reminders to Slack
amagatanobuhiko@amagatahikosMBP desktop % ruby riminder.rb
The output time is["10:00", "11:00", "13:00", "15:00", "16:00", "17:00", "18:00", "19:00"]is
The channel to post is#It is 〇〇
Notification members@Here is
Notification time is 3 minutes before output
Please enter the url of your zoom
zoom.com
/remind #〇〇 ”
Morning assembly 10:00
zoom.com
@here
” 9:57
 
/remind #〇〇 ”
Lunch 11:00
zoom.com
@here
” 10:57
 
/remind #〇〇 ”
Please come together 13:00
zoom.com
@here
” 12:57
 
/remind #〇〇 ”
Please come together 15:00
zoom.com
@here
” 14:57
 
/remind #〇〇 ”
Please come together 16:00
zoom.com
@here
” 15:57
 
/remind #〇〇 ”
Please come together 17:00
zoom.com
@here
” 16:57
 
/remind #〇〇 ”
Please come together 18:00
zoom.com
@here
” 17:57
 
/remind #〇〇 ”
Please come together 19:00
zoom.com
@here
” 18:57

You will get an output like this: Simply paste this into slack and send it block by block as shown below.

/remind #〇〇 ”
Please come together 19:00
zoom.com
@here
” 18:57

In the settings section above, you can set the channel you want to notify, how many minutes in advance you want to be notified, and so on. After making this, I learned that it seems that bots can be created in slack, but I'm still not sure. I will check it again.

that's all

Recommended Posts

Template creation program when using the reminder function in slack
Differences in code when using the length system in Java
Let's see the execution result when using prepared statements in JDBC
How to solve the unknown error when using slf4j in Java
Precautions when using checkboxes in Thymeleaf
User evaluation using the like function
Order of processing in the program
I summarized the points to note when using resources and resources in combination
Let's specify the version when using docker
Try using the Stream API in Java
Precautions when specifying the URL in render
Creating a sample program using the problem of a database specialist in DDD Improvement 2
[Note] Execute java program in the integrated development environment Eclipse-I tried using git
[Ruby on Rails] Solving the addiction when setting crontab using whenever in EC2
Creating a sample program using the problem of a database specialist in DDD Improvement 1
[When using MiniMagick] A memorandum because I stumbled in the CircleCI test environment.
Be careful with requests and responses when using the Serverless Framework in Java