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