diff --git a/commands.go b/commands.go index e831ead..3d326ec 100644 --- a/commands.go +++ b/commands.go @@ -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 `") + return + } ce.Command = strings.ToLower(ce.Args[0]) ce.Args = ce.Args[1:] } diff --git a/community.go b/community.go index bda8ee1..97d1819 100644 --- a/community.go +++ b/community.go @@ -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 diff --git a/user.go b/user.go index 3d31cbc..88eaa4f 100644 --- a/user.go +++ b/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)) }