avatar and room on join

This commit is contained in:
Karmanyaah Malhotra
2021-02-27 17:38:47 -05:00
parent 27d3e0322d
commit b5af55122e
8 changed files with 313 additions and 300 deletions

View File

@@ -918,31 +918,31 @@ func (handler *CommandHandler) CommandPM(ce *CommandEvent) {
const cmdLoginMatrixHelp = `login-matrix <_access token_> - Replace your WhatsApp account's Matrix puppet with your real Matrix account.'`
func (handler *CommandHandler) CommandLoginMatrix(ce *CommandEvent) {
if len(ce.Args) == 0 {
ce.Reply("**Usage:** `login-matrix <access token>`")
return
}
puppet := handler.bridge.GetPuppetByJID(ce.User.JID)
err := puppet.SwitchCustomMXID(ce.Args[0], ce.User.MXID)
if err != nil {
ce.Reply("Failed to switch puppet: %v", err)
return
}
ce.Reply("Successfully switched puppet")
//if len(ce.Args) == 0 {
// ce.Reply("**Usage:** `login-matrix <access token>`")
// return
//}
//puppet := handler.bridge.GetPuppetByJID(ce.User.JID)
//err := puppet.SwitchCustomMXID(ce.Args[0], ce.User.MXID)
//if err != nil {
// ce.Reply("Failed to switch puppet: %v", err)
// return
//}
//ce.Reply("Successfully switched puppet")
}
const cmdLogoutMatrixHelp = `logout-matrix - Switch your WhatsApp account's Matrix puppet back to the default one.`
func (handler *CommandHandler) CommandLogoutMatrix(ce *CommandEvent) {
puppet := handler.bridge.GetPuppetByJID(ce.User.JID)
if len(puppet.CustomMXID) == 0 {
ce.Reply("You had not changed your WhatsApp account's Matrix puppet.")
return
}
err := puppet.SwitchCustomMXID("", "")
if err != nil {
ce.Reply("Failed to remove custom puppet: %v", err)
return
}
ce.Reply("Successfully removed custom puppet")
//puppet := handler.bridge.GetPuppetByJID(ce.User.JID)
//if len(puppet.CustomMXID) == 0 {
// ce.Reply("You had not changed your WhatsApp account's Matrix puppet.")
// return
//}
//err := puppet.SwitchCustomMXID("", "")
//if err != nil {
// ce.Reply("Failed to remove custom puppet: %v", err)
// return
//}
//ce.Reply("Successfully removed custom puppet")
}