Merge branch 'master' into dev

This commit is contained in:
Joseph Ferano 2022-04-26 09:54:07 +07:00
commit f044963470
2 changed files with 20 additions and 12 deletions

View File

@ -318,7 +318,7 @@ let spin multiplier (ctx : IDiscordContext) =
match result with
| "WON" -> s1 + $" **WON** {prizeAmount} $GBT playing slots!"
| "LOST" -> s1 + $" **LOST** playing slots"
| "JACKPOT" -> s1 + $" 🎉🎉🎉 **JUST HIT THE JACKPOT** and **WON**!!! 🎉🎉🎉"
| "JACKPOT" -> s1 + $" 🎉🎉🎉 **JUST HIT THE JACKPOT** and **WON** {prizeAmount}!!! 🎉🎉🎉"
| _ -> ""
let channel = ctx.GetGuild().GetChannel(GuildEnvironment.channelEventsHackerBattle)
do! channel.SendMessageAsync(hopMsg) |> Async.AwaitTask |> Async.Ignore
@ -378,7 +378,7 @@ let handleMessageCreated (_ : DiscordClient) (event : MessageCreateEventArgs) =
do! event.Message.DeleteAsync()
} :> Task
let sendEmbed channel (message : DiscordMessage option) = async {
let sendEmbed (jackpotNumChannel : DiscordChannel) slotsChannel (message : DiscordMessage option) = async {
let builder = DiscordMessageBuilder()
let embed = DiscordEmbedBuilder()
embed.Title <- "Degenz Slot Machine"
@ -387,6 +387,11 @@ let sendEmbed channel (message : DiscordMessage option) = async {
let! jackpot = getJackpotAmount ()
embed.Title <- $"CURRENT JACKPOT: `{jackpot} 💰 $GBT`"
// Update Jackpot channel
// try
// do! jackpotNumChannel.ModifyAsync(fun channelEditModel -> channelEditModel.Name <- $"Jackpot: {jackpot} 💰 $GBT") |> Async.AwaitTask
// with ex -> printfn $"Error changing name: {ex.Message}"
builder.AddEmbed(embed) |> ignore
let button1 = DiscordButtonComponent(ButtonStyle.Success, $"spin-1x", $"🎰 Bet {PlayPricex1} $GBT") :> DiscordComponent
@ -399,28 +404,30 @@ let sendEmbed channel (message : DiscordMessage option) = async {
let! _ = m.ModifyAsync(builder) |> Async.AwaitTask
return Some m
| Some bot , None ->
let! m = bot.SendMessageAsync(channel, builder) |> Async.AwaitTask
let! m = bot.SendMessageAsync(slotsChannel, builder) |> Async.AwaitTask
do! m.PinAsync() |> Async.AwaitTask
return Some m
| _ -> return None
}
let sendEmbedWithLoop (channel : DiscordChannel) =
let sendEmbedWithLoop (jackpotNumChannel : DiscordChannel) (slotsChannel : DiscordChannel) =
async {
let! pins = channel.GetPinnedMessagesAsync() |> Async.AwaitTask
let! pins = slotsChannel.GetPinnedMessagesAsync() |> Async.AwaitTask
let! message =
match pins |> Seq.toList with
| [] -> sendEmbed channel None
| [] -> sendEmbed jackpotNumChannel slotsChannel None
| msg::_ -> async.Return (Some msg)
while true do
do! Async.Sleep 10000
do! sendEmbed channel (message) |> Async.Ignore
do! Async.Sleep 305000
do! sendEmbed jackpotNumChannel slotsChannel message |> Async.Ignore
} |> Async.Start
let sendInitialEmbedFromLaunch (client : DiscordClient) =
let channel = client.Guilds.[GuildEnvironment.guildId].GetChannel(GuildEnvironment.channelSlots)
sendEmbedWithLoop channel
let jackpotNumChannel = client.Guilds.[GuildEnvironment.guildId].GetChannel(GuildEnvironment.channelJackpotNum)
let slotsChannel = client.Guilds.[GuildEnvironment.guildId].GetChannel(GuildEnvironment.channelSlots)
sendEmbedWithLoop jackpotNumChannel slotsChannel
let sendInitialEmbedFromSlashCommand (ctx : IDiscordContext) =
let channel = ctx.GetGuild().GetChannel(GuildEnvironment.channelSlots)
sendEmbedWithLoop channel
let jackpotNumChannel = ctx.GetGuild().GetChannel(GuildEnvironment.channelJackpotNum)
let slotsChannel = ctx.GetGuild().GetChannel(GuildEnvironment.channelSlots)
sendEmbedWithLoop jackpotNumChannel slotsChannel

View File

@ -34,6 +34,7 @@ let channelWhitelist = getId "CHANNEL_WHITELIST"
//let channelTosserTed = getId "CHANNEL_TOSSERTED"
let channelShelters = getId "CHANNEL_SHELTERS"
let channelSlots = getId "CHANNEL_SLOTS"
let channelJackpotNum = getId "CHANNEL_JACKPOTNUM"
let channelBackAlley = getId "CHANNEL_BACKALLEY"
let channelMarket = getId "CHANNEL_MARKET"
let channelAccessoryShop = getId "CHANNEL_ACCESSORIES"