質問

i just started using this cinch gem and using this framework to develop a bot.

facing an issue in this .I Wanted to bot send a message to a channel when anybody joins channel

Could anybody help me on this.

Code :

listen_to :join, method: :on_join
    def on_join(m)
      post_message(options(m,
          opcode: 'join',
          nick:   m.user.nick,
          line:   "#{m.user.nick} use this link to get more info"))

could you please check and let me know is anything missing on this.

正しい解決策はありません

他のヒント

I'm not sure what your post_message command is, but if it's something you found in Cinch, don't use it. Instead, use the built-in commands to respond to messages

 def on_join(m)
   # Don't greet the bot.
   unless m.user == @bot
   # Reply to the user who joined, the true prepends the line with the user's name
   m.reply "Use this link to get more info - http://whatever", true
 end

And then:

 15:30 -!- Irssi: #bottest: Total of 2 nicks [0 ops, 0 halfops, 0 voices, 2 normal]
 15:30 -!- Channel #bottest created Mon Feb 24 15:30:17 2014
 15:30 < bot> user: Use this link to get more info - http://whatever
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top