浏览代码

Update username format in custom bridge identifier metadata

Tulir Asokan 2 年之前
父节点
当前提交
d39499cdcf
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      puppet.go

+ 5 - 1
puppet.go

@@ -350,9 +350,13 @@ func (puppet *Puppet) ResendContactInfo() {
 	if !puppet.bridge.SpecVersions.Supports(mautrix.BeeperFeatureArbitraryProfileMeta) || puppet.ContactInfoSet {
 		return
 	}
+	discordUsername := puppet.Username
+	if puppet.Discriminator != "0" {
+		discordUsername += "#" + puppet.Discriminator
+	}
 	contactInfo := map[string]any{
 		"com.beeper.bridge.identifiers": []string{
-			fmt.Sprintf("discord:%s#%s", puppet.Username, puppet.Discriminator),
+			fmt.Sprintf("discord:%s", discordUsername),
 		},
 		"com.beeper.bridge.remote_id":      puppet.ID,
 		"com.beeper.bridge.service":        puppet.bridge.BeeperServiceName,