added conversation options
This commit is contained in:
22
commands.go
22
commands.go
@ -45,6 +45,16 @@ func (b *bot) handlePayment(m chat1.MsgSummary) {
|
|||||||
// handleMeeting starts a new jitsi meeting
|
// handleMeeting starts a new jitsi meeting
|
||||||
func (b *bot) handleMeeting(m chat1.MsgSummary) {
|
func (b *bot) handleMeeting(m chat1.MsgSummary) {
|
||||||
b.debug("command recieved in conversation %s", m.ConvID)
|
b.debug("command recieved in conversation %s", m.ConvID)
|
||||||
|
// check and see if this conversation has a custom URL
|
||||||
|
opts := ConvOptions{}
|
||||||
|
err := b.KVStoreGetStruct(m.ConvID, &opts)
|
||||||
|
if err != nil {
|
||||||
|
b.debug("unable to get conversation options")
|
||||||
|
eid := b.logError(err)
|
||||||
|
b.k.ReactByConvID(m.ConvID, m.Id, "Error ID %s", eid)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
b.debug("%+v", opts)
|
||||||
// currently we aren't sending dial-in information, so don't get it just generate the name
|
// currently we aren't sending dial-in information, so don't get it just generate the name
|
||||||
// use the simple method
|
// use the simple method
|
||||||
meeting, err := newJitsiMeetingSimple()
|
meeting, err := newJitsiMeetingSimple()
|
||||||
@ -54,6 +64,10 @@ func (b *bot) handleMeeting(m chat1.MsgSummary) {
|
|||||||
b.k.SendMessageByConvID(m.ConvID, message)
|
b.k.SendMessageByConvID(m.ConvID, message)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// then set the Custom server URL, if it exists
|
||||||
|
if opts.ConvID == string(m.ConvID) && opts.CustomURL != "" {
|
||||||
|
meeting.CustomServer = opts.CustomURL
|
||||||
|
}
|
||||||
b.k.SendMessageByConvID(m.ConvID, "@%s here's your meeting: %s", m.Sender.Username, meeting.getURL())
|
b.k.SendMessageByConvID(m.ConvID, "@%s here's your meeting: %s", m.Sender.Username, meeting.getURL())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,9 +144,13 @@ func (b *bot) handleConfigSet(m chat1.MsgSummary) {
|
|||||||
}
|
}
|
||||||
// then update the struct using only the scheme and hostname:port
|
// then update the struct using only the scheme and hostname:port
|
||||||
if u.Port() != "" {
|
if u.Port() != "" {
|
||||||
opts.CustomURL = fmt.Sprintf("%s://%s:%s/", u.Scheme, u.Hostname(), u.Port())
|
opts.CustomURL = fmt.Sprintf("%s://%s:%s", u.Scheme, u.Hostname(), u.Port())
|
||||||
} else {
|
} else {
|
||||||
opts.CustomURL = fmt.Sprintf("%s://%s/", u.Scheme, u.Hostname())
|
opts.CustomURL = fmt.Sprintf("%s://%s", u.Scheme, u.Hostname())
|
||||||
|
}
|
||||||
|
// ensure that the struct has convid filled out (if its new it won't)
|
||||||
|
if opts.ConvID == "" {
|
||||||
|
opts.ConvID = string(m.ConvID)
|
||||||
}
|
}
|
||||||
// then write that back to kvstore, with revision
|
// then write that back to kvstore, with revision
|
||||||
err = b.KVStorePutStruct(m.ConvID, opts)
|
err = b.KVStorePutStruct(m.ConvID, opts)
|
||||||
|
|||||||
Reference in New Issue
Block a user