Slot machine game

This commit is contained in:
Joseph Ferano 2022-01-17 02:05:07 +07:00
parent 6492d0c4ba
commit 70dbaf86ab
6 changed files with 120 additions and 0 deletions

View File

@ -13,6 +13,8 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "PlayerInteractions", "Playe
EndProject EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "DbService", "DbService\DbService.fsproj", "{B1D3E1CC-451C-42D4-B054-D64E75E1A3B9}" Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "DbService", "DbService\DbService.fsproj", "{B1D3E1CC-451C-42D4-B054-D64E75E1A3B9}"
EndProject EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "SlotMachine", "SlotMachine\SlotMachine.fsproj", "{3183BE8D-1CA6-4768-8606-BEF6F4EC8DE1}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -42,5 +44,9 @@ Global
{B1D3E1CC-451C-42D4-B054-D64E75E1A3B9}.Debug|Any CPU.Build.0 = Debug|Any CPU {B1D3E1CC-451C-42D4-B054-D64E75E1A3B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1D3E1CC-451C-42D4-B054-D64E75E1A3B9}.Release|Any CPU.ActiveCfg = Release|Any CPU {B1D3E1CC-451C-42D4-B054-D64E75E1A3B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B1D3E1CC-451C-42D4-B054-D64E75E1A3B9}.Release|Any CPU.Build.0 = Release|Any CPU {B1D3E1CC-451C-42D4-B054-D64E75E1A3B9}.Release|Any CPU.Build.0 = Release|Any CPU
{3183BE8D-1CA6-4768-8606-BEF6F4EC8DE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3183BE8D-1CA6-4768-8606-BEF6F4EC8DE1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3183BE8D-1CA6-4768-8606-BEF6F4EC8DE1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3183BE8D-1CA6-4768-8606-BEF6F4EC8DE1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

25
SlotMachine/.dockerignore Normal file
View File

@ -0,0 +1,25 @@
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.idea
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md

18
SlotMachine/Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["Roulette/Roulette.fsproj", "Roulette/"]
RUN dotnet restore "Roulette/Roulette.fsproj"
COPY . .
WORKDIR "/src/Roulette"
RUN dotnet build "Roulette.fsproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Roulette.fsproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Roulette.dll"]

View File

@ -0,0 +1,43 @@
open System.Threading.Tasks
open DSharpPlus
open DSharpPlus.Entities
open DSharpPlus.SlashCommands
open Emzi0767.Utilities
open DegenzGame.Shared
type EmptyGlobalCommandToAvoidFamousDuplicateSlashCommandsBug() = inherit ApplicationCommandModule ()
type SlotMachine() =
inherit ApplicationCommandModule ()
[<SlashCommand("spin", "Want to try your luck?")>]
member this.AttackCommand (ctx : InteractionContext) =
()
let config = DiscordConfiguration()
config.Token <- "OTMyMzQ3NzQ1NDE3NzE1ODE0.YeRqgA.PHandjk0jQGIxlM8NlqKc7cJD3s"
config.TokenType <- TokenType.Bot
config.Intents <- DiscordIntents.All
//config.MinimumLogLevel <- Microsoft.Extensions.Logging.LogLevel.Trace
let client = new DiscordClient(config)
let slash = client.UseSlashCommands()
// My server
slash.RegisterCommands<SlotMachine>(922419263275425832uL);
// Degenz
//slash.RegisterCommands<HackerGame>(922414052708327494uL);
client.ConnectAsync ()
|> Async.AwaitTask
|> Async.RunSynchronously
Task.Delay(-1)
|> Async.AwaitTask
|> Async.RunSynchronously
client.DisconnectAsync ()
|> Async.AwaitTask
|> Async.RunSynchronously

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>
<Compile Include="SlotMachine.fs" />
</ItemGroup>
<ItemGroup>
<Content Include=".dockerignore" />
<Content Include="Dockerfile" />
<Content Include="paket.references" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DbService\DbService.fsproj" />
<ProjectReference Include="..\Shared\Shared.fsproj" />
</ItemGroup>
<Import Project="..\.paket\Paket.Restore.targets" />
</Project>

View File

@ -0,0 +1,7 @@
FSharp.Core
DSharpPlus
// DSharpPlus.CommandsNext
// DSharpPlus.Interactivity
DSharpPlus.SlashCommands
// MongoDB.Driver