Check if wallet is already stored
This commit is contained in:
parent
6e0d304266
commit
b7f4b675f7
@ -446,18 +446,24 @@ let handleGuildMemberAdded _ (eventArgs : GuildMemberAddEventArgs) =
|
||||
} :> Task
|
||||
|
||||
let submitWhitelist (address : string) (ctx : IDiscordContext) =
|
||||
task {
|
||||
PlayerInteractions.executePlayerAction ctx (fun player -> async {
|
||||
// BtshZ7oNB5tk5pVbDpsRCziZ1qwV7SMCJq1Pe3YbHZuo
|
||||
let pubkey = PublicKey(address)
|
||||
try
|
||||
if pubkey.IsValid() && pubkey.IsOnCurve() then
|
||||
let! maybeAddress = getWalletAddress player.DiscordId
|
||||
let msg =
|
||||
match maybeAddress with
|
||||
| Some storedAddress when storedAddress = address -> "You already provided this wallet address:"
|
||||
| Some _ -> "We successfully updated your wallet address:"
|
||||
| None -> "We have successfully received your wallet address"
|
||||
do! addWalletAddress (ctx.GetDiscordMember().Id) address
|
||||
do! Messaging.sendSimpleResponse ctx $"""
|
||||
✅ We have successfully received your wallet address: {address}
|
||||
✅ {msg} {address}
|
||||
|
||||
Keep an eye on <#{GuildEnvironment.channelAnnouncements}> for updates.
|
||||
🚀 Mint Date: 31st May 18:00 UTC"""
|
||||
|
||||
|
||||
let builder = DiscordMessageBuilder()
|
||||
builder.WithContent($"<@{ctx.GetDiscordMember().Username}> submitted their wallet address in <#{GuildEnvironment.channelSubmitWallet}> and confirmed whitelist") |> ignore
|
||||
let channel = (ctx.GetGuild().GetChannel(GuildEnvironment.channelEventsHackerBattle))
|
||||
@ -471,7 +477,7 @@ Keep an eye on <#{GuildEnvironment.channelAnnouncements}> for updates.
|
||||
with _ ->
|
||||
do! Messaging.sendSimpleResponse ctx "⚠️ That's not a valid Solana address, please try again"
|
||||
do! Analytics.invalidWalletSubmit (ctx.GetDiscordMember())
|
||||
} :> Task
|
||||
})
|
||||
|
||||
type Inviter() =
|
||||
inherit ApplicationCommandModule ()
|
||||
|
Loading…
x
Reference in New Issue
Block a user