Add option to send the link of the message

This commit is contained in:
Joren 2024-06-27 12:14:55 +02:00
parent 95a05eef25
commit 3fe974d3c3
Signed by: Joren
GPG Key ID: 280E33DFBC0F1B55
2 changed files with 7 additions and 0 deletions

View File

@ -7,6 +7,7 @@
PREFIX_ENABLED = true PREFIX_ENABLED = true
SERVER_ID_ENABLED = false SERVER_ID_ENABLED = false
CHANNEL_ID_ENABLED = true CHANNEL_ID_ENABLED = true
MESSAGE_LINK_ENABLED = false
[SERVERS.COIN_REGEXES] [SERVERS.COIN_REGEXES]
Bitcoin = "[13][a-km-zA-HJ-NP-Z1-9]{25,34}" Bitcoin = "[13][a-km-zA-HJ-NP-Z1-9]{25,34}"
Ethereum = "0x[a-fA-F0-9]{40}" Ethereum = "0x[a-fA-F0-9]{40}"
@ -19,6 +20,7 @@
PREFIX_ENABLED = false PREFIX_ENABLED = false
SERVER_ID_ENABLED = false SERVER_ID_ENABLED = false
CHANNEL_ID_ENABLED = true CHANNEL_ID_ENABLED = true
MESSAGE_LINK_ENABLED = false
[SERVERS.COIN_REGEXES] [SERVERS.COIN_REGEXES]
Ethereum = "0x[a-fA-F0-9]{40}" Ethereum = "0x[a-fA-F0-9]{40}"
Solana = "[1-9A-HJ-NP-Za-km-z]{32,44}" Solana = "[1-9A-HJ-NP-Za-km-z]{32,44}"

View File

@ -29,6 +29,7 @@ type ServerConfig struct {
AllowDuplicates bool `toml:"ALLOW_DUPLICATES"` AllowDuplicates bool `toml:"ALLOW_DUPLICATES"`
ServerIDEnabled bool `toml:"SERVER_ID_ENABLED"` ServerIDEnabled bool `toml:"SERVER_ID_ENABLED"`
ChannelIDEnabled bool `toml:"CHANNEL_ID_ENABLED"` ChannelIDEnabled bool `toml:"CHANNEL_ID_ENABLED"`
MessageLinkEnabled bool `toml:"MESSAGE_LINK_ENABLED"`
} }
func init() { func init() {
@ -176,6 +177,10 @@ func formatMessage(server ServerConfig, coin, username, address, serverName stri
message = fmt.Sprintf("%s (From: <#%s>)", message, m.ChannelID) message = fmt.Sprintf("%s (From: <#%s>)", message, m.ChannelID)
} }
if server.MessageLinkEnabled {
message = fmt.Sprintf("%s ([Link](<https://discord.com/channels/%s/%s/%s>))", message, m.GuildID, m.ChannelID, m.ID)
}
return message return message
} }