diff --git a/commands.go b/commands.go index c3c4078..7192cd3 100644 --- a/commands.go +++ b/commands.go @@ -60,8 +60,14 @@ func (b *bot) handleFeedback(m chat1.MsgSummary) { } } -func (b *bot) sendWelcome(convid chat1.ConvIDStr) { - b.k.SendMessageByConvID(convid, "Hello there!! I'm the Jitsi meeting bot, made by @haukened\nI can start Jitsi meetings right here in this chat!\nI can be activated in 2 ways:\n 1. `@jitsibot`\n 2.`!jitsi`\nYou can provide feedback to my humans using:\n 1. `@jitsibot feedback `\n 2. `!jitsibot feedback `\nYou can also join @jitsi_meet to talk about features, enhancements, or talk to live humans! Everyone is welcome!\nI also accept donations to offset hosting costs, just send some XLM to my wallet if you feel like it by typing `+5XLM@jitsibot`\nIf you ever need to see this message again, ask me for help or say hello to me!") +/* +**** this function is a special case on parameters as it must be called from 2 handlers which +**** get their information from separate types. As a result we're only passing the conversation id. +**** because of this we can't wrap handleWelcome with permissions, not that you'd want to. + */ +// handleWelcome sends the welcome message to new conversations +func (b *bot) handleWelcome(id chat1.ConvIDStr) { + b.k.SendMessageByConvID(id, "Hello there!! I'm the Jitsi meeting bot, made by @haukened\nI can start Jitsi meetings right here in this chat!\nI can be activated in 2 ways:\n 1. `@jitsibot`\n 2.`!jitsi`\nYou can provide feedback to my humans using:\n 1. `@jitsibot feedback `\n 2. `!jitsibot feedback `\nYou can also join @jitsi_meet to talk about features, enhancements, or talk to live humans! Everyone is welcome!\nI also accept donations to offset hosting costs, just send some XLM to my wallet if you feel like it by typing `+5XLM@jitsibot`\nIf you ever need to see this message again, ask me for help or say hello to me!") } func (b *bot) setKValue(convid chat1.ConvIDStr, msgID chat1.MessageID, args []string) { diff --git a/handlers.go b/handlers.go index 65aba1f..e0d995b 100644 --- a/handlers.go +++ b/handlers.go @@ -68,7 +68,7 @@ func (b *bot) chatHandler(m chat1.MsgSummary) { case "hello": fallthrough case "help": - b.sendWelcome(m.ConvID) + b.handleWelcome(m.ConvID) default: return } @@ -90,7 +90,7 @@ func (b *bot) convHandler(m chat1.ConvSummary) { default: b.debug("New convID found %s, sending welcome message.", m.Id) } - b.sendWelcome(m.Id) + b.handleWelcome(m.Id) } // this handles wallet events, like when someone send you money in chat