diff --git a/Bot/InviteTracker.fs b/Bot/InviteTracker.fs index fc1ee88..189e1b7 100644 --- a/Bot/InviteTracker.fs +++ b/Bot/InviteTracker.fs @@ -445,7 +445,7 @@ let handleGuildMemberAdded _ (eventArgs : GuildMemberAddEventArgs) = do! processNewUser eventArgs } :> Task -let submitWhitelist (ctx : IDiscordContext) (address : string) = +let submitWhitelist (address : string) (ctx : IDiscordContext) = task { // BtshZ7oNB5tk5pVbDpsRCziZ1qwV7SMCJq1Pe3YbHZuo let pubkey = PublicKey(address) @@ -473,9 +473,23 @@ Keep an eye on <#{GuildEnvironment.channelAnnouncements}> for updates. type Inviter() = inherit ApplicationCommandModule () + let enforceChannel (ctx : IDiscordContext) (fn : IDiscordContext -> Task) = + match ctx.GetChannel().Id with + | id when id = GuildEnvironment.channelSubmitWallet -> fn ctx + | _ -> + task { + let msg = $"You must go to <#{GuildEnvironment.channelSubmitWallet}> channel to submit your wallet" + do! Messaging.sendSimpleResponse ctx msg + } + [] member this.SubmitAddress (ctx : InteractionContext, [] address : string) = - submitWhitelist (DiscordInteractionContext ctx) address + if ctx.Member.Roles |> Seq.exists (fun role -> role.Id = GuildEnvironment.roleWhitelist || role.Id = GuildEnvironment.roleWhiteOG) then + enforceChannel (DiscordInteractionContext ctx) (submitWhitelist address) + else + let msg = $"You currently are not Whitelisted, go to <#{GuildEnvironment.channelWhitelist}> to purchase the role!" + Messaging.sendSimpleResponse (DiscordInteractionContext ctx) msg + |> Async.StartAsTask :> Task // [] // member this.ListInvitedPeople (ctx : InteractionContext) =