Enforce role and channel
This commit is contained in:
parent
7fd3100790
commit
a9e00c0436
@ -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
|
||||
}
|
||||
|
||||
[<SlashCommand("submit", "Submit your public wallet address")>]
|
||||
member this.SubmitAddress (ctx : InteractionContext, [<Option("address", "Wallet address")>] 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
|
||||
|
||||
// [<SlashCommand("recruited", "Get total invites from a specific user")>]
|
||||
// member this.ListInvitedPeople (ctx : InteractionContext) =
|
||||
|
Loading…
x
Reference in New Issue
Block a user