From 3fe974d3c30825e2290b51eb984822bd48c503e0 Mon Sep 17 00:00:00 2001 From: Joren Date: Thu, 27 Jun 2024 12:14:55 +0200 Subject: [PATCH] Add option to send the link of the message --- config.toml.example | 2 ++ main.go | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/config.toml.example b/config.toml.example index d2c2135..68051a4 100644 --- a/config.toml.example +++ b/config.toml.example @@ -7,6 +7,7 @@ PREFIX_ENABLED = true SERVER_ID_ENABLED = false CHANNEL_ID_ENABLED = true + MESSAGE_LINK_ENABLED = false [SERVERS.COIN_REGEXES] Bitcoin = "[13][a-km-zA-HJ-NP-Z1-9]{25,34}" Ethereum = "0x[a-fA-F0-9]{40}" @@ -19,6 +20,7 @@ PREFIX_ENABLED = false SERVER_ID_ENABLED = false CHANNEL_ID_ENABLED = true + MESSAGE_LINK_ENABLED = false [SERVERS.COIN_REGEXES] Ethereum = "0x[a-fA-F0-9]{40}" Solana = "[1-9A-HJ-NP-Za-km-z]{32,44}" diff --git a/main.go b/main.go index 730104a..77c3e63 100644 --- a/main.go +++ b/main.go @@ -29,6 +29,7 @@ type ServerConfig struct { AllowDuplicates bool `toml:"ALLOW_DUPLICATES"` ServerIDEnabled bool `toml:"SERVER_ID_ENABLED"` ChannelIDEnabled bool `toml:"CHANNEL_ID_ENABLED"` + MessageLinkEnabled bool `toml:"MESSAGE_LINK_ENABLED"` } func init() { @@ -176,6 +177,10 @@ func formatMessage(server ServerConfig, coin, username, address, serverName stri message = fmt.Sprintf("%s (From: <#%s>)", message, m.ChannelID) } + if server.MessageLinkEnabled { + message = fmt.Sprintf("%s ([Link]())", message, m.GuildID, m.ChannelID, m.ID) + } + return message }