forked from MirrorHub/mautrix-whatsapp
Merge remote-tracking branch 'conor-f/toggle-presence-and-receipts'
This commit is contained in:
commit
06a041981d
3 changed files with 9 additions and 6 deletions
11
commands.go
11
commands.go
|
@ -421,11 +421,11 @@ func (handler *CommandHandler) CommandLogout(ce *CommandEvent) {
|
||||||
ce.Reply("Logged out successfully.")
|
ce.Reply("Logged out successfully.")
|
||||||
}
|
}
|
||||||
|
|
||||||
const cmdToggleHelp = `toggle <presence|receipts> - Toggle bridging of presence or read receipts`
|
const cmdToggleHelp = `toggle <presence|receipts|all> - Toggle bridging of presence or read receipts`
|
||||||
|
|
||||||
func (handler *CommandHandler) CommandToggle(ce *CommandEvent) {
|
func (handler *CommandHandler) CommandToggle(ce *CommandEvent) {
|
||||||
if len(ce.Args) == 0 || (ce.Args[0] != "presence" && ce.Args[0] != "receipts") {
|
if len(ce.Args) == 0 || (ce.Args[0] != "presence" && ce.Args[0] != "receipts" && ce.Args[0] != "all") {
|
||||||
ce.Reply("**Usage:** `toggle <presence|receipts>`")
|
ce.Reply("**Usage:** `toggle <presence|receipts|all>`")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if ce.User.Session == nil {
|
if ce.User.Session == nil {
|
||||||
|
@ -437,7 +437,7 @@ func (handler *CommandHandler) CommandToggle(ce *CommandEvent) {
|
||||||
ce.Reply("You're not logged in with your Matrix account.")
|
ce.Reply("You're not logged in with your Matrix account.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if ce.Args[0] == "presence" {
|
if ce.Args[0] == "presence" || ce.Args[0] == "all" {
|
||||||
customPuppet.EnablePresence = !customPuppet.EnablePresence
|
customPuppet.EnablePresence = !customPuppet.EnablePresence
|
||||||
var newPresence whatsapp.Presence
|
var newPresence whatsapp.Presence
|
||||||
if customPuppet.EnablePresence {
|
if customPuppet.EnablePresence {
|
||||||
|
@ -453,7 +453,8 @@ func (handler *CommandHandler) CommandToggle(ce *CommandEvent) {
|
||||||
ce.User.log.Warnln("Failed to set presence:", err)
|
ce.User.log.Warnln("Failed to set presence:", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ce.Args[0] == "receipts" {
|
}
|
||||||
|
if ce.Args[0] == "receipts" || ce.Args[0] == "all" {
|
||||||
customPuppet.EnableReceipts = !customPuppet.EnableReceipts
|
customPuppet.EnableReceipts = !customPuppet.EnableReceipts
|
||||||
if customPuppet.EnableReceipts {
|
if customPuppet.EnableReceipts {
|
||||||
ce.Reply("Enabled read receipt bridging")
|
ce.Reply("Enabled read receipt bridging")
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -13,7 +13,7 @@ require (
|
||||||
gopkg.in/yaml.v2 v2.3.0
|
gopkg.in/yaml.v2 v2.3.0
|
||||||
maunium.net/go/mauflag v1.0.0
|
maunium.net/go/mauflag v1.0.0
|
||||||
maunium.net/go/maulogger/v2 v2.2.4
|
maunium.net/go/maulogger/v2 v2.2.4
|
||||||
maunium.net/go/mautrix v0.9.7-0.20210419142435-ba8ea0c90b98
|
maunium.net/go/mautrix v0.9.7
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/Rhymen/go-whatsapp => github.com/tulir/go-whatsapp v0.4.3
|
replace github.com/Rhymen/go-whatsapp => github.com/tulir/go-whatsapp v0.4.3
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -522,5 +522,7 @@ maunium.net/go/mautrix v0.9.6 h1:X/AoDLpy9NH8AiKuEZd8+Dd4BFJ59wLuVJCfDg3YmQA=
|
||||||
maunium.net/go/mautrix v0.9.6/go.mod h1:mckyHSKKyI0PQF2K9MgWMMDUWH1meCNggE28ILTLuMg=
|
maunium.net/go/mautrix v0.9.6/go.mod h1:mckyHSKKyI0PQF2K9MgWMMDUWH1meCNggE28ILTLuMg=
|
||||||
maunium.net/go/mautrix v0.9.7-0.20210419142435-ba8ea0c90b98 h1:FXg4JcsKHtoYGo/bSc77kEkiKwGdvsksqS3VqR4Ycks=
|
maunium.net/go/mautrix v0.9.7-0.20210419142435-ba8ea0c90b98 h1:FXg4JcsKHtoYGo/bSc77kEkiKwGdvsksqS3VqR4Ycks=
|
||||||
maunium.net/go/mautrix v0.9.7-0.20210419142435-ba8ea0c90b98/go.mod h1:mckyHSKKyI0PQF2K9MgWMMDUWH1meCNggE28ILTLuMg=
|
maunium.net/go/mautrix v0.9.7-0.20210419142435-ba8ea0c90b98/go.mod h1:mckyHSKKyI0PQF2K9MgWMMDUWH1meCNggE28ILTLuMg=
|
||||||
|
maunium.net/go/mautrix v0.9.7 h1:PnRJuH2hhLmQ7arxph1ICXC5H1kGsnD+ldI1LsbCvlo=
|
||||||
|
maunium.net/go/mautrix v0.9.7/go.mod h1:mckyHSKKyI0PQF2K9MgWMMDUWH1meCNggE28ILTLuMg=
|
||||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||||
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
|
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
|
||||||
|
|
Loading…
Reference in a new issue