Grant OG Whitelist role

This commit is contained in:
Joseph Ferano 2022-05-12 22:22:10 +07:00
parent 4615aa3493
commit bdbb074383
2 changed files with 5 additions and 3 deletions

View File

@ -54,6 +54,7 @@ let roleTrainee = getId "ROLE_TRAINEE"
let roleHacker = getId "ROLE_HACKER" let roleHacker = getId "ROLE_HACKER"
let rolePrisoner = getId "ROLE_PRISONER" let rolePrisoner = getId "ROLE_PRISONER"
let roleWhitelist = getId "ROLE_WHITELIST" let roleWhitelist = getId "ROLE_WHITELIST"
let roleWhiteOG = getId "ROLE_WHITEOG"
let roleAdmin = getId "ROLE_ADMIN" let roleAdmin = getId "ROLE_ADMIN"
let mutable botClientRecruit : DiscordClient option = None let mutable botClientRecruit : DiscordClient option = None
let mutable botClientHacker : DiscordClient option = None let mutable botClientHacker : DiscordClient option = None

View File

@ -42,9 +42,10 @@ You need to **BUY** Whitelist with 💰 $GBT...
printfn $"Error trying to get channel Whitelist\n\n{e.Message}" printfn $"Error trying to get channel Whitelist\n\n{e.Message}"
} |> Async.RunSynchronously } |> Async.RunSynchronously
let grantWhitelistRole (ctx : IDiscordContext) = let grantWhitelistRole isOg (ctx : IDiscordContext) =
task { task {
let role = ctx.GetGuild().GetRole(GuildEnvironment.roleWhitelist) let roleId = if isOg then GuildEnvironment.roleWhiteOG else GuildEnvironment.roleWhitelist
let role = ctx.GetGuild().GetRole(roleId)
do! ctx.GetDiscordMember().GrantRoleAsync(role) do! ctx.GetDiscordMember().GrantRoleAsync(role)
} :> Task } :> Task
@ -57,7 +58,7 @@ let handleButtonEvent _ (event : ComponentInteractionCreateEventArgs) =
let id = ctx.GetInteractionId() let id = ctx.GetInteractionId()
let itemId = id.Split("-").[1] let itemId = id.Split("-").[1]
do! Store.handleBuyItem ctx itemId do! Store.handleBuyItem ctx itemId
do! grantWhitelistRole ctx do! grantWhitelistRole (itemId = "WHITEOG") ctx
} :> Task } :> Task
| id when id.StartsWith("CreateGuildInvite") -> InviteTracker.handleCreateInvite ctx | id when id.StartsWith("CreateGuildInvite") -> InviteTracker.handleCreateInvite ctx
| id when id.StartsWith("ShowRecruited") -> InviteTracker.getInvitedUsersForId (ctx.GetDiscordMember()) ctx | id when id.StartsWith("ShowRecruited") -> InviteTracker.getInvitedUsersForId (ctx.GetDiscordMember()) ctx