Fix a few bugs
This commit is contained in:
parent
5b962bac2e
commit
eeedf9eccd
@ -81,8 +81,8 @@ let asdf (_ : DiscordClient) (event : DSharpPlus.EventArgs.InteractionCreateEven
|
|||||||
:> Task
|
:> Task
|
||||||
//hackerBattleBot.add_InteractionCreated(AsyncEventHandler(asdf))
|
//hackerBattleBot.add_InteractionCreated(AsyncEventHandler(asdf))
|
||||||
|
|
||||||
if guild <> 922419263275425832uL then
|
//if guild <> 922419263275425832uL then
|
||||||
Trainer.sendInitialEmbed hackerBattleBot
|
// Trainer.sendInitialEmbed hackerBattleBot
|
||||||
|
|
||||||
hackerBattleBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously
|
hackerBattleBot.ConnectAsync() |> Async.AwaitTask |> Async.RunSynchronously
|
||||||
GuildEnvironment.botUserHackerBattle <- Some hackerBattleBot.CurrentUser
|
GuildEnvironment.botUserHackerBattle <- Some hackerBattleBot.CurrentUser
|
||||||
|
@ -62,7 +62,7 @@ let getSellEmbed (items : ItemDetails list) =
|
|||||||
.WithTitle($"{item.Name}")
|
.WithTitle($"{item.Name}")
|
||||||
.WithColor(WeaponClass.getClassEmbedColor item)
|
.WithColor(WeaponClass.getClassEmbedColor item)
|
||||||
.Build()
|
.Build()
|
||||||
, DiscordButtonComponent(WeaponClass.getClassButtonColor item, $"Sell-{id}", $"Sell {item.Name}") :> DiscordComponent)
|
, DiscordButtonComponent(WeaponClass.getClassButtonColor item, $"Sell-{item.Id}", $"Sell {item.Name}") :> DiscordComponent)
|
||||||
|> List.unzip
|
|> List.unzip
|
||||||
|
|
||||||
DiscordFollowupMessageBuilder()
|
DiscordFollowupMessageBuilder()
|
||||||
|
@ -12,7 +12,7 @@ let Sensei = { Id = GuildEnvironment.botIdHackerBattle ; Name = "Sensei" }
|
|||||||
let defaultHack = Armory.weapons |> Inventory.findHackById (int ItemId.Virus)
|
let defaultHack = Armory.weapons |> Inventory.findHackById (int ItemId.Virus)
|
||||||
let defaultShield = Armory.weapons |> Inventory.findShieldById (int ItemId.Firewall)
|
let defaultShield = Armory.weapons |> Inventory.findShieldById (int ItemId.Firewall)
|
||||||
|
|
||||||
let HackEvent = {
|
let HackEvent () = {
|
||||||
Timestamp = System.DateTime.UtcNow
|
Timestamp = System.DateTime.UtcNow
|
||||||
Cooldown = 1<mins>
|
Cooldown = 1<mins>
|
||||||
Type = Hacking {
|
Type = Hacking {
|
||||||
@ -22,7 +22,7 @@ let HackEvent = {
|
|||||||
HackId = defaultHack.Item.Id
|
HackId = defaultHack.Item.Id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let ShieldEvent = {
|
let ShieldEvent () = {
|
||||||
Timestamp = System.DateTime.UtcNow
|
Timestamp = System.DateTime.UtcNow
|
||||||
Cooldown = defaultShield.Cooldown
|
Cooldown = defaultShield.Cooldown
|
||||||
Type = Shielding defaultShield.Item.Id
|
Type = Shielding defaultShield.Item.Id
|
||||||
@ -185,7 +185,7 @@ let handleArsenal (ctx : IDiscordContext) =
|
|||||||
|> List.exists (fun e -> match e.Type with Shielding shieldId -> shieldId = defaultShield.Item.Id | _ -> false)
|
|> List.exists (fun e -> match e.Type with Shielding shieldId -> shieldId = defaultShield.Item.Id | _ -> false)
|
||||||
if hasShield
|
if hasShield
|
||||||
then []
|
then []
|
||||||
else [ ShieldEvent ]
|
else [ ShieldEvent() ]
|
||||||
let updatedPlayer = {
|
let updatedPlayer = {
|
||||||
Player.removeExpiredActions player with
|
Player.removeExpiredActions player with
|
||||||
Events = shieldEvent @ player.Events
|
Events = shieldEvent @ player.Events
|
||||||
@ -194,11 +194,15 @@ let handleArsenal (ctx : IDiscordContext) =
|
|||||||
if not (List.isEmpty hack) || not (List.isEmpty shield) then
|
if not (List.isEmpty hack) || not (List.isEmpty shield) then
|
||||||
do! DbService.updatePlayer updatedPlayer |> Async.Ignore
|
do! DbService.updatePlayer updatedPlayer |> Async.Ignore
|
||||||
if not (List.isEmpty shieldEvent) then
|
if not (List.isEmpty shieldEvent) then
|
||||||
|
try
|
||||||
do! DbService.addPlayerEvent player.DiscordId (List.head shieldEvent) |> Async.Ignore
|
do! DbService.addPlayerEvent player.DiscordId (List.head shieldEvent) |> Async.Ignore
|
||||||
|
with ex ->
|
||||||
|
printfn "%s" ex.Message
|
||||||
|
()
|
||||||
|
|
||||||
let playerForEmbed = {
|
let playerForEmbed = {
|
||||||
player with
|
player with
|
||||||
Events = [ HackEvent ; ShieldEvent ]
|
Events = [ HackEvent() ; ShieldEvent() ]
|
||||||
Inventory = hack @ shield @ player.Inventory
|
Inventory = hack @ shield @ player.Inventory
|
||||||
}
|
}
|
||||||
let embed = Embeds.getArsenalEmbed playerForEmbed
|
let embed = Embeds.getArsenalEmbed playerForEmbed
|
||||||
|
@ -4,8 +4,8 @@ module Degenz.GuildEnvironment
|
|||||||
open System
|
open System
|
||||||
open DSharpPlus.Entities
|
open DSharpPlus.Entities
|
||||||
open dotenv.net
|
open dotenv.net
|
||||||
DotEnv.Load(DotEnvOptions(envFilePaths = [ "../../../../.dev.env" ], overwriteExistingVars = false))
|
//DotEnv.Load(DotEnvOptions(envFilePaths = [ "../../../../.dev.env" ], overwriteExistingVars = false))
|
||||||
//DotEnv.Load(DotEnvOptions(envFilePaths = [ "../../../../.stag.env" ], overwriteExistingVars = false))
|
DotEnv.Load(DotEnvOptions(envFilePaths = [ "../../../../.stag.env" ], overwriteExistingVars = false))
|
||||||
//DotEnv.Load(DotEnvOptions(envFilePaths = [ "../../../../.prod.env" ], overwriteExistingVars = false))
|
//DotEnv.Load(DotEnvOptions(envFilePaths = [ "../../../../.prod.env" ], overwriteExistingVars = false))
|
||||||
|
|
||||||
let getVar str = Environment.GetEnvironmentVariable(str)
|
let getVar str = Environment.GetEnvironmentVariable(str)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user