diff --git a/.gitignore b/.gitignore
index b2452a4..7cc029b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,192 +1,397 @@
-### PythonVanilla template
-# Byte-compiled / optimized / DLL files
-__pycache__/
-*.py[cod]
-*$py.class
+### Csharp ###
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
-# C extensions
-*.so
+# User-specific files
+*.rsuser
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
-# Distribution / packaging
-.Python
-build/
-develop-eggs/
-dist/
-downloads/
-eggs/
-.eggs/
-lib/
-lib64/
-parts/
-sdist/
-var/
-wheels/
-share/python-wheels/
-*.egg-info/
-.installed.cfg
-*.egg
-MANIFEST
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
-# Installer logs
-pip-log.txt
-pip-delete-this-directory.txt
+# Mono auto generated files
+mono_crash.*
-# Unit test / coverage reports
-htmlcov/
-.tox/
-.nox/
-.coverage
-.coverage.*
-.cache
-nosetests.xml
-coverage.xml
-*.cover
-*.py,cover
-.hypothesis/
-.pytest_cache/
-cover/
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+[Ww][Ii][Nn]32/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+[Ll]ogs/
-# Translations
-*.mo
-*.pot
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
-# pyenv
-# For a library or package, you might want to ignore these files since the code is
-# intended to run in multiple environments; otherwise, check them in:
-# .python-version
+# Visual Studio 2017 auto generated files
+Generated\ Files/
-# pipenv
-# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
-# However, in case of collaboration, if having platform-specific dependencies or dependencies
-# having no cross-platform support, pipenv may install dependencies that don't work, or not
-# install all needed dependencies.
-#Pipfile.lock
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
-# PEP 582; used by e.g. github.com/David-OConnor/pyflow
-__pypackages__/
+# NUnit
+*.VisualState.xml
+TestResult.xml
+nunit-*.xml
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
-### Python template
-# Byte-compiled / optimized / DLL files
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
-# C extensions
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
-# Distribution / packaging
+# ASP.NET Scaffolding
+ScaffoldingReadMe.txt
-# PyInstaller
-# Usually these files are written by a python script from a template
-# before PyInstaller builds the exe, so as to inject date/other infos into it.
-*.manifest
-*.spec
+# StyleCop
+StyleCopReport.xml
-# Installer logs
-
-# Unit test / coverage reports
-
-# Translations
-
-# Django stuff:
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
*.log
-local_settings.py
-db.sqlite3
-db.sqlite3-journal
+*.tlog
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
-# Flask stuff:
-instance/
-.webassets-cache
+# Chutzpah Test files
+_Chutzpah*
-# Scrapy stuff:
-.scrapy
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
-# Sphinx documentation
-docs/_build/
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
-# PyBuilder
-.pybuilder/
-target/
+# Visual Studio Trace Files
+*.e2e
-# Jupyter Notebook
-.ipynb_checkpoints
+# TFS 2012 Local Workspace
+$tf/
-# IPython
-profile_default/
-ipython_config.py
+# Guidance Automation Toolkit
+*.gpState
-# pyenv
-# For a library or package, you might want to ignore these files since the code is
-# intended to run in multiple environments; otherwise, check them in:
-# .python-version
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
-# pipenv
-# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
-# However, in case of collaboration, if having platform-specific dependencies or dependencies
-# having no cross-platform support, pipenv may install dependencies that don't work, or not
-# install all needed dependencies.
-#Pipfile.lock
+# TeamCity is a build add-in
+_TeamCity*
-# poetry
-# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
-# This is especially recommended for binary packages to ensure reproducibility, and is more
-# commonly ignored for libraries.
-# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
-#poetry.lock
+# DotCover is a Code Coverage Tool
+*.dotCover
-# pdm
-# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
-#pdm.lock
-# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
-# in version control.
-# https://pdm.fming.dev/#use-with-ide
-.pdm.toml
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
-# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
+# Coverlet is a free, cross platform Code Coverage Tool
+coverage*.json
+coverage*.xml
+coverage*.info
-# Celery stuff
-celerybeat-schedule
-celerybeat.pid
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
-# SageMath parsed files
-*.sage.py
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
-# Environments
-.env
-.venv
-env/
-venv/
-ENV/
-env.bak/
-venv.bak/
+# MightyMoose
+*.mm.*
+AutoTest.Net/
-# Spyder project settings
-.spyderproject
-.spyproject
+# Web workbench (sass)
+.sass-cache/
-# Rope project settings
-.ropeproject
+# Installshield output folder
+[Ee]xpress/
-# mkdocs documentation
-/site
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
-# mypy
-.mypy_cache/
-.dmypy.json
-dmypy.json
+# Click-Once directory
+publish/
-# Pyre type checker
-.pyre/
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
-# pytype static type analyzer
-.pytype/
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
-# Cython debug symbols
-cython_debug/
+# NuGet Packages
+*.nupkg
+# NuGet Symbol Packages
+*.snupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
-# PyCharm
-# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
-# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
-# and can be added to the global gitignore or merged into this file. For a more nuclear
-# option (not recommended) you can uncomment the following to ignore the entire idea folder.
-#.idea/
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
-#ignore .env
-.env
\ No newline at end of file
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+*.appxbundle
+*.appxupload
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!?*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+ServiceFabricBackup/
+*.rptproj.bak
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+*.rptproj.rsuser
+*- [Bb]ackup.rdl
+*- [Bb]ackup ([0-9]).rdl
+*- [Bb]ackup ([0-9][0-9]).rdl
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio 6 auto-generated project file (contains which files were open etc.)
+*.vbp
+
+# Visual Studio 6 workspace and project file (working project files containing files to include in project)
+*.dsw
+*.dsp
+
+# Visual Studio 6 technical files
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# CodeRush personal settings
+.cr/personal
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
+
+# Azure Stream Analytics local run output
+ASALocalRun/
+
+# MSBuild Binary and Structured Log
+*.binlog
+
+# NVidia Nsight GPU debugger configuration file
+*.nvuser
+
+# MFractors (Xamarin productivity tool) working folder
+.mfractor/
+
+# Local History for Visual Studio
+.localhistory/
+
+# Visual Studio History (VSHistory) files
+.vshistory/
+
+# BeatPulse healthcheck temp database
+healthchecksdb
+
+# Backup folder for Package Reference Convert tool in Visual Studio 2017
+MigrationBackup/
+
+# Ionide (cross platform F# VS Code tools) working folder
+.ionide/
+
+# Fody - auto-generated XML schema
+FodyWeavers.xsd
+
+# VS Code files for those working on multiple tools
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+*.code-workspace
+
+# Local History for Visual Studio Code
+.history/
+
+# Windows Installer files from build outputs
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
+
+# JetBrains Rider
+*.sln.iml
\ No newline at end of file
diff --git a/.idea/.gitignore b/.idea/.idea.IsleBot/.idea/.gitignore
similarity index 53%
rename from .idea/.gitignore
rename to .idea/.idea.IsleBot/.idea/.gitignore
index 13566b8..355ab8a 100644
--- a/.idea/.gitignore
+++ b/.idea/.idea.IsleBot/.idea/.gitignore
@@ -1,6 +1,11 @@
-# Default ignored files
+# Default ignored files
/shelf/
/workspace.xml
+# Rider ignored files
+/modules.xml
+/projectSettingsUpdater.xml
+/.idea.IsleBotSharp.iml
+/contentModel.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
diff --git a/.idea/.idea.IsleBot/.idea/encodings.xml b/.idea/.idea.IsleBot/.idea/encodings.xml
new file mode 100644
index 0000000..df87cf9
--- /dev/null
+++ b/.idea/.idea.IsleBot/.idea/encodings.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.IsleBot/.idea/indexLayout.xml b/.idea/.idea.IsleBot/.idea/indexLayout.xml
new file mode 100644
index 0000000..7b08163
--- /dev/null
+++ b/.idea/.idea.IsleBot/.idea/indexLayout.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/.idea.IsleBot/.idea/vcs.xml
similarity index 71%
rename from .idea/vcs.xml
rename to .idea/.idea.IsleBot/.idea/vcs.xml
index 94a25f7..35eb1dd 100644
--- a/.idea/vcs.xml
+++ b/.idea/.idea.IsleBot/.idea/vcs.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/.idea.IsleBotSharp/.idea/workspace.xml b/.idea/.idea.IsleBotSharp/.idea/workspace.xml
new file mode 100644
index 0000000..6807921
--- /dev/null
+++ b/.idea/.idea.IsleBotSharp/.idea/workspace.xml
@@ -0,0 +1,135 @@
+
+
+
+ IsleBotSharp.csproj
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {
+ "associatedIndex": 8
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1699202233917
+
+
+ 1699202233917
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/IsleBot.iml b/.idea/IsleBot.iml
deleted file mode 100644
index 74d515a..0000000
--- a/.idea/IsleBot.iml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/dbnavigator.xml b/.idea/dbnavigator.xml
deleted file mode 100644
index d44a9c7..0000000
--- a/.idea/dbnavigator.xml
+++ /dev/null
@@ -1,409 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
deleted file mode 100644
index ee80c28..0000000
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
deleted file mode 100644
index 105ce2d..0000000
--- a/.idea/inspectionProfiles/profiles_settings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 4073b5e..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 832b3e4..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Card.cs b/Card.cs
new file mode 100644
index 0000000..ed17aba
--- /dev/null
+++ b/Card.cs
@@ -0,0 +1,23 @@
+namespace IsleBot;
+
+public class Card
+{
+ public string Name { get; set; }
+ public int Attack { get; set; }
+ public int Defense { get; set; }
+ public int MaxHealth { get; set; }
+ public int CurrentHealth { get; set; }
+
+ public override string ToString() {
+ return $"{Name} ATK: {Attack} DEF: {Defense} HP: {CurrentHealth}/{MaxHealth}";
+ }
+
+ public Card(string name, int attack, int defense, int maxHealth) {
+ Name = name;
+ Attack = attack;
+ Defense = defense;
+ MaxHealth = maxHealth;
+ CurrentHealth = maxHealth;
+ }
+}
+
diff --git a/Card.py b/Card.py
deleted file mode 100644
index 76ae43b..0000000
--- a/Card.py
+++ /dev/null
@@ -1,25 +0,0 @@
-import string
-
-
-class Card:
- id: int = 0
- name: string = ""
- attack: int = 0
- defence: int = 0
- currHp: int = 0
- maxHp: int = 0
-
- def __init__(self, id: int, name: string, attack: int, defense: int):
- self.id = id
- self.name = name
- self.attack = attack
- self.defense = defense
-
- def __str__(self):
- return f"Card: {self.name} - Attack: {self.attack} - Defense: {self.defense}"
-
- def Attack(self, card):
- # current formula being sustained damage = attack - own card defence
- card.currHp -= (self.attack-card.defense)
- # might want to expand with crits and dice rolls to make it more fun
-
diff --git a/Config.cs b/Config.cs
new file mode 100644
index 0000000..70f2645
--- /dev/null
+++ b/Config.cs
@@ -0,0 +1,11 @@
+namespace IsleBot;
+
+public class Config
+{
+ public string DiscordToken { get; set; }
+
+ public Config(string discordToken)
+ {
+ DiscordToken = discordToken;
+ }
+}
\ No newline at end of file
diff --git a/DbManager.cs b/DbManager.cs
new file mode 100644
index 0000000..0c51001
--- /dev/null
+++ b/DbManager.cs
@@ -0,0 +1,21 @@
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+
+namespace IsleBot;
+
+public class DbManager : DbContext {
+ public DbSet Players { get; set; }
+ public DbSet Cards { get; set; }
+ public DbSet Matches { get; set; }
+
+ public string dbpath { get; } = "database.db";
+
+ public DbManager() {
+ var fullPath = Environment.CurrentDirectory + Path.DirectorySeparatorChar + dbpath;
+ dbpath = fullPath;
+ }
+
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ => optionsBuilder.UseSqlite($"Data Source={dbpath}");
+}
\ No newline at end of file
diff --git a/EStatus.cs b/EStatus.cs
new file mode 100644
index 0000000..0bacdc8
--- /dev/null
+++ b/EStatus.cs
@@ -0,0 +1,8 @@
+namespace IsleBot;
+
+public enum EStatus
+{
+ NotStarted,
+ InProgress,
+ Finished
+}
\ No newline at end of file
diff --git a/IsleBot.csproj b/IsleBot.csproj
new file mode 100644
index 0000000..e07710d
--- /dev/null
+++ b/IsleBot.csproj
@@ -0,0 +1,22 @@
+
+
+
+ Exe
+ net7.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+ PreserveNewest
+
+
+
+
diff --git a/IsleBot.sln b/IsleBot.sln
new file mode 100644
index 0000000..41af011
--- /dev/null
+++ b/IsleBot.sln
@@ -0,0 +1,16 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IsleBot", "IsleBot.csproj", "{86009AAF-9139-4B36-97FF-8531E01209B4}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {86009AAF-9139-4B36-97FF-8531E01209B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {86009AAF-9139-4B36-97FF-8531E01209B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {86009AAF-9139-4B36-97FF-8531E01209B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {86009AAF-9139-4B36-97FF-8531E01209B4}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/Match.cs b/Match.cs
new file mode 100644
index 0000000..59ee0c2
--- /dev/null
+++ b/Match.cs
@@ -0,0 +1,17 @@
+using Microsoft.EntityFrameworkCore;
+
+namespace IsleBot;
+
+public class Match {
+ public int MatchId { get; set; }
+
+ public User PlayerA { get; set; }
+ public Card PlayerACard { get; set; }
+
+ public User PlayerB { get; set; }
+ public Card PlayerBCard { get; set; }
+
+ public int PlayedTurns { get; set; }
+
+ public EStatus Status { get; set; }
+}
\ No newline at end of file
diff --git a/Player.py b/Player.py
deleted file mode 100644
index bb59b2d..0000000
--- a/Player.py
+++ /dev/null
@@ -1,24 +0,0 @@
-import string
-
-from Card import Card
-
-
-class Player:
- id: string = ""
- name: string = ""
- activeCard: Card = None
-
-
- def __init__(self, id: string, name: string):
- self.id = id
- self.Name = name
-
- def __str__(self):
- return f"Player: {self.Name} - ID: {self.id}"
-
- def setActiveCard(self, card: Card):
- self.activeCard = card
-
- def getActiveCard(self):
- return self.activeCard
-
diff --git a/Program.cs b/Program.cs
new file mode 100644
index 0000000..0f85e26
--- /dev/null
+++ b/Program.cs
@@ -0,0 +1,102 @@
+using Discord;
+using Discord.Net;
+using Discord.WebSocket;
+using Newtonsoft.Json;
+
+namespace IsleBot;
+
+public class IsleBot {
+ private Config config;
+ private DiscordSocketClient client;
+ Random rng = new Random();
+
+ public static Task Main(string[] args) {
+ var config = JsonConvert.DeserializeObject(File.ReadAllText("Config.json"));
+ var islebot = new IsleBot(config);
+ return islebot.MainAsync();
+ }
+
+ public async Task MainAsync() {
+ client = new DiscordSocketClient(
+ new DiscordSocketConfig {
+ LogLevel = LogSeverity.Info,
+ MessageCacheSize = 500,
+ GatewayIntents = GatewayIntents.AllUnprivileged
+ }
+ );
+
+ client.Log += Log;
+ client.Connected += () => {
+ Console.WriteLine("Connection Estabilished");
+ return Task.CompletedTask;
+ };
+ client.Disconnected += (e) => {
+ Console.WriteLine("Connection Lost");
+ return Task.CompletedTask;
+ };
+
+ client.Ready += Client_OnReady;
+
+ client.SlashCommandExecuted += SlashCommandHandler;
+
+ await client.LoginAsync(TokenType.Bot, config.DiscordToken);
+ await client.StartAsync();
+ // Block this task until the program is closed.
+ await Task.Delay(-1);
+ }
+
+ private async Task Client_OnReady() {
+ client.Guilds.ToList().ForEach(guild =>
+ {
+ var guildGetCard = new SlashCommandBuilder()
+ .WithName("get-card")
+ .WithDescription("Get/Replace your current card");
+
+ var attackCommand = new SlashCommandBuilder()
+ .WithName("attack")
+ .WithDescription("Attack a player")
+ .AddOption("target", ApplicationCommandOptionType.User, "The target of the attack");
+
+ try {
+ guild.CreateApplicationCommandAsync(guildGetCard.Build());
+ guild.CreateApplicationCommandAsync(attackCommand.Build());
+ } catch (HttpException exception) {
+ var json = JsonConvert.SerializeObject(exception.Errors, Formatting.Indented);
+ Console.WriteLine(json);
+ }
+ });
+ }
+
+ private async Task SlashCommandHandler(SocketSlashCommand command) {
+ switch (command.Data.Name) {
+ case "get-card":
+ var card = GenerateCard();
+ await command.RespondAsync("You got a new card!\n " + card);
+ break;
+ case "attack":
+ var target = command.Data.Options.First().Value as SocketUser;
+ await command.RespondAsync($"You attacked {target.Username}!");
+ break;
+ }
+ }
+
+ private Card GenerateCard() {
+ var card = new Card($"Test Card N. {rng.Next(0, 1000)}",
+ rng.Next(1, 20), rng.Next(0, 10),
+ rng.Next(25, 100));
+ return card;
+ }
+
+ private void Attack(ref Card attacker, ref Card defender) {
+ defender.CurrentHealth -= Math.Clamp(attacker.Attack - defender.Defense, 0, int.MaxValue);
+ }
+
+ private Task Log(LogMessage msg) {
+ Console.WriteLine(msg.ToString());
+ return Task.CompletedTask;
+ }
+
+ public IsleBot(Config config) {
+ this.config = config;
+ }
+}
diff --git a/User.cs b/User.cs
new file mode 100644
index 0000000..50cf86b
--- /dev/null
+++ b/User.cs
@@ -0,0 +1,14 @@
+namespace IsleBot;
+
+public class User
+{
+ public int Id { get; private set; }
+ public string UserName { get; set; }
+ public List Cards { get; set; }
+
+ public User(int id, string userName) {
+ Id = id;
+ UserName = userName;
+ Cards = new List();
+ }
+}
\ No newline at end of file
diff --git a/config.json b/config.json
new file mode 100644
index 0000000..7fe8295
--- /dev/null
+++ b/config.json
@@ -0,0 +1 @@
+{ "DiscordToken": "YourTokenHere" }
\ No newline at end of file
diff --git a/main.py b/main.py
deleted file mode 100644
index 56ea30d..0000000
--- a/main.py
+++ /dev/null
@@ -1,95 +0,0 @@
-import os
-import random
-import dotenv
-import discord
-
-from Card import Card
-from Player import Player
-
-
-dotenv.load_dotenv()
-token = os.getenv("TOKEN")
-#intents: discord.Intents = discord.Intents.default()
-#intents.guilds = True
-#intents.members = True
-#intents.messages = True
-#intents.message_content = True
-
-bot = discord.Bot()
-rng = random.Random()
-players = []
-
-@bot.event
-async def on_ready():
- print("Bot loaded")
-
-@bot.event
-async def on_message(message):
- # Prevents bot from responding to itself
- if message.author == bot.user:
- return
-
- if message.content.startswith("!hello"):
- await message.channel.send("Hello!")
- return
-
-@bot.slash_command(name="get-card", description="Get a random card")
-async def getCard(ctx: discord.ApplicationContext):
- sender = ctx.author
- player = Player(sender.id, sender.name)
- player.activeCard = Card(1, f"TestCard {rng.randint(0, 1999)}", rng.randint(2,20), rng.randint(0,5))
-
- for p in players:
- if p.id == player.id:
- p.activeCard = player.activeCard
- await ctx.respond(f"You already have a card, swapping it...\nYour new card is: \n {p.activeCard}")
- return
- players.append(player)
- await ctx.respond(f"Your card is: \n {player.activeCard}")
- return
-
-@bot.slash_command(name="attack", description="Attack another player")
-async def attackPlayer(ctx: discord.ApplicationContext, target: discord.Member):
- attacker: Player = None
- defender: Player = None
-
- if target == ctx.author:
- await ctx.respond("You can't attack yourself!")
- return
-
- if target.bot:
- await ctx.respond("You can't attack a bot!")
- return
-
- for p in players:
- if p.id == ctx.author.id:
- attacker = p
- if p.activeCard == None:
- await ctx.respond("You don't have a card! Generate one first!")
- return
- break
-
- for p in players:
- if p.id == target.id:
- defender = p
- if p.activeCard == None:
- await ctx.respond("That player doesn't have a card! Tell him to generate one first!")
- return
- break
-
- if attacker is None or defender is None:
- await ctx.respond(f"can't find a match... attacker: {attacker} defender: {defender}")
- return
-
- attacker.activeCard.Attack(defender.activeCard)
-
- if defender.activeCard.currHp <= 0:
- await ctx.respond(f"{attacker.Name} attacked {defender.Name} and killed his card!")
- players.remove(defender)
- return
- else:
- await ctx.respond(f"{attacker.Name} attacked {defender.Name}! {defender.Name}'s card has {defender.activeCard.currHp} hp left!")
- await ctx.send(f"Battle Status:\n{attacker.Name}'s card: {attacker.activeCard.currHp} hp left\n{defender.Name}'s card: {defender.activeCard.currHp} hp left")
- return
-
-bot.run(token)
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
deleted file mode 100644
index 67fc55f..0000000
Binary files a/requirements.txt and /dev/null differ
diff --git a/start.ps1 b/start.ps1
deleted file mode 100644
index c1baf72..0000000
--- a/start.ps1
+++ /dev/null
@@ -1,2 +0,0 @@
-.\venv\Scripts\activate.ps1
-python .\main.py