Check if wallet is already stored
This commit is contained in:
parent
6e0d304266
commit
b7f4b675f7
@ -446,14 +446,20 @@ let handleGuildMemberAdded _ (eventArgs : GuildMemberAddEventArgs) =
|
|||||||
} :> Task
|
} :> Task
|
||||||
|
|
||||||
let submitWhitelist (address : string) (ctx : IDiscordContext) =
|
let submitWhitelist (address : string) (ctx : IDiscordContext) =
|
||||||
task {
|
PlayerInteractions.executePlayerAction ctx (fun player -> async {
|
||||||
// BtshZ7oNB5tk5pVbDpsRCziZ1qwV7SMCJq1Pe3YbHZuo
|
// BtshZ7oNB5tk5pVbDpsRCziZ1qwV7SMCJq1Pe3YbHZuo
|
||||||
let pubkey = PublicKey(address)
|
let pubkey = PublicKey(address)
|
||||||
try
|
try
|
||||||
if pubkey.IsValid() && pubkey.IsOnCurve() then
|
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! addWalletAddress (ctx.GetDiscordMember().Id) address
|
||||||
do! Messaging.sendSimpleResponse ctx $"""
|
do! Messaging.sendSimpleResponse ctx $"""
|
||||||
✅ We have successfully received your wallet address: {address}
|
✅ {msg} {address}
|
||||||
|
|
||||||
Keep an eye on <#{GuildEnvironment.channelAnnouncements}> for updates.
|
Keep an eye on <#{GuildEnvironment.channelAnnouncements}> for updates.
|
||||||
🚀 Mint Date: 31st May 18:00 UTC"""
|
🚀 Mint Date: 31st May 18:00 UTC"""
|
||||||
@ -471,7 +477,7 @@ Keep an eye on <#{GuildEnvironment.channelAnnouncements}> for updates.
|
|||||||
with _ ->
|
with _ ->
|
||||||
do! Messaging.sendSimpleResponse ctx "⚠️ That's not a valid Solana address, please try again"
|
do! Messaging.sendSimpleResponse ctx "⚠️ That's not a valid Solana address, please try again"
|
||||||
do! Analytics.invalidWalletSubmit (ctx.GetDiscordMember())
|
do! Analytics.invalidWalletSubmit (ctx.GetDiscordMember())
|
||||||
} :> Task
|
})
|
||||||
|
|
||||||
type Inviter() =
|
type Inviter() =
|
||||||
inherit ApplicationCommandModule ()
|
inherit ApplicationCommandModule ()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user