miq_bot icon indicating copy to clipboard operation
miq_bot copied to clipboard

Gitter interaction

Open Fryguy opened this issue 9 years ago • 4 comments

I did a short spike on this locally trying to use Gitter's IRC bridge and the cinch gem and it was really simple to get started. However, I ran into this issue (https://github.com/gitterHQ/irc-bridge/pull/54), and until that's in, I couldn't get the bot to actually reply. So, this is a placeholder for myself once I get back to it.

Launching it is as simple as putting it in the Procfile.

#!/usr/bin/env ruby

require 'cinch'

bot = Cinch::Bot.new do
  configure do |c|
    c.server = "irc.gitter.im"
    c.ssl.use = true
    c.nick = "miq-bot"
    c.password = '' #REDACTED
    c.channels = [
      "#manageiq/manageiq",
      "#manageiq/miq_bot"
    ]
  end

  on :message, "hello" do |m|
    m.reply "Hello, #{m.user.nick}"
  end
end

bot.start

Once we have IRC interaction, some possible follow up RFEs would be

  • Allowing some of the commands we use in the GithubNotificationMonitor to be reused in Gitter (requires separation of GithubNotificationMonitor's reaction/reply half)
  • New commands for chat only
    • @miq-bot status could be queue statistics or something
    • @miq-bot gif <keywords> and it will search @chrisarcand's gif list ;) 😜
  • Watching #manageiq on IRC, then pinging the Gitter channel that there is activity over there
  • Watching #manageiq on IRC, then pinging IRC that chat no longer occurs there and instructions to go to Gitter if they choose

Fryguy avatar May 26 '16 22:05 Fryguy

@miq-bot gif and it will search @chrisarcand's gif list ;)

Ho boy. Fair warning ⚠️ NSFW gifs are not flagged. 😄

I've been meaning to make an elixir project out of making my collection do such things.

chrisarcand avatar May 27 '16 01:05 chrisarcand

gitterHQ/irc-bridge#54 is fixed so now this can move forward

Fryguy avatar Jun 10 '16 21:06 Fryguy

@bdunne I realize I never shared my working prototype, so:

#!/usr/bin/env ruby

require 'cinch'

PREFIX = /^@miq-bot\s+/

HELP_MESSAGE = <<-EOF.tr("\n", "\r").chomp.freeze
My commands are:

- `hello` - Reply with hello
- `help` - Get this help message
EOF

bot = Cinch::Bot.new do
  configure do |c|
    c.server   = "irc.gitter.im"
    c.ssl.use  = true
    c.nick     = "miq-bot"
    c.user     = "miq-bot"
    c.realname = "ManageIQ Bot"
    c.password = "<token>"
    c.channels = [
      # "#manageiq/manageiq",
      # "#manageiq/miq_bot",
      "#Fryguy/test"
    ]
  end

  on :message, /#{PREFIX}hello$/i do |m|
    m.reply "#{m.message.split(PREFIX, 2).last}, @#{m.user.nick}"
  end

  on :message, /#{PREFIX}help$/i do |m|
    m.user.send HELP_MESSAGE
  end

  on :private, "help" do |m|
    m.reply HELP_MESSAGE
  end
end

bot.start

Fryguy avatar Feb 02 '17 15:02 Fryguy

This issue has been automatically marked as stale because it has not been updated for at least 3 months.

If you can still reproduce this issue on the current release or on master, please reply with all of the information you have about it in order to keep the issue open.

Thank you for all your contributions! More information about the ManageIQ triage process can be found in the traige process documentation.

miq-bot avatar Jun 12 '20 00:06 miq-bot