Fix NeedsRelaybot check and relaybot command handling without arguments
This commit is contained in:
parent
0f4048a178
commit
691d2ea1b3
3 changed files with 7 additions and 3 deletions
|
@ -152,6 +152,10 @@ func (handler *CommandHandler) CommandRelaybot(ce *CommandEvent) {
|
|||
ce.Reply("Only admins can manage the relaybot")
|
||||
} else {
|
||||
if ce.Command == "relaybot" {
|
||||
if len(ce.Args) == 0 {
|
||||
ce.Reply("**Usage:** `relaybot <command>`")
|
||||
return
|
||||
}
|
||||
ce.Command = strings.ToLower(ce.Args[0])
|
||||
ce.Args = ce.Args[1:]
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ func (user *User) updateCommunityProfile() {
|
|||
}
|
||||
|
||||
func (user *User) createCommunity() {
|
||||
if !user.bridge.Config.Bridge.EnableCommunities() {
|
||||
if user.IsRelaybot || !user.bridge.Config.Bridge.EnableCommunities() {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ func (user *User) createCommunity() {
|
|||
}
|
||||
|
||||
func (user *User) addPortalToCommunity(portal *Portal) bool {
|
||||
if len(user.CommunityID) == 0 || len(portal.MXID) == 0 {
|
||||
if user.IsRelaybot || len(user.CommunityID) == 0 || len(portal.MXID) == 0 {
|
||||
return false
|
||||
}
|
||||
bot := user.bridge.Bot
|
||||
|
|
2
user.go
2
user.go
|
@ -781,5 +781,5 @@ func (user *User) HandleRawMessage(message *waProto.WebMessageInfo) {
|
|||
}
|
||||
|
||||
func (user *User) NeedsRelaybot(portal *Portal) bool {
|
||||
return !user.HasSession() || user.IsInPortal(portal.Key.JID) || portal.IsPrivateChat()
|
||||
return !user.HasSession() || (user.IsInPortal(portal.Key.JID) && (!portal.IsPrivateChat() || portal.Key.Receiver == user.JID))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue