SendGroupTextMessage is not usable
akasandra opened this issue · 3 comments
You can't send group text message with current version because this code will never satisfy ok == true
:
case o3.GroupTextMessage:
fmt.Printf("GroupTextMessage: ~%s [%s] for Group [%x] created by [%s]\n", msg.PubNick(), msg.Sender(), msg.GroupID(), msg.GroupCreator())
fmt.Printf("GroupTextMessage: Text: %s\n", msg.Text())
group, ok := bot.sc.ID.Groups[msg.GroupCreator()][msg.GroupID()]
if ok {
time.Sleep(500 * time.Millisecond)
// respond with a quote of what was send to us. Multiline quote possible.
qoute := fmt.Sprintf("> %s: %s\n%s", msg.Sender(), strings.Replace(msg.Text(), "\n", "\n> ", -1), "Exactly in group!")
bot.sc.SendGroupTextMessage(group, qoute, bot.sendMsgChan)
} else {
fmt.Printf("ERROR sending to group [%x] by [%s].\n", msg.GroupID(), msg.GroupCreator())
}
The prototype of this code comes from https://github.com/V-inz/o3demo/blob/testing/main.go#L263 (does not work now)
Searching shows there was also another approach used to find group for this https://github.com/r3ek0/cr3ma/blob/master/main.go (does not work now)
Constructing Group object with o3.Group{GroupID: msg.GroupID(),CreatorID: msg.GroupCreatorID()}
does not work - no error is returned, but the message not is not sent/delivered
Was there ever support for send message to group?
Why if i search "Groups" in the source i can only find three lines of code, a map which is never initialized but used in demo code?
Sorry, I’m not sure about the state of the groups feature set. You might have stumbled into something unfinished.
I didn’t make it but will let them know about this issue. Might take them a while to get back to you since they are working on other stuff currently and this is unpaid open source after all.