Compare commits
394 Commits
v1.0.4-pre
...
preview
| Author | SHA1 | Date | |
|---|---|---|---|
| fae4b37ef9 | |||
| b8a3f189a9 | |||
| 962d813466 | |||
| 89385a8c89 | |||
| f68b6cb877 | |||
| e9b61cc4be | |||
| 062b0d0133 | |||
| c3dd68576d | |||
| fafa493db7 | |||
| 15b6d224de | |||
| 81905460da | |||
| 11b9515bab | |||
| fcd3a59d54 | |||
| 7de5d88aea | |||
| dc40f4ebe4 | |||
| 8ba9448beb | |||
| f70e8a565b | |||
| 14ca51b18a | |||
| a0177ce145 | |||
| e57e941c94 | |||
| 5bfeb47fc8 | |||
| 9fce6dcf9d | |||
| b605321086 | |||
| 3a714808e2 | |||
| 5061a92412 | |||
| 296dbf5309 | |||
| e6976a5a74 | |||
| 3e4709148f | |||
| 3a7bd53cfc | |||
| 2bd368dcce | |||
| 0c33422b5c | |||
| 16b6e42a97 | |||
| 7106a928d6 | |||
| 4ea7b25e4d | |||
| 2cb868d747 | |||
| f10d72d704 | |||
| 0493dfaeb4 | |||
| 2d319f3d34 | |||
| c548c6191d | |||
| f19aafcec6 | |||
| 2e6b6b9a61 | |||
| f5d48a398d | |||
| c8cf887a09 | |||
| 4ab8438a7c | |||
| 87c889266b | |||
| 8aaefac706 | |||
| a4afb28f36 | |||
| 62ba5ec63d | |||
| a6ed4078ca | |||
| 20165af15a | |||
| d26c84480a | |||
| 84b19e2069 | |||
| 8b2169dc7b | |||
| 7ebe3e7014 | |||
| 49fe637455 | |||
| a754b0e5a9 | |||
| c79c792c43 | |||
| 424bf2196f | |||
| a12aa66660 | |||
| dee4793176 | |||
| 54be74b1cb | |||
| 9102cfaa47 | |||
| f2a9982d41 | |||
| bd3f79430b | |||
| 44d8b4684e | |||
| 9e8bfbbe16 | |||
| f8df0f0254 | |||
| 5b1d511f77 | |||
| cfcfecd4bc | |||
| c2dc01cbbb | |||
| e229362d38 | |||
| 8a2212e47f | |||
| 0630d2e291 | |||
| f108a1fe08 | |||
| 81eb966752 | |||
| c61a9d5e51 | |||
| 49403e70fd | |||
| be75ef03cb | |||
| aff40dfd63 | |||
| a584423939 | |||
| d51526bf22 | |||
| 30e92b742c | |||
| f7ba5f94ff | |||
| 34a54cd78f | |||
| 046c9bf98b | |||
| a23da51c08 | |||
| 1c002edc6d | |||
| 0a64de2439 | |||
| c080074292 | |||
| 95e8d95c92 | |||
| 9c98d2e219 | |||
| 18a059af0e | |||
| 27e25a9166 | |||
| 721c28c283 | |||
| 8366de28cc | |||
| 8c338820c5 | |||
| 08c5febd66 | |||
| 4a08a25167 | |||
| 66fbaf3e26 | |||
| 894d09f6fa | |||
| 8ace51c840 | |||
| 1fd065f4c2 | |||
| 1a4b654036 | |||
| 457b2b7364 | |||
| 3f2c98cb11 | |||
| 224784031c | |||
| 13900bb3f3 | |||
| 3f8590b8f3 | |||
| 6599428043 | |||
| 349c669284 | |||
| 2052eb634a | |||
| 48a133d58c | |||
| e0eae076f1 | |||
| 79c6daa11a | |||
| d186efcdaf | |||
| 8483439555 | |||
| 9aeb406f6f | |||
| 16147b6bd7 | |||
| 9b563cc0f6 | |||
| fa7e7988d5 | |||
| 68886fa5f0 | |||
| 86b951f50f | |||
| 1881102fb7 | |||
| e5e156f371 | |||
| d9d5c05313 | |||
| 9a8ddb5388 | |||
| 1a5f0cbede | |||
| 23961a48b0 | |||
| de7c65c27b | |||
| bc20101795 | |||
| cdd426b03c | |||
| 83115d72a4 | |||
| d3dd29f4bf | |||
| 5345515512 | |||
| c87d1a89c5 | |||
| 4c8fd1a672 | |||
| a5e65a5ea5 | |||
| d6398cd1cc | |||
| 5731165d29 | |||
| 8dbbfbfaef | |||
| 152e09f4af | |||
| 17147d920d | |||
| 413d465d7f | |||
| d5f78c831e | |||
| 7847c6cc8d | |||
| 82716a4f4f | |||
| 9476f9ec31 | |||
| dc787ac130 | |||
| 9525394a6e | |||
| fc93255503 | |||
| cadf500400 | |||
| 780614e1e7 | |||
| f32920c564 | |||
| 123e8e90a1 | |||
| 0323c888b3 | |||
| 1bb6d3b731 | |||
| 4dc5819c4e | |||
| 5d4fa6fba7 | |||
| b6675af9cb | |||
| 23a914d2c9 | |||
| e8822deeac | |||
| 29ecdb6883 | |||
| 90aa5875b5 | |||
| 0fccf706a1 | |||
| fd9cd49844 | |||
| 3c3c6a1301 | |||
| a2179787b9 | |||
| 8c06df9110 | |||
| ef7a2c0896 | |||
| 14f280baef | |||
| 196fb6d3d1 | |||
| cc355d7d4f | |||
| af90ae5fba | |||
| c8480b3c83 | |||
| fe32ebc4d7 | |||
| 2280957ea9 | |||
| 944d59d9a3 | |||
| 79ecff971b | |||
| 1f0e6516fd | |||
| 692f3d8f8c | |||
| 6d41d51694 | |||
| 5f23bdadcf | |||
| d3555b6fca | |||
| b5cdc0afeb | |||
| 3858156393 | |||
| 6279c5c3a9 | |||
| f58a57c6cd | |||
| d00ebfd7ed | |||
| ab279bd284 | |||
| 89c4932cd7 | |||
| c577f625c2 | |||
| 58624f4037 | |||
| c9249dc71b | |||
| 5e4f1ca35f | |||
| 0d8fdb5904 | |||
| 92a18e3495 | |||
| e929646e8e | |||
| 6315d13d18 | |||
| ee527bb36f | |||
| 86514d1770 | |||
| 9e8ed1e911 | |||
| f3c3c7939c | |||
| 361ed37362 | |||
| ed3128b940 | |||
| 6bbd68a135 | |||
| 06d322b5b3 | |||
| 5497ee9119 | |||
| 0aa78e3560 | |||
| 41ad37b3bb | |||
| 0104d09509 | |||
| b4f5e40f12 | |||
| 7107b17f19 | |||
| 42e1fd917e | |||
| 9e6fcdbe6f | |||
| a24d8aa222 | |||
| 0e5c9ff14b | |||
| f8977d8840 | |||
| bb9768f3a1 | |||
| b3d6930142 | |||
| 5254be44be | |||
| 207e0d6abd | |||
| 968d23380f | |||
| fff9e2e897 | |||
| 3e4e777d8d | |||
| 7f906d400f | |||
| c1161a3bca | |||
| ac512e3a27 | |||
| 730b628fe3 | |||
| 701edc5c6a | |||
| e7688762b8 | |||
| a7a71bf49a | |||
| ac7212ca00 | |||
| 298e557260 | |||
| 7ba791f906 | |||
| 4a6a12baae | |||
| f1dda5da3c | |||
| 3ab96e2d0d | |||
| 970c519a32 | |||
| 188920ec7f | |||
| dcfc4ea32f | |||
| a8c02176d3 | |||
| 1665d47a25 | |||
| 0b2f1e6ab6 | |||
| bcd9245502 | |||
| 59da9b295b | |||
| 99d7d5e7e7 | |||
| e4c60f1606 | |||
| 77f1bef862 | |||
| f16c139362 | |||
| c94cdca6eb | |||
| dcdf80112d | |||
| eb836c5b74 | |||
| de680c6771 | |||
|
|
bcef58a46b | ||
|
|
0dc8cdbce5 | ||
|
|
dbdbaa9802 | ||
|
|
5edcf93371 | ||
|
|
b0be76c62b | ||
| 75a77389a8 | |||
| 0bbced3d58 | |||
| 244209093e | |||
| 54a68d635d | |||
| d7a5cb5a64 | |||
| 6124f89cb0 | |||
| 810a527cc1 | |||
| 0a2dff0c6d | |||
| 382c376c03 | |||
| 84b7d663bc | |||
| 623232b67e | |||
| d5df6cfb9d | |||
| 10b9548c29 | |||
| fa1a136ef1 | |||
| d20cb62139 | |||
| f2418d0395 | |||
| 460a85944a | |||
| 7e2fa02d07 | |||
| 873855937f | |||
| 1cdd2644df | |||
| 532540b74f | |||
| 9ba4ca43e2 | |||
| 8bcaf3f254 | |||
| 0d5c90323a | |||
| 5b01b15216 | |||
| 4f18f505f4 | |||
| 2d3566a01a | |||
| 22f2cd4e59 | |||
| 1683234376 | |||
| 69d99b4189 | |||
| 4a5e0ef2f3 | |||
| 79731a9704 | |||
| bd53d099d1 | |||
| de61f5de88 | |||
| 0527d43dd2 | |||
| e3511cd96b | |||
| d355d3c9b7 | |||
| 5bb13aa4a6 | |||
| 655f5e2ce0 | |||
| 9014d78a7d | |||
| 1c026e7f49 | |||
| d32b3902c9 | |||
| e5f3aff39a | |||
| 11ec02ef68 | |||
| cad19935d5 | |||
| 47f88f167f | |||
| 9d6c335799 | |||
| cbaf552e7a | |||
| a4975a4578 | |||
| 725d02d152 | |||
| ae7118e89a | |||
| cad3bb5b75 | |||
| 269d7d56ff | |||
| 403c023191 | |||
| 3f7a8e04d4 | |||
| 0abbd24b86 | |||
| 21f1975fbc | |||
| d6f072904e | |||
| 6fc491a0d6 | |||
| 7bc9db03f0 | |||
| 641f0f2856 | |||
| ef5439d204 | |||
| c2093c2aca | |||
| a39f7bb0c9 | |||
| 6d73ec7f24 | |||
| 24d4bee85b | |||
| a1bde013e6 | |||
| 23f951167b | |||
| 26505fd5c9 | |||
| 28fff8db8a | |||
| fa15bc2333 | |||
| 113c64279f | |||
| 81cc6709d6 | |||
| 571c0a5360 | |||
|
|
eefdea2de9 | ||
| f7e6b0a398 | |||
| 68a83b052a | |||
| d689eee7fa | |||
| f6442af30c | |||
| b98f57fcf8 | |||
| 77aad985fa | |||
|
|
f8ebf76f92 | ||
| 6da9828e5c | |||
| 3ba45790e7 | |||
| e440e97948 | |||
|
|
938c73c810 | ||
| a8520c8c96 | |||
| debdc58646 | |||
| 8b36c086ef | |||
| 1f5e5d0611 | |||
| bbc1c601c9 | |||
| 5ab3195956 | |||
| 1f1983480a | |||
| 2fcd86cf12 | |||
| 2c83d00c00 | |||
|
|
ccac0ca6d0 | ||
| 4c9c7410f0 | |||
| eef13db3aa | |||
| 27bbe899ab | |||
| 79002de9a5 | |||
| 17f68a8e5e | |||
| c415fa1c0c | |||
| b8ec6f42df | |||
| 3f67d7f3f9 | |||
| 2dae8a3a63 | |||
| 47aae730c7 | |||
| aa808e950a | |||
| 7dd43b7841 | |||
| 82a3744d48 | |||
| 3839e4d838 | |||
| a66ebc43d9 | |||
| 45bbda8185 | |||
| 2db6bf2729 | |||
| 3097eb7fca | |||
| efb6ac5192 | |||
| 27fe615447 | |||
| c40fcdac9d | |||
| c674c76bd0 | |||
| 1292e0f585 | |||
| 3abb4cdda7 | |||
| c6e8976456 | |||
| 19115a837c | |||
| 0a200abec6 | |||
| c80fe33e6d | |||
|
|
edc5cb97ba | ||
| 059228ca52 | |||
| 861b83cda2 | |||
| 97888626b6 | |||
| 781bb489bd | |||
| 1712205222 | |||
| 51324f6dca | |||
| 531edcd3cc | |||
| c66ff52d94 | |||
|
|
195c082cd7 | ||
| 16005ef30d | |||
| c15f7b4874 |
25
.dockerignore
Normal file
25
.dockerignore
Normal 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
|
||||
28
.github/workflows/dotnet.yml
vendored
Normal file
28
.github/workflows/dotnet.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
# This workflow will build a .NET project
|
||||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
|
||||
|
||||
name: .NET
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "preview" ]
|
||||
pull_request:
|
||||
branches: [ "preview" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
- name: Build
|
||||
run: dotnet build --no-restore
|
||||
- name: Test
|
||||
run: dotnet test --no-build --verbosity normal
|
||||
103
.gitignore
vendored
103
.gitignore
vendored
@@ -29,10 +29,8 @@ x86/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Oo]ut/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
[Dd]ata/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
@@ -64,6 +62,9 @@ project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# Tye
|
||||
.tye/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
@@ -362,3 +363,101 @@ MigrationBackup/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
|
||||
##
|
||||
## Visual studio for Mac
|
||||
##
|
||||
|
||||
|
||||
# globs
|
||||
Makefile.in
|
||||
*.userprefs
|
||||
*.usertasks
|
||||
config.make
|
||||
config.status
|
||||
aclocal.m4
|
||||
install-sh
|
||||
autom4te.cache/
|
||||
*.tar.gz
|
||||
tarballs/
|
||||
test-results/
|
||||
|
||||
# Mac bundle stuff
|
||||
*.dmg
|
||||
*.app
|
||||
|
||||
# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Dump file
|
||||
*.stackdump
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
# JetBrains Rider
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
||||
##
|
||||
## Visual Studio Code
|
||||
##
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
|
||||
/DiscordBotWebUI/Data
|
||||
/DiscordBot/Data
|
||||
/WebUI/Data
|
||||
/WebUI_Old/Data
|
||||
/WebUI/bin
|
||||
/WebUI_Old/bin
|
||||
Data/
|
||||
/WebUI/Libraries
|
||||
13
.idea/.idea.DiscordBotWithAPI/.idea/.gitignore
generated
vendored
13
.idea/.idea.DiscordBotWithAPI/.idea/.gitignore
generated
vendored
@@ -1,13 +0,0 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Rider ignored files
|
||||
/modules.xml
|
||||
/contentModel.xml
|
||||
/.idea.DiscordBotWithAPI.iml
|
||||
/projectSettingsUpdater.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
13
.idea/.idea.DiscordBotWithAPI/.idea/avalonia.xml
generated
13
.idea/.idea.DiscordBotWithAPI/.idea/avalonia.xml
generated
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AvaloniaProject">
|
||||
<option name="projectPerEditor">
|
||||
<map>
|
||||
<entry key="DiscordBotGUI/App.axaml" value="DiscordBotGUI/DiscordBotGUI.csproj" />
|
||||
<entry key="DiscordBotGUI/AppUpdater.axaml" value="DiscordBotGUI/DiscordBotGUI.csproj" />
|
||||
<entry key="DiscordBotGUI/Settings/Commands.axaml" value="DiscordBotGUI/DiscordBotGUI.csproj" />
|
||||
<entry key="DiscordBotGUI/Settings/Events.axaml" value="DiscordBotGUI/DiscordBotGUI.csproj" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||
</project>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="UserContentModel">
|
||||
<attachedFolders />
|
||||
<explicitIncludes />
|
||||
<explicitExcludes />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/.idea.DiscordBotWithAPI/.idea/vcs.xml
generated
6
.idea/.idea.DiscordBotWithAPI/.idea/vcs.xml
generated
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
26
.vscode/launch.json
vendored
26
.vscode/launch.json
vendored
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
// Use IntelliSense to find out which attributes exist for C# debugging
|
||||
// Use hover for the description of the existing attributes
|
||||
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
|
||||
"name": ".NET Core Launch (console)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
// If you have changed target frameworks, make sure to update the program path.
|
||||
"program": "${workspaceFolder}/DiscordBot/bin/Debug/net5.0/DiscordBot.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/DiscordBot",
|
||||
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
|
||||
"console": "internalConsole",
|
||||
"stopAtEntry": false
|
||||
},
|
||||
{
|
||||
"name": ".NET Core Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach"
|
||||
}
|
||||
]
|
||||
}
|
||||
5
.vscode/solution-explorer/class.cs-template
vendored
5
.vscode/solution-explorer/class.cs-template
vendored
@@ -1,5 +0,0 @@
|
||||
namespace {{namespace}};
|
||||
|
||||
public class {{name}}
|
||||
{
|
||||
}
|
||||
3
.vscode/solution-explorer/class.ts-template
vendored
3
.vscode/solution-explorer/class.ts-template
vendored
@@ -1,3 +0,0 @@
|
||||
export class {{name}} {
|
||||
|
||||
}
|
||||
9
.vscode/solution-explorer/class.vb-template
vendored
9
.vscode/solution-explorer/class.vb-template
vendored
@@ -1,9 +0,0 @@
|
||||
Imports System
|
||||
|
||||
Namespace {{namespace}}
|
||||
|
||||
Public Class {{name}}
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@@ -1,3 +0,0 @@
|
||||
export default {{name}} {
|
||||
|
||||
}
|
||||
5
.vscode/solution-explorer/enum.cs-template
vendored
5
.vscode/solution-explorer/enum.cs-template
vendored
@@ -1,5 +0,0 @@
|
||||
namespace {{namespace}};
|
||||
|
||||
public enum {{name}}
|
||||
{
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
namespace {{namespace}};
|
||||
|
||||
public interface {{name}}
|
||||
{
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
export interface {{name}} {
|
||||
|
||||
}
|
||||
46
.vscode/solution-explorer/template-list.json
vendored
46
.vscode/solution-explorer/template-list.json
vendored
@@ -1,46 +0,0 @@
|
||||
{
|
||||
"templates": [
|
||||
{
|
||||
"name": "Class",
|
||||
"extension": "cs",
|
||||
"file": "./class.cs-template",
|
||||
"parameters": "./template-parameters.js"
|
||||
},
|
||||
{
|
||||
"name": "Interface",
|
||||
"extension": "cs",
|
||||
"file": "./interface.cs-template",
|
||||
"parameters": "./template-parameters.js"
|
||||
},
|
||||
{
|
||||
"name": "Enum",
|
||||
"extension": "cs",
|
||||
"file": "./enum.cs-template",
|
||||
"parameters": "./template-parameters.js"
|
||||
},
|
||||
{
|
||||
"name": "Class",
|
||||
"extension": "ts",
|
||||
"file": "./class.ts-template",
|
||||
"parameters": "./template-parameters.js"
|
||||
},
|
||||
{
|
||||
"name": "Interface",
|
||||
"extension": "ts",
|
||||
"file": "./interface.ts-template",
|
||||
"parameters": "./template-parameters.js"
|
||||
},
|
||||
{
|
||||
"name": "Default",
|
||||
"extension": "ts",
|
||||
"file": "./default.ts-template",
|
||||
"parameters": "./template-parameters.js"
|
||||
},
|
||||
{
|
||||
"name": "Class",
|
||||
"extension": "vb",
|
||||
"file": "./class.vb-template",
|
||||
"parameters": "./template-parameters.js"
|
||||
}
|
||||
]
|
||||
}
|
||||
17
.vscode/solution-explorer/template-parameters.js
vendored
17
.vscode/solution-explorer/template-parameters.js
vendored
@@ -1,17 +0,0 @@
|
||||
var path = require("path");
|
||||
|
||||
module.exports = function(filename, projectPath, folderPath) {
|
||||
var namespace = "Unknown";
|
||||
if (projectPath) {
|
||||
namespace = path.basename(projectPath, path.extname(projectPath));
|
||||
if (folderPath) {
|
||||
namespace += "." + folderPath.replace(path.dirname(projectPath), "").substring(1).replace(/[\\\/]/g, ".");
|
||||
}
|
||||
namespace = namespace.replace(/[\\\-]/g, "_");
|
||||
}
|
||||
|
||||
return {
|
||||
namespace: namespace,
|
||||
name: path.basename(filename, path.extname(filename))
|
||||
}
|
||||
};
|
||||
42
.vscode/tasks.json
vendored
42
.vscode/tasks.json
vendored
@@ -1,42 +0,0 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"build",
|
||||
"${workspaceFolder}/DiscordBot/DiscordBot.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "publish",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"publish",
|
||||
"${workspaceFolder}/DiscordBot/DiscordBot.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "watch",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"watch",
|
||||
"run",
|
||||
"${workspaceFolder}/DiscordBot/DiscordBot.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,268 +0,0 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v5.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v5.0": {
|
||||
"CMD_LevelingSystem/1.0.0": {
|
||||
"dependencies": {
|
||||
"PluginManager": "1.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"CMD_LevelingSystem.dll": {}
|
||||
}
|
||||
},
|
||||
"Discord.Net/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Commands": "3.5.0",
|
||||
"Discord.Net.Core": "3.5.0",
|
||||
"Discord.Net.Interactions": "3.5.0",
|
||||
"Discord.Net.Rest": "3.5.0",
|
||||
"Discord.Net.WebSocket": "3.5.0",
|
||||
"Discord.Net.Webhook": "3.5.0"
|
||||
}
|
||||
},
|
||||
"Discord.Net.Commands/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Commands.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Core/3.5.0": {
|
||||
"dependencies": {
|
||||
"Newtonsoft.Json": "13.0.1",
|
||||
"System.Collections.Immutable": "5.0.0",
|
||||
"System.Interactive.Async": "5.0.0",
|
||||
"System.ValueTuple": "4.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Core.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Interactions/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0",
|
||||
"Discord.Net.Rest": "3.5.0",
|
||||
"Discord.Net.WebSocket": "3.5.0",
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "5.0.0",
|
||||
"System.Collections.Immutable": "5.0.0",
|
||||
"System.Reactive": "5.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Interactions.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Rest/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Rest.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Webhook/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0",
|
||||
"Discord.Net.Rest": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Webhook.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.WebSocket/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0",
|
||||
"Discord.Net.Rest": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.WebSocket.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions/5.0.0": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.20.51904"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Newtonsoft.Json/13.0.1": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Newtonsoft.Json.dll": {
|
||||
"assemblyVersion": "13.0.0.0",
|
||||
"fileVersion": "13.0.1.25517"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Collections.Immutable/5.0.0": {},
|
||||
"System.Interactive.Async/5.0.0": {
|
||||
"dependencies": {
|
||||
"System.Linq.Async": "5.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netcoreapp3.1/System.Interactive.Async.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.0.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Linq.Async/5.0.0": {
|
||||
"runtime": {
|
||||
"lib/netcoreapp3.1/System.Linq.Async.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.0.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Reactive/5.0.0": {
|
||||
"runtime": {
|
||||
"lib/net5.0/System.Reactive.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.0.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.ValueTuple/4.5.0": {},
|
||||
"PluginManager/1.0.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"PluginManager.dll": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"CMD_LevelingSystem/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"Discord.Net/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-IUtexpvogudb1rllKBWkIEpBVQoToMjtVo81KPkt+gNMe7KtRDcZJgcn6+72viMtyw0e95OJPXFV5VEA/n2OQQ==",
|
||||
"path": "discord.net/3.5.0",
|
||||
"hashPath": "discord.net.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Commands/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ClTv8aiTlitvS48YatRiTLvgE2f2uKgmHNPVBIuvJBHZO2u4bZCzoN1fid+pZn2sbVOkt8uftlLGzz5DSZlFIA==",
|
||||
"path": "discord.net.commands/3.5.0",
|
||||
"hashPath": "discord.net.commands.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Core/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-rCzzaznMVQ+bLMxOpYwTyqm9V22kMy6BxlQisSxemHZDe2Jedz3Clp/a0dToACLz+Dlp3u+jYUfCBnTz7L6f4g==",
|
||||
"path": "discord.net.core/3.5.0",
|
||||
"hashPath": "discord.net.core.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Interactions/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-wE9+V9DJ7r+1s4euOi4sGPIAt4sD7r+Tk5s9mrlbLCHVQTK4KllAvcrL25bPFI38FuFceREEzFoRlTrekSyB2Q==",
|
||||
"path": "discord.net.interactions/3.5.0",
|
||||
"hashPath": "discord.net.interactions.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Rest/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-BnTdLFuuQsKvCv08VQrD4X1Hw2Xp+MELIRQiDiKfG01IiQlRTN+1gc3LB1zXgn5xBvC0HXjHxwV22GrMD9uKHQ==",
|
||||
"path": "discord.net.rest/3.5.0",
|
||||
"hashPath": "discord.net.rest.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Webhook/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-vCIGZS+m88sQDuFmdbUqg+2RIXS/NJWx8ei3MX+ZEYiAvOkDgQfkIlEnU1NKpds6ivTt5GFlv6UzcWubb5VJ1w==",
|
||||
"path": "discord.net.webhook/3.5.0",
|
||||
"hashPath": "discord.net.webhook.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.WebSocket/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-LjBOvcP40vJ+dhOtBDi8haEeblPAKpAIqR04NBzTM1/0RVavJZH89ovfSQIk42ygkiOaDV4E2x0Mmh6DRoIYcw==",
|
||||
"path": "discord.net.websocket/3.5.0",
|
||||
"hashPath": "discord.net.websocket.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ORj7Zh81gC69TyvmcUm9tSzytcy8AVousi+IVRAI8nLieQjOFryRusSFh7+aLk16FN9pQNqJAiMd7BTKINK0kA==",
|
||||
"path": "microsoft.extensions.dependencyinjection.abstractions/5.0.0",
|
||||
"hashPath": "microsoft.extensions.dependencyinjection.abstractions.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"Newtonsoft.Json/13.0.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==",
|
||||
"path": "newtonsoft.json/13.0.1",
|
||||
"hashPath": "newtonsoft.json.13.0.1.nupkg.sha512"
|
||||
},
|
||||
"System.Collections.Immutable/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==",
|
||||
"path": "system.collections.immutable/5.0.0",
|
||||
"hashPath": "system.collections.immutable.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Interactive.Async/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-QaqhQVDiULcu4vm6o89+iP329HcK44cETHOYgy/jfEjtzeFy0ZxmuM7nel9ocjnKxEM4yh1mli7hgh8Q9o+/Iw==",
|
||||
"path": "system.interactive.async/5.0.0",
|
||||
"hashPath": "system.interactive.async.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Linq.Async/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-cPtIuuH8TIjVHSi2ewwReWGW1PfChPE0LxPIDlfwVcLuTM9GANFTXiMB7k3aC4sk3f0cQU25LNKzx+jZMxijqw==",
|
||||
"path": "system.linq.async/5.0.0",
|
||||
"hashPath": "system.linq.async.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Reactive/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-erBZjkQHWL9jpasCE/0qKAryzVBJFxGHVBAvgRN1bzM0q2s1S4oYREEEL0Vb+1kA/6BKb5FjUZMp5VXmy+gzkQ==",
|
||||
"path": "system.reactive/5.0.0",
|
||||
"hashPath": "system.reactive.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.ValueTuple/4.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-okurQJO6NRE/apDIP23ajJ0hpiNmJ+f0BwOlB/cSqTLQlw5upkf+5+96+iG2Jw40G1fCVCyPz/FhIABUjMR+RQ==",
|
||||
"path": "system.valuetuple/4.5.0",
|
||||
"hashPath": "system.valuetuple.4.5.0.nupkg.sha512"
|
||||
},
|
||||
"PluginManager/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,268 +0,0 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v5.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v5.0": {
|
||||
"CMD_Utils/1.0.0": {
|
||||
"dependencies": {
|
||||
"PluginManager": "1.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"CMD_Utils.dll": {}
|
||||
}
|
||||
},
|
||||
"Discord.Net/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Commands": "3.5.0",
|
||||
"Discord.Net.Core": "3.5.0",
|
||||
"Discord.Net.Interactions": "3.5.0",
|
||||
"Discord.Net.Rest": "3.5.0",
|
||||
"Discord.Net.WebSocket": "3.5.0",
|
||||
"Discord.Net.Webhook": "3.5.0"
|
||||
}
|
||||
},
|
||||
"Discord.Net.Commands/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Commands.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Core/3.5.0": {
|
||||
"dependencies": {
|
||||
"Newtonsoft.Json": "13.0.1",
|
||||
"System.Collections.Immutable": "5.0.0",
|
||||
"System.Interactive.Async": "5.0.0",
|
||||
"System.ValueTuple": "4.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Core.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Interactions/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0",
|
||||
"Discord.Net.Rest": "3.5.0",
|
||||
"Discord.Net.WebSocket": "3.5.0",
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "5.0.0",
|
||||
"System.Collections.Immutable": "5.0.0",
|
||||
"System.Reactive": "5.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Interactions.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Rest/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Rest.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Webhook/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0",
|
||||
"Discord.Net.Rest": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Webhook.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.WebSocket/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0",
|
||||
"Discord.Net.Rest": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.WebSocket.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions/5.0.0": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.20.51904"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Newtonsoft.Json/13.0.1": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Newtonsoft.Json.dll": {
|
||||
"assemblyVersion": "13.0.0.0",
|
||||
"fileVersion": "13.0.1.25517"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Collections.Immutable/5.0.0": {},
|
||||
"System.Interactive.Async/5.0.0": {
|
||||
"dependencies": {
|
||||
"System.Linq.Async": "5.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netcoreapp3.1/System.Interactive.Async.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.0.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Linq.Async/5.0.0": {
|
||||
"runtime": {
|
||||
"lib/netcoreapp3.1/System.Linq.Async.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.0.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Reactive/5.0.0": {
|
||||
"runtime": {
|
||||
"lib/net5.0/System.Reactive.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.0.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.ValueTuple/4.5.0": {},
|
||||
"PluginManager/1.0.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"PluginManager.dll": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"CMD_Utils/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"Discord.Net/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-IUtexpvogudb1rllKBWkIEpBVQoToMjtVo81KPkt+gNMe7KtRDcZJgcn6+72viMtyw0e95OJPXFV5VEA/n2OQQ==",
|
||||
"path": "discord.net/3.5.0",
|
||||
"hashPath": "discord.net.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Commands/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ClTv8aiTlitvS48YatRiTLvgE2f2uKgmHNPVBIuvJBHZO2u4bZCzoN1fid+pZn2sbVOkt8uftlLGzz5DSZlFIA==",
|
||||
"path": "discord.net.commands/3.5.0",
|
||||
"hashPath": "discord.net.commands.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Core/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-rCzzaznMVQ+bLMxOpYwTyqm9V22kMy6BxlQisSxemHZDe2Jedz3Clp/a0dToACLz+Dlp3u+jYUfCBnTz7L6f4g==",
|
||||
"path": "discord.net.core/3.5.0",
|
||||
"hashPath": "discord.net.core.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Interactions/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-wE9+V9DJ7r+1s4euOi4sGPIAt4sD7r+Tk5s9mrlbLCHVQTK4KllAvcrL25bPFI38FuFceREEzFoRlTrekSyB2Q==",
|
||||
"path": "discord.net.interactions/3.5.0",
|
||||
"hashPath": "discord.net.interactions.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Rest/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-BnTdLFuuQsKvCv08VQrD4X1Hw2Xp+MELIRQiDiKfG01IiQlRTN+1gc3LB1zXgn5xBvC0HXjHxwV22GrMD9uKHQ==",
|
||||
"path": "discord.net.rest/3.5.0",
|
||||
"hashPath": "discord.net.rest.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Webhook/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-vCIGZS+m88sQDuFmdbUqg+2RIXS/NJWx8ei3MX+ZEYiAvOkDgQfkIlEnU1NKpds6ivTt5GFlv6UzcWubb5VJ1w==",
|
||||
"path": "discord.net.webhook/3.5.0",
|
||||
"hashPath": "discord.net.webhook.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.WebSocket/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-LjBOvcP40vJ+dhOtBDi8haEeblPAKpAIqR04NBzTM1/0RVavJZH89ovfSQIk42ygkiOaDV4E2x0Mmh6DRoIYcw==",
|
||||
"path": "discord.net.websocket/3.5.0",
|
||||
"hashPath": "discord.net.websocket.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ORj7Zh81gC69TyvmcUm9tSzytcy8AVousi+IVRAI8nLieQjOFryRusSFh7+aLk16FN9pQNqJAiMd7BTKINK0kA==",
|
||||
"path": "microsoft.extensions.dependencyinjection.abstractions/5.0.0",
|
||||
"hashPath": "microsoft.extensions.dependencyinjection.abstractions.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"Newtonsoft.Json/13.0.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==",
|
||||
"path": "newtonsoft.json/13.0.1",
|
||||
"hashPath": "newtonsoft.json.13.0.1.nupkg.sha512"
|
||||
},
|
||||
"System.Collections.Immutable/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==",
|
||||
"path": "system.collections.immutable/5.0.0",
|
||||
"hashPath": "system.collections.immutable.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Interactive.Async/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-QaqhQVDiULcu4vm6o89+iP329HcK44cETHOYgy/jfEjtzeFy0ZxmuM7nel9ocjnKxEM4yh1mli7hgh8Q9o+/Iw==",
|
||||
"path": "system.interactive.async/5.0.0",
|
||||
"hashPath": "system.interactive.async.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Linq.Async/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-cPtIuuH8TIjVHSi2ewwReWGW1PfChPE0LxPIDlfwVcLuTM9GANFTXiMB7k3aC4sk3f0cQU25LNKzx+jZMxijqw==",
|
||||
"path": "system.linq.async/5.0.0",
|
||||
"hashPath": "system.linq.async.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Reactive/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-erBZjkQHWL9jpasCE/0qKAryzVBJFxGHVBAvgRN1bzM0q2s1S4oYREEEL0Vb+1kA/6BKb5FjUZMp5VXmy+gzkQ==",
|
||||
"path": "system.reactive/5.0.0",
|
||||
"hashPath": "system.reactive.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.ValueTuple/4.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-okurQJO6NRE/apDIP23ajJ0hpiNmJ+f0BwOlB/cSqTLQlw5upkf+5+96+iG2Jw40G1fCVCyPz/FhIABUjMR+RQ==",
|
||||
"path": "system.valuetuple/4.5.0",
|
||||
"hashPath": "system.valuetuple.4.5.0.nupkg.sha512"
|
||||
},
|
||||
"PluginManager/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,268 +0,0 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v5.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v5.0": {
|
||||
"EVE_LevelingSystem/1.0.0": {
|
||||
"dependencies": {
|
||||
"PluginManager": "1.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"EVE_LevelingSystem.dll": {}
|
||||
}
|
||||
},
|
||||
"Discord.Net/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Commands": "3.5.0",
|
||||
"Discord.Net.Core": "3.5.0",
|
||||
"Discord.Net.Interactions": "3.5.0",
|
||||
"Discord.Net.Rest": "3.5.0",
|
||||
"Discord.Net.WebSocket": "3.5.0",
|
||||
"Discord.Net.Webhook": "3.5.0"
|
||||
}
|
||||
},
|
||||
"Discord.Net.Commands/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Commands.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Core/3.5.0": {
|
||||
"dependencies": {
|
||||
"Newtonsoft.Json": "13.0.1",
|
||||
"System.Collections.Immutable": "5.0.0",
|
||||
"System.Interactive.Async": "5.0.0",
|
||||
"System.ValueTuple": "4.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Core.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Interactions/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0",
|
||||
"Discord.Net.Rest": "3.5.0",
|
||||
"Discord.Net.WebSocket": "3.5.0",
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "5.0.0",
|
||||
"System.Collections.Immutable": "5.0.0",
|
||||
"System.Reactive": "5.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Interactions.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Rest/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Rest.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Webhook/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0",
|
||||
"Discord.Net.Rest": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Webhook.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.WebSocket/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0",
|
||||
"Discord.Net.Rest": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.WebSocket.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions/5.0.0": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.20.51904"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Newtonsoft.Json/13.0.1": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Newtonsoft.Json.dll": {
|
||||
"assemblyVersion": "13.0.0.0",
|
||||
"fileVersion": "13.0.1.25517"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Collections.Immutable/5.0.0": {},
|
||||
"System.Interactive.Async/5.0.0": {
|
||||
"dependencies": {
|
||||
"System.Linq.Async": "5.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netcoreapp3.1/System.Interactive.Async.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.0.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Linq.Async/5.0.0": {
|
||||
"runtime": {
|
||||
"lib/netcoreapp3.1/System.Linq.Async.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.0.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Reactive/5.0.0": {
|
||||
"runtime": {
|
||||
"lib/net5.0/System.Reactive.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.0.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.ValueTuple/4.5.0": {},
|
||||
"PluginManager/1.0.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"PluginManager.dll": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"EVE_LevelingSystem/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"Discord.Net/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-IUtexpvogudb1rllKBWkIEpBVQoToMjtVo81KPkt+gNMe7KtRDcZJgcn6+72viMtyw0e95OJPXFV5VEA/n2OQQ==",
|
||||
"path": "discord.net/3.5.0",
|
||||
"hashPath": "discord.net.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Commands/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ClTv8aiTlitvS48YatRiTLvgE2f2uKgmHNPVBIuvJBHZO2u4bZCzoN1fid+pZn2sbVOkt8uftlLGzz5DSZlFIA==",
|
||||
"path": "discord.net.commands/3.5.0",
|
||||
"hashPath": "discord.net.commands.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Core/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-rCzzaznMVQ+bLMxOpYwTyqm9V22kMy6BxlQisSxemHZDe2Jedz3Clp/a0dToACLz+Dlp3u+jYUfCBnTz7L6f4g==",
|
||||
"path": "discord.net.core/3.5.0",
|
||||
"hashPath": "discord.net.core.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Interactions/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-wE9+V9DJ7r+1s4euOi4sGPIAt4sD7r+Tk5s9mrlbLCHVQTK4KllAvcrL25bPFI38FuFceREEzFoRlTrekSyB2Q==",
|
||||
"path": "discord.net.interactions/3.5.0",
|
||||
"hashPath": "discord.net.interactions.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Rest/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-BnTdLFuuQsKvCv08VQrD4X1Hw2Xp+MELIRQiDiKfG01IiQlRTN+1gc3LB1zXgn5xBvC0HXjHxwV22GrMD9uKHQ==",
|
||||
"path": "discord.net.rest/3.5.0",
|
||||
"hashPath": "discord.net.rest.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Webhook/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-vCIGZS+m88sQDuFmdbUqg+2RIXS/NJWx8ei3MX+ZEYiAvOkDgQfkIlEnU1NKpds6ivTt5GFlv6UzcWubb5VJ1w==",
|
||||
"path": "discord.net.webhook/3.5.0",
|
||||
"hashPath": "discord.net.webhook.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.WebSocket/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-LjBOvcP40vJ+dhOtBDi8haEeblPAKpAIqR04NBzTM1/0RVavJZH89ovfSQIk42ygkiOaDV4E2x0Mmh6DRoIYcw==",
|
||||
"path": "discord.net.websocket/3.5.0",
|
||||
"hashPath": "discord.net.websocket.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ORj7Zh81gC69TyvmcUm9tSzytcy8AVousi+IVRAI8nLieQjOFryRusSFh7+aLk16FN9pQNqJAiMd7BTKINK0kA==",
|
||||
"path": "microsoft.extensions.dependencyinjection.abstractions/5.0.0",
|
||||
"hashPath": "microsoft.extensions.dependencyinjection.abstractions.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"Newtonsoft.Json/13.0.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==",
|
||||
"path": "newtonsoft.json/13.0.1",
|
||||
"hashPath": "newtonsoft.json.13.0.1.nupkg.sha512"
|
||||
},
|
||||
"System.Collections.Immutable/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==",
|
||||
"path": "system.collections.immutable/5.0.0",
|
||||
"hashPath": "system.collections.immutable.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Interactive.Async/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-QaqhQVDiULcu4vm6o89+iP329HcK44cETHOYgy/jfEjtzeFy0ZxmuM7nel9ocjnKxEM4yh1mli7hgh8Q9o+/Iw==",
|
||||
"path": "system.interactive.async/5.0.0",
|
||||
"hashPath": "system.interactive.async.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Linq.Async/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-cPtIuuH8TIjVHSi2ewwReWGW1PfChPE0LxPIDlfwVcLuTM9GANFTXiMB7k3aC4sk3f0cQU25LNKzx+jZMxijqw==",
|
||||
"path": "system.linq.async/5.0.0",
|
||||
"hashPath": "system.linq.async.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Reactive/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-erBZjkQHWL9jpasCE/0qKAryzVBJFxGHVBAvgRN1bzM0q2s1S4oYREEEL0Vb+1kA/6BKb5FjUZMp5VXmy+gzkQ==",
|
||||
"path": "system.reactive/5.0.0",
|
||||
"hashPath": "system.reactive.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.ValueTuple/4.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-okurQJO6NRE/apDIP23ajJ0hpiNmJ+f0BwOlB/cSqTLQlw5upkf+5+96+iG2Jw40G1fCVCyPz/FhIABUjMR+RQ==",
|
||||
"path": "system.valuetuple/4.5.0",
|
||||
"hashPath": "system.valuetuple.4.5.0.nupkg.sha512"
|
||||
},
|
||||
"PluginManager/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,268 +0,0 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v5.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v5.0": {
|
||||
"MusicCommands/1.0.0": {
|
||||
"dependencies": {
|
||||
"PluginManager": "1.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"MusicCommands.dll": {}
|
||||
}
|
||||
},
|
||||
"Discord.Net/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Commands": "3.5.0",
|
||||
"Discord.Net.Core": "3.5.0",
|
||||
"Discord.Net.Interactions": "3.5.0",
|
||||
"Discord.Net.Rest": "3.5.0",
|
||||
"Discord.Net.WebSocket": "3.5.0",
|
||||
"Discord.Net.Webhook": "3.5.0"
|
||||
}
|
||||
},
|
||||
"Discord.Net.Commands/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Commands.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Core/3.5.0": {
|
||||
"dependencies": {
|
||||
"Newtonsoft.Json": "13.0.1",
|
||||
"System.Collections.Immutable": "5.0.0",
|
||||
"System.Interactive.Async": "5.0.0",
|
||||
"System.ValueTuple": "4.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Core.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Interactions/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0",
|
||||
"Discord.Net.Rest": "3.5.0",
|
||||
"Discord.Net.WebSocket": "3.5.0",
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "5.0.0",
|
||||
"System.Collections.Immutable": "5.0.0",
|
||||
"System.Reactive": "5.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Interactions.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Rest/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Rest.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Webhook/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0",
|
||||
"Discord.Net.Rest": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Webhook.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.WebSocket/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0",
|
||||
"Discord.Net.Rest": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.WebSocket.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions/5.0.0": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.20.51904"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Newtonsoft.Json/13.0.1": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Newtonsoft.Json.dll": {
|
||||
"assemblyVersion": "13.0.0.0",
|
||||
"fileVersion": "13.0.1.25517"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Collections.Immutable/5.0.0": {},
|
||||
"System.Interactive.Async/5.0.0": {
|
||||
"dependencies": {
|
||||
"System.Linq.Async": "5.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netcoreapp3.1/System.Interactive.Async.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.0.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Linq.Async/5.0.0": {
|
||||
"runtime": {
|
||||
"lib/netcoreapp3.1/System.Linq.Async.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.0.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Reactive/5.0.0": {
|
||||
"runtime": {
|
||||
"lib/net5.0/System.Reactive.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.0.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.ValueTuple/4.5.0": {},
|
||||
"PluginManager/1.0.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"PluginManager.dll": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"MusicCommands/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"Discord.Net/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-IUtexpvogudb1rllKBWkIEpBVQoToMjtVo81KPkt+gNMe7KtRDcZJgcn6+72viMtyw0e95OJPXFV5VEA/n2OQQ==",
|
||||
"path": "discord.net/3.5.0",
|
||||
"hashPath": "discord.net.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Commands/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ClTv8aiTlitvS48YatRiTLvgE2f2uKgmHNPVBIuvJBHZO2u4bZCzoN1fid+pZn2sbVOkt8uftlLGzz5DSZlFIA==",
|
||||
"path": "discord.net.commands/3.5.0",
|
||||
"hashPath": "discord.net.commands.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Core/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-rCzzaznMVQ+bLMxOpYwTyqm9V22kMy6BxlQisSxemHZDe2Jedz3Clp/a0dToACLz+Dlp3u+jYUfCBnTz7L6f4g==",
|
||||
"path": "discord.net.core/3.5.0",
|
||||
"hashPath": "discord.net.core.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Interactions/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-wE9+V9DJ7r+1s4euOi4sGPIAt4sD7r+Tk5s9mrlbLCHVQTK4KllAvcrL25bPFI38FuFceREEzFoRlTrekSyB2Q==",
|
||||
"path": "discord.net.interactions/3.5.0",
|
||||
"hashPath": "discord.net.interactions.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Rest/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-BnTdLFuuQsKvCv08VQrD4X1Hw2Xp+MELIRQiDiKfG01IiQlRTN+1gc3LB1zXgn5xBvC0HXjHxwV22GrMD9uKHQ==",
|
||||
"path": "discord.net.rest/3.5.0",
|
||||
"hashPath": "discord.net.rest.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Webhook/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-vCIGZS+m88sQDuFmdbUqg+2RIXS/NJWx8ei3MX+ZEYiAvOkDgQfkIlEnU1NKpds6ivTt5GFlv6UzcWubb5VJ1w==",
|
||||
"path": "discord.net.webhook/3.5.0",
|
||||
"hashPath": "discord.net.webhook.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.WebSocket/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-LjBOvcP40vJ+dhOtBDi8haEeblPAKpAIqR04NBzTM1/0RVavJZH89ovfSQIk42ygkiOaDV4E2x0Mmh6DRoIYcw==",
|
||||
"path": "discord.net.websocket/3.5.0",
|
||||
"hashPath": "discord.net.websocket.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ORj7Zh81gC69TyvmcUm9tSzytcy8AVousi+IVRAI8nLieQjOFryRusSFh7+aLk16FN9pQNqJAiMd7BTKINK0kA==",
|
||||
"path": "microsoft.extensions.dependencyinjection.abstractions/5.0.0",
|
||||
"hashPath": "microsoft.extensions.dependencyinjection.abstractions.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"Newtonsoft.Json/13.0.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==",
|
||||
"path": "newtonsoft.json/13.0.1",
|
||||
"hashPath": "newtonsoft.json.13.0.1.nupkg.sha512"
|
||||
},
|
||||
"System.Collections.Immutable/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==",
|
||||
"path": "system.collections.immutable/5.0.0",
|
||||
"hashPath": "system.collections.immutable.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Interactive.Async/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-QaqhQVDiULcu4vm6o89+iP329HcK44cETHOYgy/jfEjtzeFy0ZxmuM7nel9ocjnKxEM4yh1mli7hgh8Q9o+/Iw==",
|
||||
"path": "system.interactive.async/5.0.0",
|
||||
"hashPath": "system.interactive.async.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Linq.Async/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-cPtIuuH8TIjVHSi2ewwReWGW1PfChPE0LxPIDlfwVcLuTM9GANFTXiMB7k3aC4sk3f0cQU25LNKzx+jZMxijqw==",
|
||||
"path": "system.linq.async/5.0.0",
|
||||
"hashPath": "system.linq.async.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Reactive/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-erBZjkQHWL9jpasCE/0qKAryzVBJFxGHVBAvgRN1bzM0q2s1S4oYREEEL0Vb+1kA/6BKb5FjUZMp5VXmy+gzkQ==",
|
||||
"path": "system.reactive/5.0.0",
|
||||
"hashPath": "system.reactive.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.ValueTuple/4.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-okurQJO6NRE/apDIP23ajJ0hpiNmJ+f0BwOlB/cSqTLQlw5upkf+5+96+iG2Jw40G1fCVCyPz/FhIABUjMR+RQ==",
|
||||
"path": "system.valuetuple/4.5.0",
|
||||
"hashPath": "system.valuetuple.4.5.0.nupkg.sha512"
|
||||
},
|
||||
"PluginManager/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,268 +0,0 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v5.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v5.0": {
|
||||
"StartupEvents/1.0.0": {
|
||||
"dependencies": {
|
||||
"PluginManager": "1.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"StartupEvents.dll": {}
|
||||
}
|
||||
},
|
||||
"Discord.Net/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Commands": "3.5.0",
|
||||
"Discord.Net.Core": "3.5.0",
|
||||
"Discord.Net.Interactions": "3.5.0",
|
||||
"Discord.Net.Rest": "3.5.0",
|
||||
"Discord.Net.WebSocket": "3.5.0",
|
||||
"Discord.Net.Webhook": "3.5.0"
|
||||
}
|
||||
},
|
||||
"Discord.Net.Commands/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Commands.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Core/3.5.0": {
|
||||
"dependencies": {
|
||||
"Newtonsoft.Json": "13.0.1",
|
||||
"System.Collections.Immutable": "5.0.0",
|
||||
"System.Interactive.Async": "5.0.0",
|
||||
"System.ValueTuple": "4.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Core.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Interactions/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0",
|
||||
"Discord.Net.Rest": "3.5.0",
|
||||
"Discord.Net.WebSocket": "3.5.0",
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "5.0.0",
|
||||
"System.Collections.Immutable": "5.0.0",
|
||||
"System.Reactive": "5.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Interactions.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Rest/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Rest.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Webhook/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0",
|
||||
"Discord.Net.Rest": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.Webhook.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.WebSocket/3.5.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.5.0",
|
||||
"Discord.Net.Rest": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0/Discord.Net.WebSocket.dll": {
|
||||
"assemblyVersion": "3.5.0.0",
|
||||
"fileVersion": "3.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions/5.0.0": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.20.51904"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Newtonsoft.Json/13.0.1": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Newtonsoft.Json.dll": {
|
||||
"assemblyVersion": "13.0.0.0",
|
||||
"fileVersion": "13.0.1.25517"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Collections.Immutable/5.0.0": {},
|
||||
"System.Interactive.Async/5.0.0": {
|
||||
"dependencies": {
|
||||
"System.Linq.Async": "5.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netcoreapp3.1/System.Interactive.Async.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.0.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Linq.Async/5.0.0": {
|
||||
"runtime": {
|
||||
"lib/netcoreapp3.1/System.Linq.Async.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.0.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Reactive/5.0.0": {
|
||||
"runtime": {
|
||||
"lib/net5.0/System.Reactive.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.0.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.ValueTuple/4.5.0": {},
|
||||
"PluginManager/1.0.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net": "3.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"PluginManager.dll": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"StartupEvents/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"Discord.Net/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-IUtexpvogudb1rllKBWkIEpBVQoToMjtVo81KPkt+gNMe7KtRDcZJgcn6+72viMtyw0e95OJPXFV5VEA/n2OQQ==",
|
||||
"path": "discord.net/3.5.0",
|
||||
"hashPath": "discord.net.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Commands/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ClTv8aiTlitvS48YatRiTLvgE2f2uKgmHNPVBIuvJBHZO2u4bZCzoN1fid+pZn2sbVOkt8uftlLGzz5DSZlFIA==",
|
||||
"path": "discord.net.commands/3.5.0",
|
||||
"hashPath": "discord.net.commands.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Core/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-rCzzaznMVQ+bLMxOpYwTyqm9V22kMy6BxlQisSxemHZDe2Jedz3Clp/a0dToACLz+Dlp3u+jYUfCBnTz7L6f4g==",
|
||||
"path": "discord.net.core/3.5.0",
|
||||
"hashPath": "discord.net.core.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Interactions/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-wE9+V9DJ7r+1s4euOi4sGPIAt4sD7r+Tk5s9mrlbLCHVQTK4KllAvcrL25bPFI38FuFceREEzFoRlTrekSyB2Q==",
|
||||
"path": "discord.net.interactions/3.5.0",
|
||||
"hashPath": "discord.net.interactions.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Rest/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-BnTdLFuuQsKvCv08VQrD4X1Hw2Xp+MELIRQiDiKfG01IiQlRTN+1gc3LB1zXgn5xBvC0HXjHxwV22GrMD9uKHQ==",
|
||||
"path": "discord.net.rest/3.5.0",
|
||||
"hashPath": "discord.net.rest.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Webhook/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-vCIGZS+m88sQDuFmdbUqg+2RIXS/NJWx8ei3MX+ZEYiAvOkDgQfkIlEnU1NKpds6ivTt5GFlv6UzcWubb5VJ1w==",
|
||||
"path": "discord.net.webhook/3.5.0",
|
||||
"hashPath": "discord.net.webhook.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.WebSocket/3.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-LjBOvcP40vJ+dhOtBDi8haEeblPAKpAIqR04NBzTM1/0RVavJZH89ovfSQIk42ygkiOaDV4E2x0Mmh6DRoIYcw==",
|
||||
"path": "discord.net.websocket/3.5.0",
|
||||
"hashPath": "discord.net.websocket.3.5.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ORj7Zh81gC69TyvmcUm9tSzytcy8AVousi+IVRAI8nLieQjOFryRusSFh7+aLk16FN9pQNqJAiMd7BTKINK0kA==",
|
||||
"path": "microsoft.extensions.dependencyinjection.abstractions/5.0.0",
|
||||
"hashPath": "microsoft.extensions.dependencyinjection.abstractions.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"Newtonsoft.Json/13.0.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==",
|
||||
"path": "newtonsoft.json/13.0.1",
|
||||
"hashPath": "newtonsoft.json.13.0.1.nupkg.sha512"
|
||||
},
|
||||
"System.Collections.Immutable/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==",
|
||||
"path": "system.collections.immutable/5.0.0",
|
||||
"hashPath": "system.collections.immutable.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Interactive.Async/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-QaqhQVDiULcu4vm6o89+iP329HcK44cETHOYgy/jfEjtzeFy0ZxmuM7nel9ocjnKxEM4yh1mli7hgh8Q9o+/Iw==",
|
||||
"path": "system.interactive.async/5.0.0",
|
||||
"hashPath": "system.interactive.async.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Linq.Async/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-cPtIuuH8TIjVHSi2ewwReWGW1PfChPE0LxPIDlfwVcLuTM9GANFTXiMB7k3aC4sk3f0cQU25LNKzx+jZMxijqw==",
|
||||
"path": "system.linq.async/5.0.0",
|
||||
"hashPath": "system.linq.async.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Reactive/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-erBZjkQHWL9jpasCE/0qKAryzVBJFxGHVBAvgRN1bzM0q2s1S4oYREEEL0Vb+1kA/6BKb5FjUZMp5VXmy+gzkQ==",
|
||||
"path": "system.reactive/5.0.0",
|
||||
"hashPath": "system.reactive.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.ValueTuple/4.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-okurQJO6NRE/apDIP23ajJ0hpiNmJ+f0BwOlB/cSqTLQlw5upkf+5+96+iG2Jw40G1fCVCyPz/FhIABUjMR+RQ==",
|
||||
"path": "system.valuetuple/4.5.0",
|
||||
"hashPath": "system.valuetuple.4.5.0.nupkg.sha512"
|
||||
},
|
||||
"PluginManager/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,268 +0,0 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v6.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v6.0": {
|
||||
"CMD_Utils/1.0.0": {
|
||||
"dependencies": {
|
||||
"PluginManager": "1.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"CMD_Utils.dll": {}
|
||||
}
|
||||
},
|
||||
"Discord.Net/3.6.1": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Commands": "3.6.1",
|
||||
"Discord.Net.Core": "3.6.1",
|
||||
"Discord.Net.Interactions": "3.6.1",
|
||||
"Discord.Net.Rest": "3.6.1",
|
||||
"Discord.Net.WebSocket": "3.6.1",
|
||||
"Discord.Net.Webhook": "3.6.1"
|
||||
}
|
||||
},
|
||||
"Discord.Net.Commands/3.6.1": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.6.1"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net6.0/Discord.Net.Commands.dll": {
|
||||
"assemblyVersion": "3.6.1.0",
|
||||
"fileVersion": "3.6.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Core/3.6.1": {
|
||||
"dependencies": {
|
||||
"Newtonsoft.Json": "13.0.1",
|
||||
"System.Collections.Immutable": "5.0.0",
|
||||
"System.Interactive.Async": "5.0.0",
|
||||
"System.ValueTuple": "4.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net6.0/Discord.Net.Core.dll": {
|
||||
"assemblyVersion": "3.6.1.0",
|
||||
"fileVersion": "3.6.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Interactions/3.6.1": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.6.1",
|
||||
"Discord.Net.Rest": "3.6.1",
|
||||
"Discord.Net.WebSocket": "3.6.1",
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "5.0.0",
|
||||
"System.Collections.Immutable": "5.0.0",
|
||||
"System.Reactive": "5.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net6.0/Discord.Net.Interactions.dll": {
|
||||
"assemblyVersion": "3.6.1.0",
|
||||
"fileVersion": "3.6.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Rest/3.6.1": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.6.1"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net6.0/Discord.Net.Rest.dll": {
|
||||
"assemblyVersion": "3.6.1.0",
|
||||
"fileVersion": "3.6.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Webhook/3.6.1": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.6.1",
|
||||
"Discord.Net.Rest": "3.6.1"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net6.0/Discord.Net.Webhook.dll": {
|
||||
"assemblyVersion": "3.6.1.0",
|
||||
"fileVersion": "3.6.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.WebSocket/3.6.1": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.6.1",
|
||||
"Discord.Net.Rest": "3.6.1"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net6.0/Discord.Net.WebSocket.dll": {
|
||||
"assemblyVersion": "3.6.1.0",
|
||||
"fileVersion": "3.6.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions/5.0.0": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.20.51904"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Newtonsoft.Json/13.0.1": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Newtonsoft.Json.dll": {
|
||||
"assemblyVersion": "13.0.0.0",
|
||||
"fileVersion": "13.0.1.25517"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Collections.Immutable/5.0.0": {},
|
||||
"System.Interactive.Async/5.0.0": {
|
||||
"dependencies": {
|
||||
"System.Linq.Async": "5.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netcoreapp3.1/System.Interactive.Async.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.0.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Linq.Async/5.0.0": {
|
||||
"runtime": {
|
||||
"lib/netcoreapp3.1/System.Linq.Async.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.0.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Reactive/5.0.0": {
|
||||
"runtime": {
|
||||
"lib/net5.0/System.Reactive.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.0.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.ValueTuple/4.5.0": {},
|
||||
"PluginManager/1.0.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net": "3.6.1"
|
||||
},
|
||||
"runtime": {
|
||||
"PluginManager.dll": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"CMD_Utils/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"Discord.Net/3.6.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-TfcL/HG57fVt//WVJ2XyF2PlytY9IYkkwwkPLIhvu5FW4wf9rm7+N8RPh4qtELLfsa5ES0FK2RbgYjABRR9AjA==",
|
||||
"path": "discord.net/3.6.1",
|
||||
"hashPath": "discord.net.3.6.1.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Commands/3.6.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-kK7m571yzSzPd93o+n8Z+TfvX62BT1HtOEZIWXKwXWO8itP/sgqBNExjWK/6DOpkbD6+khc2f3rp+TA0rJD88g==",
|
||||
"path": "discord.net.commands/3.6.1",
|
||||
"hashPath": "discord.net.commands.3.6.1.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Core/3.6.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ibVjQiWzgqh0GyP/GXE2kv3TA/9ysmmNFG/WmRE7GepQQAXXGxVUO9IMJ8h14EvIXMQ0m0DktMe5DkUnilo3Ag==",
|
||||
"path": "discord.net.core/3.6.1",
|
||||
"hashPath": "discord.net.core.3.6.1.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Interactions/3.6.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-WGOxz6SMUu4WS5b/JdrhlwQletcplBIYqvjFBBDfnqE+uNJqcNGtAdyjLqIILfXGx8aSSSSYZSCeAUa7FZ8Yew==",
|
||||
"path": "discord.net.interactions/3.6.1",
|
||||
"hashPath": "discord.net.interactions.3.6.1.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Rest/3.6.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-T7RRThIS23roFEJwTL1l7aawjVyn7ZB5yH3tMge0d6TiCzzp4V4FAZ+ArTt19LHRFhPly90v8V3sWqmTMN+5Zg==",
|
||||
"path": "discord.net.rest/3.6.1",
|
||||
"hashPath": "discord.net.rest.3.6.1.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Webhook/3.6.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-xikKHIGAIMz0BzHkaTKb48DNpFjKW8mvJjLJSezJ1xQOu+laHNk/hav4qxVtyZz7HSI/vGTkmlq9hKVhWzpaUA==",
|
||||
"path": "discord.net.webhook/3.6.1",
|
||||
"hashPath": "discord.net.webhook.3.6.1.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.WebSocket/3.6.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-hF22Xy7URlVEDQZ69INOgzPvFUsIDfd+r6U+1yF9HWdBn3d4THnvAAhkv1TraSx/T/MKS7g+jvk/HZ3mh5S3aw==",
|
||||
"path": "discord.net.websocket/3.6.1",
|
||||
"hashPath": "discord.net.websocket.3.6.1.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ORj7Zh81gC69TyvmcUm9tSzytcy8AVousi+IVRAI8nLieQjOFryRusSFh7+aLk16FN9pQNqJAiMd7BTKINK0kA==",
|
||||
"path": "microsoft.extensions.dependencyinjection.abstractions/5.0.0",
|
||||
"hashPath": "microsoft.extensions.dependencyinjection.abstractions.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"Newtonsoft.Json/13.0.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==",
|
||||
"path": "newtonsoft.json/13.0.1",
|
||||
"hashPath": "newtonsoft.json.13.0.1.nupkg.sha512"
|
||||
},
|
||||
"System.Collections.Immutable/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==",
|
||||
"path": "system.collections.immutable/5.0.0",
|
||||
"hashPath": "system.collections.immutable.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Interactive.Async/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-QaqhQVDiULcu4vm6o89+iP329HcK44cETHOYgy/jfEjtzeFy0ZxmuM7nel9ocjnKxEM4yh1mli7hgh8Q9o+/Iw==",
|
||||
"path": "system.interactive.async/5.0.0",
|
||||
"hashPath": "system.interactive.async.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Linq.Async/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-cPtIuuH8TIjVHSi2ewwReWGW1PfChPE0LxPIDlfwVcLuTM9GANFTXiMB7k3aC4sk3f0cQU25LNKzx+jZMxijqw==",
|
||||
"path": "system.linq.async/5.0.0",
|
||||
"hashPath": "system.linq.async.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Reactive/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-erBZjkQHWL9jpasCE/0qKAryzVBJFxGHVBAvgRN1bzM0q2s1S4oYREEEL0Vb+1kA/6BKb5FjUZMp5VXmy+gzkQ==",
|
||||
"path": "system.reactive/5.0.0",
|
||||
"hashPath": "system.reactive.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.ValueTuple/4.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-okurQJO6NRE/apDIP23ajJ0hpiNmJ+f0BwOlB/cSqTLQlw5upkf+5+96+iG2Jw40G1fCVCyPz/FhIABUjMR+RQ==",
|
||||
"path": "system.valuetuple/4.5.0",
|
||||
"hashPath": "system.valuetuple.4.5.0.nupkg.sha512"
|
||||
},
|
||||
"PluginManager/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,268 +0,0 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v6.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v6.0": {
|
||||
"MusicCommands/1.0.0": {
|
||||
"dependencies": {
|
||||
"PluginManager": "1.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"MusicCommands.dll": {}
|
||||
}
|
||||
},
|
||||
"Discord.Net/3.6.1": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Commands": "3.6.1",
|
||||
"Discord.Net.Core": "3.6.1",
|
||||
"Discord.Net.Interactions": "3.6.1",
|
||||
"Discord.Net.Rest": "3.6.1",
|
||||
"Discord.Net.WebSocket": "3.6.1",
|
||||
"Discord.Net.Webhook": "3.6.1"
|
||||
}
|
||||
},
|
||||
"Discord.Net.Commands/3.6.1": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.6.1"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net6.0/Discord.Net.Commands.dll": {
|
||||
"assemblyVersion": "3.6.1.0",
|
||||
"fileVersion": "3.6.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Core/3.6.1": {
|
||||
"dependencies": {
|
||||
"Newtonsoft.Json": "13.0.1",
|
||||
"System.Collections.Immutable": "5.0.0",
|
||||
"System.Interactive.Async": "5.0.0",
|
||||
"System.ValueTuple": "4.5.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net6.0/Discord.Net.Core.dll": {
|
||||
"assemblyVersion": "3.6.1.0",
|
||||
"fileVersion": "3.6.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Interactions/3.6.1": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.6.1",
|
||||
"Discord.Net.Rest": "3.6.1",
|
||||
"Discord.Net.WebSocket": "3.6.1",
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "5.0.0",
|
||||
"System.Collections.Immutable": "5.0.0",
|
||||
"System.Reactive": "5.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net6.0/Discord.Net.Interactions.dll": {
|
||||
"assemblyVersion": "3.6.1.0",
|
||||
"fileVersion": "3.6.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Rest/3.6.1": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.6.1"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net6.0/Discord.Net.Rest.dll": {
|
||||
"assemblyVersion": "3.6.1.0",
|
||||
"fileVersion": "3.6.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.Webhook/3.6.1": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.6.1",
|
||||
"Discord.Net.Rest": "3.6.1"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net6.0/Discord.Net.Webhook.dll": {
|
||||
"assemblyVersion": "3.6.1.0",
|
||||
"fileVersion": "3.6.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Discord.Net.WebSocket/3.6.1": {
|
||||
"dependencies": {
|
||||
"Discord.Net.Core": "3.6.1",
|
||||
"Discord.Net.Rest": "3.6.1"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net6.0/Discord.Net.WebSocket.dll": {
|
||||
"assemblyVersion": "3.6.1.0",
|
||||
"fileVersion": "3.6.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions/5.0.0": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.20.51904"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Newtonsoft.Json/13.0.1": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Newtonsoft.Json.dll": {
|
||||
"assemblyVersion": "13.0.0.0",
|
||||
"fileVersion": "13.0.1.25517"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Collections.Immutable/5.0.0": {},
|
||||
"System.Interactive.Async/5.0.0": {
|
||||
"dependencies": {
|
||||
"System.Linq.Async": "5.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netcoreapp3.1/System.Interactive.Async.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.0.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Linq.Async/5.0.0": {
|
||||
"runtime": {
|
||||
"lib/netcoreapp3.1/System.Linq.Async.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.0.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Reactive/5.0.0": {
|
||||
"runtime": {
|
||||
"lib/net5.0/System.Reactive.dll": {
|
||||
"assemblyVersion": "5.0.0.0",
|
||||
"fileVersion": "5.0.0.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.ValueTuple/4.5.0": {},
|
||||
"PluginManager/1.0.0": {
|
||||
"dependencies": {
|
||||
"Discord.Net": "3.6.1"
|
||||
},
|
||||
"runtime": {
|
||||
"PluginManager.dll": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"MusicCommands/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"Discord.Net/3.6.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-TfcL/HG57fVt//WVJ2XyF2PlytY9IYkkwwkPLIhvu5FW4wf9rm7+N8RPh4qtELLfsa5ES0FK2RbgYjABRR9AjA==",
|
||||
"path": "discord.net/3.6.1",
|
||||
"hashPath": "discord.net.3.6.1.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Commands/3.6.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-kK7m571yzSzPd93o+n8Z+TfvX62BT1HtOEZIWXKwXWO8itP/sgqBNExjWK/6DOpkbD6+khc2f3rp+TA0rJD88g==",
|
||||
"path": "discord.net.commands/3.6.1",
|
||||
"hashPath": "discord.net.commands.3.6.1.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Core/3.6.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ibVjQiWzgqh0GyP/GXE2kv3TA/9ysmmNFG/WmRE7GepQQAXXGxVUO9IMJ8h14EvIXMQ0m0DktMe5DkUnilo3Ag==",
|
||||
"path": "discord.net.core/3.6.1",
|
||||
"hashPath": "discord.net.core.3.6.1.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Interactions/3.6.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-WGOxz6SMUu4WS5b/JdrhlwQletcplBIYqvjFBBDfnqE+uNJqcNGtAdyjLqIILfXGx8aSSSSYZSCeAUa7FZ8Yew==",
|
||||
"path": "discord.net.interactions/3.6.1",
|
||||
"hashPath": "discord.net.interactions.3.6.1.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Rest/3.6.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-T7RRThIS23roFEJwTL1l7aawjVyn7ZB5yH3tMge0d6TiCzzp4V4FAZ+ArTt19LHRFhPly90v8V3sWqmTMN+5Zg==",
|
||||
"path": "discord.net.rest/3.6.1",
|
||||
"hashPath": "discord.net.rest.3.6.1.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.Webhook/3.6.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-xikKHIGAIMz0BzHkaTKb48DNpFjKW8mvJjLJSezJ1xQOu+laHNk/hav4qxVtyZz7HSI/vGTkmlq9hKVhWzpaUA==",
|
||||
"path": "discord.net.webhook/3.6.1",
|
||||
"hashPath": "discord.net.webhook.3.6.1.nupkg.sha512"
|
||||
},
|
||||
"Discord.Net.WebSocket/3.6.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-hF22Xy7URlVEDQZ69INOgzPvFUsIDfd+r6U+1yF9HWdBn3d4THnvAAhkv1TraSx/T/MKS7g+jvk/HZ3mh5S3aw==",
|
||||
"path": "discord.net.websocket/3.6.1",
|
||||
"hashPath": "discord.net.websocket.3.6.1.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ORj7Zh81gC69TyvmcUm9tSzytcy8AVousi+IVRAI8nLieQjOFryRusSFh7+aLk16FN9pQNqJAiMd7BTKINK0kA==",
|
||||
"path": "microsoft.extensions.dependencyinjection.abstractions/5.0.0",
|
||||
"hashPath": "microsoft.extensions.dependencyinjection.abstractions.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"Newtonsoft.Json/13.0.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==",
|
||||
"path": "newtonsoft.json/13.0.1",
|
||||
"hashPath": "newtonsoft.json.13.0.1.nupkg.sha512"
|
||||
},
|
||||
"System.Collections.Immutable/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==",
|
||||
"path": "system.collections.immutable/5.0.0",
|
||||
"hashPath": "system.collections.immutable.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Interactive.Async/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-QaqhQVDiULcu4vm6o89+iP329HcK44cETHOYgy/jfEjtzeFy0ZxmuM7nel9ocjnKxEM4yh1mli7hgh8Q9o+/Iw==",
|
||||
"path": "system.interactive.async/5.0.0",
|
||||
"hashPath": "system.interactive.async.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Linq.Async/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-cPtIuuH8TIjVHSi2ewwReWGW1PfChPE0LxPIDlfwVcLuTM9GANFTXiMB7k3aC4sk3f0cQU25LNKzx+jZMxijqw==",
|
||||
"path": "system.linq.async/5.0.0",
|
||||
"hashPath": "system.linq.async.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Reactive/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-erBZjkQHWL9jpasCE/0qKAryzVBJFxGHVBAvgRN1bzM0q2s1S4oYREEEL0Vb+1kA/6BKb5FjUZMp5VXmy+gzkQ==",
|
||||
"path": "system.reactive/5.0.0",
|
||||
"hashPath": "system.reactive.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.ValueTuple/4.5.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-okurQJO6NRE/apDIP23ajJ0hpiNmJ+f0BwOlB/cSqTLQlw5upkf+5+96+iG2Jw40G1fCVCyPz/FhIABUjMR+RQ==",
|
||||
"path": "system.valuetuple/4.5.0",
|
||||
"hashPath": "system.valuetuple.4.5.0.nupkg.sha512"
|
||||
},
|
||||
"PluginManager/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,14 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<BaseOutputPath>..\DiscordBot\bin\Debug\net6.0\Data\Plugins\Commands\LevelingSystem</BaseOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PluginManager\PluginManager.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,48 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
using PluginManager;
|
||||
using PluginManager.Interfaces;
|
||||
using PluginManager.Others;
|
||||
|
||||
namespace CMD_LevelingSystem
|
||||
{
|
||||
internal class Level : DBCommand
|
||||
{
|
||||
public string Command => "level";
|
||||
|
||||
public string Description => "Display tour current level";
|
||||
|
||||
public string Usage => "level";
|
||||
|
||||
public bool canUseDM => false;
|
||||
|
||||
public bool canUseServer => true;
|
||||
|
||||
public bool requireAdmin => false;
|
||||
|
||||
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
|
||||
{
|
||||
User user = await Functions.ConvertFromJson<User>(Config.GetValue("LevelingSystemPath") + $"/{message.Author.Id}.dat");
|
||||
if (user == null)
|
||||
{
|
||||
await context.Channel.SendMessageAsync("You are now unranked !");
|
||||
return;
|
||||
}
|
||||
|
||||
var builder = new EmbedBuilder();
|
||||
Random r = new Random();
|
||||
builder.WithColor(r.Next(256), r.Next(256), r.Next(256));
|
||||
builder.AddField("Current Level", user.CurrentLevel, true)
|
||||
.AddField("Current EXP", user.CurrentEXP, true)
|
||||
.AddField("Required Exp", user.RequiredEXPToLevelUp, true);
|
||||
builder.WithTimestamp(DateTimeOffset.Now);
|
||||
await context.Channel.SendMessageAsync(embed: builder.Build());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CMD_LevelingSystem
|
||||
{
|
||||
public class User
|
||||
{
|
||||
public string userID { get; set; }
|
||||
public int CurrentLevel { get; set; }
|
||||
public Int64 CurrentEXP { get; set; }
|
||||
public Int64 RequiredEXPToLevelUp { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<OutputPath>..\BUILDS\</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<DebugType>none</DebugType>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PluginManager\PluginManager.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,24 +0,0 @@
|
||||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
|
||||
using PluginManager.Interfaces;
|
||||
|
||||
internal class Echo : DBCommand
|
||||
{
|
||||
public string Command => "echo";
|
||||
|
||||
public string Description => "Replay with the same message";
|
||||
|
||||
public string Usage => "echo [message]";
|
||||
|
||||
public bool canUseDM => true;
|
||||
public bool canUseServer => true;
|
||||
|
||||
public bool requireAdmin => false;
|
||||
|
||||
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
|
||||
{
|
||||
string m = message.Content.Substring(6);
|
||||
await message.Channel.SendMessageAsync(m);
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
|
||||
using PluginManager.Interfaces;
|
||||
|
||||
namespace CMD_Utils
|
||||
{
|
||||
class FlipCoin : DBCommand
|
||||
{
|
||||
public string Command => "flip";
|
||||
|
||||
public string Description => "Flip a coin";
|
||||
|
||||
public string Usage => "flip";
|
||||
|
||||
public bool canUseDM => true;
|
||||
|
||||
public bool canUseServer => true;
|
||||
|
||||
public bool requireAdmin => false;
|
||||
|
||||
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
|
||||
{
|
||||
System.Random random = new System.Random();
|
||||
int r = random.Next(1, 3);
|
||||
if (r == 1)
|
||||
await message.Channel.SendMessageAsync("Heads");
|
||||
else await message.Channel.SendMessageAsync("Tails");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
|
||||
using PluginManager.Interfaces;
|
||||
|
||||
namespace CMD_Utils
|
||||
{
|
||||
public class Poll : DBCommand
|
||||
{
|
||||
public string Command => "poll";
|
||||
|
||||
public string Description => "Create a poll with options";
|
||||
|
||||
public string Usage => "poll [This-is-question] [This-is-answer-1] [This-is-answer-2] ... ";
|
||||
|
||||
public bool canUseDM => false;
|
||||
|
||||
public bool canUseServer => true;
|
||||
|
||||
public bool requireAdmin => true;
|
||||
|
||||
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
|
||||
{
|
||||
if (isDM) return;
|
||||
string question = message.Content.Split(' ')[1].Replace('-', ' ');
|
||||
string[] answers = PluginManager.Others.Functions.MergeStrings(message.Content.Split(' '), 2).Split(' ');
|
||||
EmbedBuilder embedBuilder = new EmbedBuilder();
|
||||
embedBuilder.Title = question;
|
||||
int len = answers.Length;
|
||||
for (int i = 0; i < len; i++)
|
||||
embedBuilder.AddField($"Answer {i + 1}", answers[i].Replace('-', ' '), true);
|
||||
var msg = await context.Channel.SendMessageAsync(embed: embedBuilder.Build());
|
||||
|
||||
List<IEmote> emotes = new List<IEmote>();
|
||||
emotes.Add(Emoji.Parse(":one:"));
|
||||
emotes.Add(Emoji.Parse(":two:"));
|
||||
emotes.Add(Emoji.Parse(":three:"));
|
||||
emotes.Add(Emoji.Parse(":four:"));
|
||||
emotes.Add(Emoji.Parse(":five:"));
|
||||
emotes.Add(Emoji.Parse(":six:"));
|
||||
|
||||
for (int i = 0; i < len; i++)
|
||||
await msg.AddReactionAsync(emotes[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
|
||||
using PluginManager.Interfaces;
|
||||
|
||||
public class Random : DBCommand
|
||||
{
|
||||
public string Command => "random";
|
||||
|
||||
public string Description => "random number between number1 and number2";
|
||||
|
||||
public string Usage => "random [number1] [number2]";
|
||||
|
||||
public bool canUseDM => true;
|
||||
public bool canUseServer => true;
|
||||
public bool requireAdmin => false;
|
||||
|
||||
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
|
||||
{
|
||||
try
|
||||
{
|
||||
string msg = message.Content;
|
||||
int a = int.Parse(msg.Split(' ')[1]);
|
||||
int b = int.Parse(msg.Split(' ')[2]);
|
||||
|
||||
if (a > b)
|
||||
{
|
||||
int x = a;
|
||||
a = b;
|
||||
b = x;
|
||||
}
|
||||
|
||||
await message.Channel.SendMessageAsync("Your random generated number is " + new System.Random().Next(a, b));
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
await message.Channel.SendMessageAsync("Invalid numbers or no numbers:\nUsage: " + Usage);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
DiscordBot.dll
BIN
DiscordBot.dll
Binary file not shown.
@@ -1,7 +0,0 @@
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="4.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
|
||||
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
|
||||
using PluginManager.Loaders;
|
||||
using PluginManager.Interfaces;
|
||||
using PluginManager.Others.Permissions;
|
||||
using PluginManager.Others;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DiscordBot.Discord.Commands
|
||||
{
|
||||
/// <summary>
|
||||
/// The help command
|
||||
/// </summary>
|
||||
internal class Help : DBCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// Command name
|
||||
/// </summary>
|
||||
public string Command => "help";
|
||||
|
||||
/// <summary>
|
||||
/// Command Description
|
||||
/// </summary>
|
||||
public string Description => "This command allows you to check all loadded commands";
|
||||
|
||||
/// <summary>
|
||||
/// Command usage
|
||||
/// </summary>
|
||||
public string Usage => "help";
|
||||
|
||||
/// <summary>
|
||||
/// Check if the command can be used <inheritdoca DM <see cref="IChannel"/>/>
|
||||
/// </summary>
|
||||
public bool canUseDM => true;
|
||||
|
||||
/// <summary>
|
||||
/// Check if the command can be used in a server
|
||||
/// </summary>
|
||||
public bool canUseServer => true;
|
||||
|
||||
/// <summary>
|
||||
/// Check if the command require administrator to be executed
|
||||
/// </summary>
|
||||
public bool requireAdmin => false;
|
||||
|
||||
/// <summary>
|
||||
/// The main body of the command
|
||||
/// </summary>
|
||||
/// <param name="context">The command context</param>
|
||||
/// <param name="message">The command message</param>
|
||||
/// <param name="client">The discord bot client</param>
|
||||
/// <param name="isDM">True if the message was sent from a DM channel, false otherwise</param>
|
||||
public void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
|
||||
{
|
||||
List<string> args = Functions.GetArguments(message);
|
||||
if (args.Count != 0)
|
||||
{
|
||||
|
||||
foreach (var item in args)
|
||||
{
|
||||
var e = GenerateHelpCommand(item);
|
||||
if (e != null)
|
||||
context.Channel.SendMessageAsync(embed: e.Build());
|
||||
else
|
||||
context.Channel.SendMessageAsync("Unknown Command " + item);
|
||||
}
|
||||
return;
|
||||
}
|
||||
EmbedBuilder embedBuilder = new EmbedBuilder();
|
||||
|
||||
string adminCommands = "";
|
||||
string normalCommands = "";
|
||||
string DMCommands = "";
|
||||
|
||||
foreach (var cmd in PluginLoader.Commands!)
|
||||
{
|
||||
if (cmd.canUseDM) DMCommands += cmd.Command + " ";
|
||||
if (cmd.requireAdmin)
|
||||
adminCommands += cmd.Command + " ";
|
||||
else if (cmd.canUseServer) normalCommands += cmd.Command + " ";
|
||||
}
|
||||
|
||||
embedBuilder.AddField("Admin Commands", adminCommands);
|
||||
embedBuilder.AddField("Normal Commands", normalCommands);
|
||||
embedBuilder.AddField("DM Commands", DMCommands);
|
||||
context.Channel.SendMessageAsync(embed: embedBuilder.Build());
|
||||
|
||||
}
|
||||
|
||||
private EmbedBuilder GenerateHelpCommand(string command)
|
||||
{
|
||||
EmbedBuilder embedBuilder = new EmbedBuilder();
|
||||
DBCommand cmd = PluginLoader.Commands.Find(p => p.Command == command);
|
||||
if (cmd == null)
|
||||
return null;
|
||||
|
||||
embedBuilder.AddField("Usage", cmd.Usage);
|
||||
embedBuilder.AddField("Description", cmd.Description);
|
||||
|
||||
return embedBuilder;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
using Discord.WebSocket;
|
||||
using DiscordLibCommands = Discord.Commands;
|
||||
using DiscordLib = Discord;
|
||||
|
||||
using PluginManager.Interfaces;
|
||||
using PluginManager.Others.Permissions;
|
||||
using PluginManager.Others;
|
||||
|
||||
namespace DiscordBot.Discord.Commands
|
||||
{
|
||||
internal class Restart : DBCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// Command name
|
||||
/// </summary>
|
||||
public string Command => "restart";
|
||||
|
||||
/// <summary>
|
||||
/// Command Description
|
||||
/// </summary>
|
||||
public string Description => "Restart the bot";
|
||||
|
||||
/// <summary>
|
||||
/// Command usage
|
||||
/// </summary>
|
||||
public string Usage => "restart [-p | -c | -args | -cmd] <args>";
|
||||
|
||||
/// <summary>
|
||||
/// Check if the command can be used <inheritdoca DM <see cref="IChannel"/>/>
|
||||
/// </summary>
|
||||
public bool canUseDM => false;
|
||||
|
||||
/// <summary>
|
||||
/// Check if the command can be used in a server
|
||||
/// </summary>
|
||||
public bool canUseServer => true;
|
||||
|
||||
/// <summary>
|
||||
/// Check if the command require administrator to be executed
|
||||
/// </summary>
|
||||
public bool requireAdmin => false;
|
||||
/// <summary>
|
||||
/// The main body of the command
|
||||
/// </summary>
|
||||
/// <param name="context">The command context</param>
|
||||
/// <param name="message">The command message</param>
|
||||
/// <param name="client">The discord bot client</param>
|
||||
/// <param name="isDM">True if the message was sent from a DM channel, false otherwise</param>
|
||||
public async void Execute(DiscordLibCommands.SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
|
||||
{
|
||||
if (!DiscordPermissions.hasPermission(message.Author as SocketGuildUser, DiscordLib.GuildPermission.Administrator)) return;
|
||||
var args = Functions.GetArguments(message);
|
||||
var OS = Functions.GetOperatingSystem();
|
||||
if (args.Count == 0)
|
||||
{
|
||||
switch (OS)
|
||||
{
|
||||
case PluginManager.Others.OperatingSystem.WINDOWS:
|
||||
Process.Start("./DiscordBot.exe");
|
||||
break;
|
||||
case PluginManager.Others.OperatingSystem.LINUX:
|
||||
case PluginManager.Others.OperatingSystem.MAC_OS:
|
||||
Process.Start("./DiscordBot");
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
switch (args[0])
|
||||
{
|
||||
case "-p":
|
||||
case "-poweroff":
|
||||
case "-c":
|
||||
case "-close":
|
||||
Environment.Exit(0);
|
||||
break;
|
||||
case "-cmd":
|
||||
case "-args":
|
||||
string cmd = "--args";
|
||||
|
||||
if (args.Count > 1)
|
||||
for (int i = 1; i < args.Count; i++)
|
||||
cmd += $" {args[i]}";
|
||||
|
||||
|
||||
switch (OS)
|
||||
{
|
||||
case PluginManager.Others.OperatingSystem.WINDOWS:
|
||||
Functions.WriteLogFile("Restarting the bot with the following arguments: \"" + cmd + "\"");
|
||||
Process.Start("./DiscordBot.exe", cmd);
|
||||
break;
|
||||
case PluginManager.Others.OperatingSystem.LINUX:
|
||||
//case PluginManager.Others.OperatingSystem.MAC_OS: ?? - not tested
|
||||
Process.Start("./DiscordBot", cmd);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
Environment.Exit(0);
|
||||
break;
|
||||
default:
|
||||
await context.Channel.SendMessageAsync("Invalid argument. Use `help restart` to see the usage.");
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
using DiscordBot.Discord.Core;
|
||||
using PluginManager;
|
||||
using PluginManager.Interfaces;
|
||||
using PluginManager.Others;
|
||||
using PluginManager.Others.Permissions;
|
||||
|
||||
namespace DiscordBot.Discord.Commands
|
||||
{
|
||||
class Settings : DBCommand
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Command name
|
||||
/// </summary>
|
||||
public string Command => "set";
|
||||
|
||||
/// <summary>
|
||||
/// Command Description
|
||||
/// </summary>
|
||||
public string Description => "This command allows you change all settings. Use \"set help\" to show details";
|
||||
|
||||
/// <summary>
|
||||
/// Command usage
|
||||
/// </summary>
|
||||
public string Usage => "set [keyword] [new Value]";
|
||||
|
||||
/// <summary>
|
||||
/// Check if the command can be used <inheritdoca DM <see cref="IChannel"/>/>
|
||||
/// </summary>
|
||||
public bool canUseDM => true;
|
||||
|
||||
/// <summary>
|
||||
/// Check if the command can be used in a server
|
||||
/// </summary>
|
||||
public bool canUseServer => true;
|
||||
|
||||
/// <summary>
|
||||
/// Check if the command require administrator to be executed
|
||||
/// </summary>
|
||||
public bool requireAdmin => true;
|
||||
|
||||
/// <summary>
|
||||
/// The main body of the command
|
||||
/// </summary>
|
||||
/// <param name="context">The command context</param>
|
||||
/// <param name="message">The command message</param>
|
||||
/// <param name="client">The discord bot client</param>
|
||||
/// <param name="isDM">True if the message was sent from a DM channel, false otherwise</param>
|
||||
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
|
||||
{
|
||||
var channel = message.Channel;
|
||||
try
|
||||
{
|
||||
string content = message.Content;
|
||||
string[] data = content.Split(' ');
|
||||
string keyword = data[1];
|
||||
if (keyword.ToLower() == "help")
|
||||
{
|
||||
await channel.SendMessageAsync("set token [new value] -- set the value of the new token (require restart)");
|
||||
await channel.SendMessageAsync("set prefix [new value] -- set the value of the new preifx (require restart)");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
switch (keyword.ToLower())
|
||||
{
|
||||
case "token":
|
||||
if (data.Length != 3)
|
||||
{
|
||||
await channel.SendMessageAsync("Invalid token !");
|
||||
return;
|
||||
}
|
||||
|
||||
Config.SetValue("token", data[2]);
|
||||
break;
|
||||
case "prefix":
|
||||
if (data.Length != 3)
|
||||
{
|
||||
await channel.SendMessageAsync("Invalid token !");
|
||||
return;
|
||||
}
|
||||
|
||||
Config.SetValue("token", data[2]);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
await channel.SendMessageAsync("Restart required ...");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
await channel.SendMessageAsync("Unknown usage to this command !\nUsage: " + Usage);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using PluginManager;
|
||||
using static PluginManager.Others.Functions;
|
||||
|
||||
namespace DiscordBot.Discord.Core
|
||||
{
|
||||
internal class Boot
|
||||
{
|
||||
/// <summary>
|
||||
/// The bot prefix
|
||||
/// </summary>
|
||||
public readonly string botPrefix;
|
||||
|
||||
/// <summary>
|
||||
/// The bot token
|
||||
/// </summary>
|
||||
public readonly string botToken;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the bot is ready
|
||||
/// </summary>
|
||||
/// <value> true if the bot is ready, othwerwise false </value>
|
||||
public bool isReady { get; private set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// The bot client
|
||||
/// </summary>
|
||||
public DiscordSocketClient client;
|
||||
|
||||
/// <summary>
|
||||
/// The bot command handler
|
||||
/// </summary>
|
||||
private CommandHandler commandServiceHandler;
|
||||
|
||||
/// <summary>
|
||||
/// The command service
|
||||
/// </summary>
|
||||
private CommandService service;
|
||||
|
||||
/// <summary>
|
||||
/// The main Boot constructor
|
||||
/// </summary>
|
||||
/// <param name="botToken">The bot token</param>
|
||||
/// <param name="botPrefix">The bot prefix</param>
|
||||
public Boot(string botToken, string botPrefix)
|
||||
{
|
||||
this.botPrefix = botPrefix;
|
||||
this.botToken = botToken;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The start method for the bot. This method is used to load the bot
|
||||
/// </summary>
|
||||
/// <returns>Task</returns>
|
||||
public async Task Awake()
|
||||
{
|
||||
client = new DiscordSocketClient();
|
||||
service = new CommandService();
|
||||
|
||||
CommonTasks();
|
||||
|
||||
await client.LoginAsync(TokenType.Bot, botToken);
|
||||
await client.StartAsync();
|
||||
|
||||
commandServiceHandler = new CommandHandler(client, service, botPrefix);
|
||||
await commandServiceHandler.InstallCommandsAsync();
|
||||
|
||||
await Task.Delay(2000);
|
||||
while (!isReady) ;
|
||||
|
||||
}
|
||||
|
||||
private void CommonTasks()
|
||||
{
|
||||
if (client == null) return;
|
||||
client.LoggedOut += Client_LoggedOut;
|
||||
client.Log += Log;
|
||||
client.LoggedIn += LoggedIn;
|
||||
client.Ready += Ready;
|
||||
}
|
||||
|
||||
private Task Client_LoggedOut()
|
||||
{
|
||||
WriteLogFile("Successfully Logged Out");
|
||||
Log(new LogMessage(LogSeverity.Info, "Boot", "Successfully logged out from discord !"));
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task Ready()
|
||||
{
|
||||
Console.Title = "ONLINE";
|
||||
isReady = true;
|
||||
|
||||
new Thread(async () =>
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Config.SaveConfig();
|
||||
Thread.Sleep(10000);
|
||||
}
|
||||
}
|
||||
).Start();
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task LoggedIn()
|
||||
{
|
||||
Console.Title = "CONNECTED";
|
||||
WriteLogFile("The bot has been logged in at " + DateTime.Now.ToShortDateString() + " (" +
|
||||
DateTime.Now.ToShortTimeString() + ")");
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task Log(LogMessage message)
|
||||
{
|
||||
switch (message.Severity)
|
||||
{
|
||||
case LogSeverity.Error:
|
||||
case LogSeverity.Critical:
|
||||
WriteErrFile(message.Message);
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.WriteLine("[ERROR] " + message.Message);
|
||||
Console.ForegroundColor = ConsoleColor.White;
|
||||
|
||||
break;
|
||||
|
||||
case LogSeverity.Info:
|
||||
case LogSeverity.Debug:
|
||||
WriteLogFile(message.Message);
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.Cyan;
|
||||
Console.WriteLine("[INFO] " + message.Message);
|
||||
Console.ForegroundColor = ConsoleColor.White;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
|
||||
using PluginManager.Interfaces;
|
||||
|
||||
using System.Reflection;
|
||||
using PluginManager.Others;
|
||||
using PluginManager.Others.Permissions;
|
||||
using PluginManager.Loaders;
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
using Discord;
|
||||
using System;
|
||||
|
||||
namespace DiscordBot.Discord.Core
|
||||
{
|
||||
internal class CommandHandler
|
||||
{
|
||||
private readonly DiscordSocketClient client;
|
||||
private readonly CommandService commandService;
|
||||
private readonly string botPrefix;
|
||||
|
||||
/// <summary>
|
||||
/// Command handler constructor
|
||||
/// </summary>
|
||||
/// <param name="client">The discord bot client</param>
|
||||
/// <param name="commandService">The discord bot command service</param>
|
||||
/// <param name="botPrefix">The prefix to watch for</param>
|
||||
public CommandHandler(DiscordSocketClient client, CommandService commandService, string botPrefix)
|
||||
{
|
||||
this.client = client;
|
||||
this.commandService = commandService;
|
||||
this.botPrefix = botPrefix;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The method to initialize all commands
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task InstallCommandsAsync()
|
||||
{
|
||||
client.MessageReceived += MessageHandler;
|
||||
await commandService.AddModulesAsync(assembly: Assembly.GetEntryAssembly(), services: null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The message handler for the bot
|
||||
/// </summary>
|
||||
/// <param name="Message">The message got from the user in discord chat</param>
|
||||
/// <returns></returns>
|
||||
private async Task MessageHandler(SocketMessage Message)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Message as SocketUserMessage == null)
|
||||
return;
|
||||
|
||||
var message = Message as SocketUserMessage;
|
||||
|
||||
if (message == null) return;
|
||||
|
||||
if (!message.Content.StartsWith(botPrefix)) return;
|
||||
|
||||
int argPos = 0;
|
||||
|
||||
if (message.HasMentionPrefix(client.CurrentUser, ref argPos))
|
||||
{
|
||||
await message.Channel.SendMessageAsync("Can not exec mentioned commands !");
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.Author.IsBot) return;
|
||||
|
||||
var context = new SocketCommandContext(client, message);
|
||||
|
||||
await commandService.ExecuteAsync(
|
||||
context: context,
|
||||
argPos: argPos,
|
||||
services: null
|
||||
);
|
||||
|
||||
DBCommand plugin = PluginLoader.Commands!.Where(p => p.Command == (message.Content.Split(' ')[0]).Substring(botPrefix.Length)).FirstOrDefault();
|
||||
|
||||
|
||||
if (plugin != null)
|
||||
{
|
||||
if (message.Channel == await message.Author.CreateDMChannelAsync())
|
||||
{
|
||||
if (plugin.canUseDM)
|
||||
{
|
||||
if (plugin.requireAdmin)
|
||||
{
|
||||
if (message.Author.isAdmin())
|
||||
{
|
||||
plugin.Execute(context, message, client, true);
|
||||
Functions.WriteLogFile($"[{message.Author.Id}] Executed command (DM) : " + plugin.Command);
|
||||
return;
|
||||
}
|
||||
await message.Channel.SendMessageAsync("This command is for administrators only !");
|
||||
return;
|
||||
}
|
||||
plugin.Execute(context, message, client, true);
|
||||
Functions.WriteLogFile($"[{message.Author.Id}] Executed command (DM) : " + plugin.Command);
|
||||
return;
|
||||
}
|
||||
|
||||
await message.Channel.SendMessageAsync("This command is not for DMs");
|
||||
return;
|
||||
}
|
||||
if (plugin.canUseServer)
|
||||
{
|
||||
if (plugin.requireAdmin)
|
||||
{
|
||||
if (message.Author.isAdmin())
|
||||
{
|
||||
plugin.Execute(context, message, client, false);
|
||||
Functions.WriteLogFile($"[{message.Author.Id}] Executed command : " + plugin.Command);
|
||||
return;
|
||||
}
|
||||
await message.Channel.SendMessageAsync("This command is for administrators only !");
|
||||
return;
|
||||
}
|
||||
plugin.Execute(context, message, client, false);
|
||||
Functions.WriteLogFile($"[{message.Author.Id}] Executed command : " + plugin.Command);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>disable</Nullable>
|
||||
<ApplicationIcon />
|
||||
<StartupObject />
|
||||
<SignAssembly>False</SignAssembly>
|
||||
<IsPublishable>True</IsPublishable>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Data\**" />
|
||||
<Compile Remove="obj\**" />
|
||||
<Compile Remove="Output\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Remove="Data\**" />
|
||||
<EmbeddedResource Remove="obj\**" />
|
||||
<EmbeddedResource Remove="Output\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Data\**" />
|
||||
<None Remove="obj\**" />
|
||||
<None Remove="Output\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Discord.Net" Version="3.6.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PluginManager\PluginManager.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,244 +0,0 @@
|
||||
using DiscordBot.Discord.Core;
|
||||
using PluginManager;
|
||||
using PluginManager.Items;
|
||||
using PluginManager.Others;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DiscordBot
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
private static bool loadPluginsOnStartup = false;
|
||||
private static bool listPluginsAtStartup = false;
|
||||
|
||||
private static bool listLanguagAtStartup = false;
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
[Obsolete]
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Directory.CreateDirectory("./Data/Resources");
|
||||
Directory.CreateDirectory("./Data/Languages");
|
||||
Directory.CreateDirectory("./Data/Plugins/Commands");
|
||||
Directory.CreateDirectory("./Data/Plugins/Events");
|
||||
Config.LoadConfig().Wait();
|
||||
if (!Config.ContainsKey("token") || Config.GetValue("token") == null || Config.GetValue("token")?.Length != 70)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Console.WriteLine("Please insert your token");
|
||||
Console.Write("Token = ");
|
||||
string token = Console.ReadLine();
|
||||
if (token?.Length == 59 || token?.Length == 70)
|
||||
Config.AddValueToVariables("token", token, true);
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Invalid token");
|
||||
continue;
|
||||
}
|
||||
|
||||
Console.WriteLine("Please insert your prefix (max. 1 character long):");
|
||||
Console.WriteLine("For a prefix longer then one character, the first character will be saved and the others will be ignored. No spaces or numbers allowed");
|
||||
Console.Write("Prefix = ");
|
||||
char prefix = Console.ReadLine()[0];
|
||||
|
||||
if (prefix == ' ' || char.IsDigit(prefix)) continue;
|
||||
Config.AddValueToVariables("prefix", prefix.ToString(), false);
|
||||
break;
|
||||
}
|
||||
|
||||
Config.SaveConfig();
|
||||
}
|
||||
|
||||
HandleInput(args).Wait();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset all settings for the bot
|
||||
/// </summary>
|
||||
private static async Task ResetSettings()
|
||||
{
|
||||
string[] files = Directory.GetFiles(@"./Data/Resources");
|
||||
foreach (string file in files) File.Delete(file);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The main loop for the discord bot
|
||||
/// </summary>
|
||||
/// <param name="discordbooter">The discord booter used to start the application</param>
|
||||
private static Task NoGUI(Boot discordbooter)
|
||||
{
|
||||
ConsoleCommandsHandler consoleCommandsHandler = new ConsoleCommandsHandler(discordbooter.client);
|
||||
if (loadPluginsOnStartup) consoleCommandsHandler.HandleCommand("lp");
|
||||
if (listPluginsAtStartup) consoleCommandsHandler.HandleCommand("listplugs");
|
||||
if (listLanguagAtStartup) consoleCommandsHandler.HandleCommand("listlang");
|
||||
Config.SaveConfig();
|
||||
while (true)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.White;
|
||||
string cmd = Console.ReadLine();
|
||||
consoleCommandsHandler.HandleCommand(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Start the bot without user interface
|
||||
/// </summary>
|
||||
/// <returns>Returns the boot loader for the Discord Bot</returns>
|
||||
private static async Task<Boot> StartNoGUI()
|
||||
{
|
||||
Console.Clear();
|
||||
Console.ForegroundColor = ConsoleColor.DarkYellow;
|
||||
Console.WriteLine("Discord BOT for Cross Platform");
|
||||
Console.WriteLine("Created by: Wizzy\nDiscord: Wizzy#9181");
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.White;
|
||||
Console.WriteLine("============================ Discord BOT - Cross Platform ============================");
|
||||
string token = Config.GetValue("token");
|
||||
string prefix = Config.GetValue("prefix");
|
||||
|
||||
var discordbooter = new Boot(token, prefix);
|
||||
await discordbooter.Awake();
|
||||
return discordbooter;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clear folder
|
||||
/// </summary>
|
||||
/// <param name="d">Directory path</param>
|
||||
private static Task ClearFolder(string d)
|
||||
{
|
||||
string[] files = Directory.GetFiles(d);
|
||||
int fileNumb = files.Length;
|
||||
for (var i = 0; i < fileNumb; i++)
|
||||
{
|
||||
File.Delete(files[i]);
|
||||
Console.WriteLine("Deleting : " + files[i]);
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle user input arguments from the startup of the application
|
||||
/// </summary>
|
||||
/// <param name="args">The arguments</param>
|
||||
private static async Task HandleInput(string[] args)
|
||||
{
|
||||
int len = args.Length;
|
||||
if (len == 1 && args[0] == "--help")
|
||||
{
|
||||
Console.WriteLine("Available commands:\n--exec -> start the bot with tools enabled");
|
||||
return;
|
||||
}
|
||||
|
||||
if (len == 1 && args[0] == "--logout")
|
||||
{
|
||||
File.Delete(Functions.dataFolder + "var.dat");
|
||||
await Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
Environment.Exit(0x08);
|
||||
}
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (len >= 2 && args[0] == "--encrypt")
|
||||
{
|
||||
string s2e = args.MergeStrings(1);
|
||||
Console.WriteLine("MD5: " + await Cryptography.CreateMD5(s2e));
|
||||
Console.WriteLine("SHA356: " + await Cryptography.CreateSHA256(s2e));
|
||||
return;
|
||||
}
|
||||
|
||||
if (len > 0 && (args.Contains("--cmd") || args.Contains("--args") || args.Contains("--nomessage")))
|
||||
{
|
||||
if (args.Contains("lp") || args.Contains("loadplugins")) loadPluginsOnStartup = true;
|
||||
if (args.Contains("listplugs")) listPluginsAtStartup = true;
|
||||
if (args.Contains("listlang")) listLanguagAtStartup = true;
|
||||
//if (args.Contains("--nomessage")) ShowStartupMessage = false;
|
||||
len = 0;
|
||||
}
|
||||
|
||||
|
||||
if (len == 0 || args[0] != "--exec" && args[0] != "--execute")
|
||||
{
|
||||
Boot b = await StartNoGUI();
|
||||
await NoGUI(b);
|
||||
return;
|
||||
}
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.DarkYellow;
|
||||
Console.WriteLine("Execute command interface noGUI\n\n");
|
||||
Console.WriteLine(
|
||||
"\tCommand name\t\t\t\tDescription\n" +
|
||||
"-- help | -help\t\t ------ \tDisplay the help message\n" +
|
||||
"--reset-full\t\t ------ \tReset all files (clear files)\n" +
|
||||
"--reset-settings\t ------ \tReset only bot settings\n" +
|
||||
"--reset-logs\t\t ------ \tClear up the output folder\n" +
|
||||
"--start\t\t ------ \tStart the bot\n" +
|
||||
"exit\t\t\t ------ \tClose the application"
|
||||
);
|
||||
while (true)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.White;
|
||||
Console.Write("> ");
|
||||
string[] message = Console.ReadLine().Split(' ');
|
||||
|
||||
switch (message[0])
|
||||
{
|
||||
case "--reset-settings":
|
||||
await ResetSettings();
|
||||
Console.WriteLine("Successfully reseted all settings !");
|
||||
break;
|
||||
case "--help":
|
||||
case "-help":
|
||||
Console.ForegroundColor = ConsoleColor.DarkYellow;
|
||||
Console.WriteLine(
|
||||
"\tCommand name\t\t\t\tDescription\n" +
|
||||
"-- help | -help\t\t ------ \tDisplay the help message\n" +
|
||||
"--reset-full\t\t ------ \tReset all files (clear files)\n" +
|
||||
"--reset-settings\t ------ \tReset only bot settings\n" +
|
||||
"--reset-logs\t\t ------ \tClear up the output folder\n" +
|
||||
"--start\t\t ------ \tStart the bot\n" +
|
||||
"exit\t\t\t ------ \tClose the application"
|
||||
);
|
||||
break;
|
||||
case "--reset-full":
|
||||
await ClearFolder("./Data/Resources/");
|
||||
await ClearFolder("./Output/Logs/");
|
||||
await ClearFolder("./Output/Errors");
|
||||
await ClearFolder("./Data/Languages/");
|
||||
await ClearFolder("./Data/Plugins/Commands");
|
||||
await ClearFolder("./Data/Plugins/Events");
|
||||
Console.WriteLine("Successfully cleared all folders");
|
||||
break;
|
||||
case "--reset-logs":
|
||||
await ClearFolder("./Output/Logs");
|
||||
await ClearFolder("./Output/Errors");
|
||||
Console.WriteLine("Successfully cleard logs folder");
|
||||
break;
|
||||
case "--exit":
|
||||
case "exit":
|
||||
Environment.Exit(0);
|
||||
break;
|
||||
case "--start":
|
||||
Boot booter = await StartNoGUI();
|
||||
await NoGUI(booter);
|
||||
return;
|
||||
default:
|
||||
Console.WriteLine("Failed to execute command " + message[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
113
DiscordBotCore.Configuration/Configuration.cs
Normal file
113
DiscordBotCore.Configuration/Configuration.cs
Normal file
@@ -0,0 +1,113 @@
|
||||
using DiscordBotCore.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace DiscordBotCore.Configuration;
|
||||
|
||||
public class Configuration : ConfigurationBase
|
||||
{
|
||||
private readonly bool _EnableAutoAddOnGetWithDefault;
|
||||
private Configuration(ILogger logger, string diskLocation, bool enableAutoAddOnGetWithDefault): base(logger, diskLocation)
|
||||
{
|
||||
_EnableAutoAddOnGetWithDefault = enableAutoAddOnGetWithDefault;
|
||||
}
|
||||
|
||||
public override async Task SaveToFile()
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(_InternalDictionary, Formatting.Indented);
|
||||
await File.WriteAllTextAsync(_DiskLocation, json);
|
||||
}
|
||||
|
||||
public override T Get<T>(string key, T defaultValue)
|
||||
{
|
||||
T value = base.Get(key, defaultValue);
|
||||
|
||||
if (_EnableAutoAddOnGetWithDefault && value.Equals(defaultValue))
|
||||
{
|
||||
Add(key, defaultValue);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public override List<T> GetList<T>(string key, List<T> defaultValue)
|
||||
{
|
||||
List<T> value = base.GetList(key, defaultValue);
|
||||
|
||||
if (_EnableAutoAddOnGetWithDefault && value.All(defaultValue.Contains))
|
||||
{
|
||||
Add(key, defaultValue);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public override void LoadFromFile()
|
||||
{
|
||||
if (!File.Exists(_DiskLocation))
|
||||
{
|
||||
SaveToFile().Wait();
|
||||
return;
|
||||
}
|
||||
|
||||
string jsonContent = File.ReadAllText(_DiskLocation);
|
||||
var jObject = JsonConvert.DeserializeObject<JObject>(jsonContent);
|
||||
|
||||
if (jObject is null)
|
||||
{
|
||||
SaveToFile().Wait();
|
||||
return;
|
||||
}
|
||||
|
||||
_InternalDictionary.Clear();
|
||||
|
||||
foreach (var kvp in jObject)
|
||||
{
|
||||
AddPairToDictionary(kvp, _InternalDictionary);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddPairToDictionary(KeyValuePair<string, JToken> kvp, IDictionary<string, object> dict)
|
||||
{
|
||||
if (kvp.Value is JObject nestedJObject)
|
||||
{
|
||||
dict[kvp.Key] = nestedJObject.ToObject<Dictionary<string, object>>();
|
||||
|
||||
foreach (var nestedKvp in nestedJObject)
|
||||
{
|
||||
AddPairToDictionary(nestedKvp, dict[kvp.Key] as Dictionary<string, object>);
|
||||
}
|
||||
}
|
||||
else if (kvp.Value is JArray nestedJArray)
|
||||
{
|
||||
dict[kvp.Key] = nestedJArray.ToObject<List<object>>();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (kvp.Value.Type == JTokenType.Integer)
|
||||
dict[kvp.Key] = kvp.Value.Value<int>();
|
||||
else if (kvp.Value.Type == JTokenType.Float)
|
||||
dict[kvp.Key] = kvp.Value.Value<float>();
|
||||
else if (kvp.Value.Type == JTokenType.Boolean)
|
||||
dict[kvp.Key] = kvp.Value.Value<bool>();
|
||||
else if (kvp.Value.Type == JTokenType.String)
|
||||
dict[kvp.Key] = kvp.Value.Value<string>();
|
||||
else if (kvp.Value.Type == JTokenType.Date)
|
||||
dict[kvp.Key] = kvp.Value.Value<DateTime>();
|
||||
else
|
||||
dict[kvp.Key] = kvp.Value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new Settings Dictionary from a file
|
||||
/// </summary>
|
||||
/// <param name="baseFile">The file location</param>
|
||||
/// <param name="enableAutoAddOnGetWithDefault">Set this to true if you want to update the dictionary with default values on get</param>
|
||||
public static Configuration CreateFromFile(ILogger logger, string baseFile, bool enableAutoAddOnGetWithDefault)
|
||||
{
|
||||
var settings = new Configuration(logger, baseFile, enableAutoAddOnGetWithDefault);
|
||||
settings.LoadFromFile();
|
||||
return settings;
|
||||
}
|
||||
}
|
||||
167
DiscordBotCore.Configuration/ConfigurationBase.cs
Normal file
167
DiscordBotCore.Configuration/ConfigurationBase.cs
Normal file
@@ -0,0 +1,167 @@
|
||||
using System.Collections;
|
||||
using System.Net.Mime;
|
||||
using DiscordBotCore.Logging;
|
||||
|
||||
namespace DiscordBotCore.Configuration;
|
||||
|
||||
public abstract class ConfigurationBase : IConfiguration
|
||||
{
|
||||
protected readonly IDictionary<string, object> _InternalDictionary = new Dictionary<string, object>();
|
||||
protected readonly string _DiskLocation;
|
||||
protected readonly ILogger _Logger;
|
||||
|
||||
protected ConfigurationBase(ILogger logger, string diskLocation)
|
||||
{
|
||||
this._DiskLocation = diskLocation;
|
||||
this._Logger = logger;
|
||||
}
|
||||
|
||||
public virtual void Add(string key, object? value)
|
||||
{
|
||||
if (_InternalDictionary.ContainsKey(key))
|
||||
return;
|
||||
|
||||
if (value is null)
|
||||
return;
|
||||
|
||||
_InternalDictionary.Add(key, value);
|
||||
}
|
||||
|
||||
public virtual void Set(string key, object value)
|
||||
{
|
||||
_InternalDictionary[key] = value;
|
||||
}
|
||||
|
||||
public virtual object Get(string key)
|
||||
{
|
||||
return _InternalDictionary[key];
|
||||
}
|
||||
|
||||
public virtual T Get<T>(string key, T defaulobject)
|
||||
{
|
||||
if (_InternalDictionary.TryGetValue(key, out var value))
|
||||
{
|
||||
return (T)Convert.ChangeType(value, typeof(T));
|
||||
}
|
||||
|
||||
return defaulobject;
|
||||
}
|
||||
|
||||
public virtual T? Get<T>(string key)
|
||||
{
|
||||
if (_InternalDictionary.TryGetValue(key, out var value))
|
||||
{
|
||||
return (T)Convert.ChangeType(value, typeof(T));
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
public virtual IDictionary<TSubKey, TSubValue> GetDictionary<TSubKey, TSubValue>(string key)
|
||||
{
|
||||
if (_InternalDictionary.TryGetValue(key, out var value))
|
||||
{
|
||||
if (value is not IDictionary)
|
||||
{
|
||||
throw new Exception("The value is not a dictionary");
|
||||
}
|
||||
|
||||
var dictionary = new Dictionary<TSubKey, TSubValue>();
|
||||
foreach (DictionaryEntry item in (IDictionary)value)
|
||||
{
|
||||
dictionary.Add((TSubKey)Convert.ChangeType(item.Key, typeof(TSubKey)), (TSubValue)Convert.ChangeType(item.Value, typeof(TSubValue)));
|
||||
}
|
||||
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
return new Dictionary<TSubKey, TSubValue>();
|
||||
}
|
||||
|
||||
public virtual List<T> GetList<T>(string key, List<T> defaulobject)
|
||||
{
|
||||
if(_InternalDictionary.TryGetValue(key, out var value))
|
||||
{
|
||||
if (value is not IList)
|
||||
{
|
||||
throw new Exception("The value is not a list");
|
||||
}
|
||||
|
||||
var list = new List<T>();
|
||||
foreach (object? item in (IList)value)
|
||||
{
|
||||
list.Add((T)Convert.ChangeType(item, typeof(T)));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
_Logger.Log($"Key '{key}' not found in settings dictionary. Adding default value.", LogType.Warning);
|
||||
|
||||
return defaulobject;
|
||||
}
|
||||
|
||||
public virtual void Remove(string key)
|
||||
{
|
||||
_InternalDictionary.Remove(key);
|
||||
}
|
||||
|
||||
public virtual IEnumerator<KeyValuePair<string, object>> GetEnumerator()
|
||||
{
|
||||
return _InternalDictionary.GetEnumerator();
|
||||
}
|
||||
|
||||
public virtual void Clear()
|
||||
{
|
||||
_InternalDictionary.Clear();
|
||||
}
|
||||
|
||||
public virtual bool ContainsKey(string key)
|
||||
{
|
||||
return _InternalDictionary.ContainsKey(key);
|
||||
}
|
||||
|
||||
public virtual IEnumerable<KeyValuePair<string, object>> Where(Func<KeyValuePair<string, object>, bool> predicate)
|
||||
{
|
||||
return _InternalDictionary.Where(predicate);
|
||||
}
|
||||
|
||||
public virtual IEnumerable<KeyValuePair<string, object>> Where(Func<KeyValuePair<string, object>, int, bool> predicate)
|
||||
{
|
||||
return _InternalDictionary.Where(predicate);
|
||||
}
|
||||
|
||||
public virtual IEnumerable<TResult> Where<TResult>(Func<KeyValuePair<string, object>, TResult> selector)
|
||||
{
|
||||
return _InternalDictionary.Select(selector);
|
||||
}
|
||||
|
||||
public virtual IEnumerable<TResult> Where<TResult>(Func<KeyValuePair<string, object>, int, TResult> selector)
|
||||
{
|
||||
return _InternalDictionary.Select(selector);
|
||||
}
|
||||
|
||||
public virtual KeyValuePair<string, object> FirstOrDefault(Func<KeyValuePair<string, object>, bool> predicate)
|
||||
{
|
||||
return _InternalDictionary.FirstOrDefault(predicate);
|
||||
}
|
||||
|
||||
public virtual KeyValuePair<string, object> FirstOrDefault()
|
||||
{
|
||||
return _InternalDictionary.FirstOrDefault();
|
||||
}
|
||||
|
||||
public virtual bool ContainsAllKeys(params string[] keys)
|
||||
{
|
||||
return keys.All(ContainsKey);
|
||||
}
|
||||
|
||||
public virtual bool TryGetValue(string key, out object? value)
|
||||
{
|
||||
return _InternalDictionary.TryGetValue(key, out value);
|
||||
}
|
||||
|
||||
public abstract Task SaveToFile();
|
||||
|
||||
public abstract void LoadFromFile();
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Platforms>AnyCPU;x64;ARM64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DiscordBotCore.Logging\DiscordBotCore.Logging.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
132
DiscordBotCore.Configuration/IConfiguration.cs
Normal file
132
DiscordBotCore.Configuration/IConfiguration.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
namespace DiscordBotCore.Configuration;
|
||||
|
||||
public interface IConfiguration
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds an element to the custom settings dictionary
|
||||
/// </summary>
|
||||
/// <param name="key">The key</param>
|
||||
/// <param name="value">The value</param>
|
||||
void Add(string key, object value);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the value of a key in the custom settings dictionary
|
||||
/// </summary>
|
||||
/// <param name="key">The key</param>
|
||||
/// <param name="value">The value</param>
|
||||
void Set(string key, object value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of a key in the custom settings dictionary. If the T type is different then the object type, it will try to convert it.
|
||||
/// </summary>
|
||||
/// <param name="key">The key</param>
|
||||
/// <param name="defaultObject">The default value to be returned if the searched value is not found</param>
|
||||
/// <typeparam name="T">The type of the returned value</typeparam>
|
||||
/// <returns></returns>
|
||||
T Get<T>(string key, T defaultObject);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of a key in the custom settings dictionary. If the T type is different then the object type, it will try to convert it.
|
||||
/// </summary>
|
||||
/// <param name="key">The key</param>
|
||||
/// <typeparam name="T">The type of the returned value</typeparam>
|
||||
/// <returns></returns>
|
||||
T? Get<T>(string key);
|
||||
|
||||
/// <summary>
|
||||
/// Get a list of values from the custom settings dictionary
|
||||
/// </summary>
|
||||
/// <param name="key">The key</param>
|
||||
/// <param name="defaultObject">The default list to be returned if nothing is found</param>
|
||||
/// <typeparam name="T">The type of the returned value</typeparam>
|
||||
/// <returns></returns>
|
||||
List<T> GetList<T>(string key, List<T> defaultObject);
|
||||
|
||||
/// <summary>
|
||||
/// Remove a key from the custom settings dictionary
|
||||
/// </summary>
|
||||
/// <param name="key">The key</param>
|
||||
void Remove(string key);
|
||||
|
||||
/// <summary>
|
||||
/// Get the enumerator of the custom settings dictionary
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
IEnumerator<KeyValuePair<string, object>> GetEnumerator();
|
||||
|
||||
/// <summary>
|
||||
/// Clear the custom settings dictionary
|
||||
/// </summary>
|
||||
void Clear();
|
||||
|
||||
/// <summary>
|
||||
/// Check if the custom settings dictionary contains a key
|
||||
/// </summary>
|
||||
/// <param name="key">The key</param>
|
||||
/// <returns></returns>
|
||||
bool ContainsKey(string key);
|
||||
|
||||
/// <summary>
|
||||
/// Filter the custom settings dictionary based on a predicate
|
||||
/// </summary>
|
||||
/// <param name="predicate">The predicate</param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<KeyValuePair<string, object>> Where(Func<KeyValuePair<string, object>, bool> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Filter the custom settings dictionary based on a predicate
|
||||
/// </summary>
|
||||
/// <param name="predicate">The predicate</param>
|
||||
IEnumerable<KeyValuePair<string, object>> Where(Func<KeyValuePair<string, object>, int, bool> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Filter the custom settings dictionary based on a predicate
|
||||
/// </summary>
|
||||
/// <param name="selector">The predicate</param>
|
||||
IEnumerable<TResult> Where<TResult>(Func<KeyValuePair<string, object>, TResult> selector);
|
||||
|
||||
/// <summary>
|
||||
/// Filter the custom settings dictionary based on a predicate
|
||||
/// </summary>
|
||||
/// <param name="selector">The predicate</param>
|
||||
IEnumerable<TResult> Where<TResult>(Func<KeyValuePair<string, object>, int, TResult> selector);
|
||||
|
||||
/// <summary>
|
||||
/// Get the first element of the custom settings dictionary based on a predicate
|
||||
/// </summary>
|
||||
/// <param name="predicate">The predicate</param>
|
||||
KeyValuePair<string, object> FirstOrDefault(Func<KeyValuePair<string, object>, bool> predicate);
|
||||
|
||||
/// <summary>
|
||||
/// Get the first element of the custom settings dictionary
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
KeyValuePair<string, object> FirstOrDefault();
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the custom settings dictionary contains all the keys
|
||||
/// </summary>
|
||||
/// <param name="keys">A list of keys</param>
|
||||
/// <returns></returns>
|
||||
bool ContainsAllKeys(params string[] keys);
|
||||
|
||||
/// <summary>
|
||||
/// Try to get the value of a key in the custom settings dictionary
|
||||
/// </summary>
|
||||
/// <param name="key">The key</param>
|
||||
/// <param name="value">The value</param>
|
||||
/// <returns></returns>
|
||||
bool TryGetValue(string key, out object? value);
|
||||
|
||||
/// <summary>
|
||||
/// Save the custom settings dictionary to a file
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task SaveToFile();
|
||||
|
||||
/// <summary>
|
||||
/// Load the custom settings dictionary from a file
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
void LoadFromFile();
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Platforms>AnyCPU;x64;ARM64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="9.0.9" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
693
DiscordBotCore.Database.Sqlite/SqlDatabase.cs
Normal file
693
DiscordBotCore.Database.Sqlite/SqlDatabase.cs
Normal file
@@ -0,0 +1,693 @@
|
||||
using System.Data;
|
||||
using Microsoft.Data.Sqlite;
|
||||
|
||||
namespace DiscordBotCore.Database.Sqlite;
|
||||
|
||||
public class SqlDatabase
|
||||
{
|
||||
private readonly SqliteConnection _Connection;
|
||||
|
||||
/// <summary>
|
||||
/// Initialize a SQL connection by specifying its private path
|
||||
/// </summary>
|
||||
/// <param name="fileName">The path to the database (it is starting from ./Data/Resources/)</param>
|
||||
public SqlDatabase(string fileName)
|
||||
{
|
||||
var connectionString = $"Data Source={fileName}";
|
||||
_Connection = new SqliteConnection(connectionString);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Open the SQL Connection. To close use the Stop() method
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task Open()
|
||||
{
|
||||
await _Connection.OpenAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Insert into a specified table some values
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="tableName">The table name</param>
|
||||
/// <param name="values">The values to be inserted (in the correct order and number)</param>
|
||||
/// <returns></returns>
|
||||
public async Task InsertAsync(string tableName, params string[] values)
|
||||
{
|
||||
var query = $"INSERT INTO {tableName} VALUES (";
|
||||
for (var i = 0; i < values.Length; i++)
|
||||
{
|
||||
query += $"'{values[i]}'";
|
||||
if (i != values.Length - 1)
|
||||
query += ", ";
|
||||
}
|
||||
|
||||
query += ")";
|
||||
|
||||
var command = new SqliteCommand(query, _Connection);
|
||||
await command.ExecuteNonQueryAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Insert into a specified table some values
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="tableName">The table name</param>
|
||||
/// <param name="values">The values to be inserted (in the correct order and number)</param>
|
||||
/// <returns></returns>
|
||||
public void Insert(string tableName, params string[] values)
|
||||
{
|
||||
var query = $"INSERT INTO {tableName} VALUES (";
|
||||
for (var i = 0; i < values.Length; i++)
|
||||
{
|
||||
query += $"'{values[i]}'";
|
||||
if (i != values.Length - 1)
|
||||
query += ", ";
|
||||
}
|
||||
|
||||
query += ")";
|
||||
|
||||
var command = new SqliteCommand(query, _Connection);
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove every row in a table that has a certain propery
|
||||
/// </summary>
|
||||
/// <param name="tableName">The table name</param>
|
||||
/// <param name="KeyName">The column name that the search is made by</param>
|
||||
/// <param name="KeyValue">The value that is searched in the specified column</param>
|
||||
/// <returns></returns>
|
||||
public async Task RemoveKeyAsync(string tableName, string KeyName, string KeyValue)
|
||||
{
|
||||
var query = $"DELETE FROM {tableName} WHERE {KeyName} = '{KeyValue}'";
|
||||
|
||||
var command = new SqliteCommand(query, _Connection);
|
||||
await command.ExecuteNonQueryAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove every row in a table that has a certain propery
|
||||
/// </summary>
|
||||
/// <param name="tableName">The table name</param>
|
||||
/// <param name="KeyName">The column name that the search is made by</param>
|
||||
/// <param name="KeyValue">The value that is searched in the specified column</param>
|
||||
/// <returns></returns>
|
||||
public void RemoveKey(string tableName, string KeyName, string KeyValue)
|
||||
{
|
||||
var query = $"DELETE FROM {tableName} WHERE {KeyName} = '{KeyValue}'";
|
||||
|
||||
var command = new SqliteCommand(query, _Connection);
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the key exists in the table
|
||||
/// </summary>
|
||||
/// <param name="tableName">The table name</param>
|
||||
/// <param name="keyName">The column that the search is made by</param>
|
||||
/// <param name="KeyValue">The value that is searched in the specified column</param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> KeyExistsAsync(string tableName, string keyName, string KeyValue)
|
||||
{
|
||||
var query = $"SELECT * FROM {tableName} where {keyName} = '{KeyValue}'";
|
||||
|
||||
if (await ReadDataAsync(query) is not null)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the key exists in the table
|
||||
/// </summary>
|
||||
/// <param name="tableName">The table name</param>
|
||||
/// <param name="keyName">The column that the search is made by</param>
|
||||
/// <param name="KeyValue">The value that is searched in the specified column</param>
|
||||
/// <returns></returns>
|
||||
public bool KeyExists(string tableName, string keyName, string KeyValue)
|
||||
{
|
||||
var query = $"SELECT * FROM {tableName} where {keyName} = '{KeyValue}'";
|
||||
|
||||
if (ReadData(query) is not null)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set value of a column in a table
|
||||
/// </summary>
|
||||
/// <param name="tableName">The table name</param>
|
||||
/// <param name="keyName">The column that the search is made by</param>
|
||||
/// <param name="KeyValue">The value that is searched in the column specified</param>
|
||||
/// <param name="ResultColumnName">The column that has to be modified</param>
|
||||
/// <param name="ResultColumnValue">The new value that will replace the old value from the column specified</param>
|
||||
public async Task SetValueAsync(
|
||||
string tableName, string keyName, string KeyValue, string ResultColumnName,
|
||||
string ResultColumnValue)
|
||||
{
|
||||
if (!await TableExistsAsync(tableName))
|
||||
throw new Exception($"Table {tableName} does not exist");
|
||||
|
||||
await ExecuteAsync(
|
||||
$"UPDATE {tableName} SET {ResultColumnName}='{ResultColumnValue}' WHERE {keyName}='{KeyValue}'"
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set value of a column in a table
|
||||
/// </summary>
|
||||
/// <param name="tableName">The table name</param>
|
||||
/// <param name="keyName">The column that the search is made by</param>
|
||||
/// <param name="KeyValue">The value that is searched in the column specified</param>
|
||||
/// <param name="ResultColumnName">The column that has to be modified</param>
|
||||
/// <param name="ResultColumnValue">The new value that will replace the old value from the column specified</param>
|
||||
public void SetValue(
|
||||
string tableName, string keyName, string KeyValue, string ResultColumnName,
|
||||
string ResultColumnValue)
|
||||
{
|
||||
if (!TableExists(tableName))
|
||||
throw new Exception($"Table {tableName} does not exist");
|
||||
|
||||
Execute($"UPDATE {tableName} SET {ResultColumnName}='{ResultColumnValue}' WHERE {keyName}='{KeyValue}'");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get value from a column in a table
|
||||
/// </summary>
|
||||
/// <param name="tableName">The table name</param>
|
||||
/// <param name="keyName">The column that the search is made by</param>
|
||||
/// <param name="KeyValue">The value that is searched in the specified column</param>
|
||||
/// <param name="ResultColumnName">The column that has the result</param>
|
||||
/// <returns>A string that has the requested value (can be null if nothing found)</returns>
|
||||
public async Task<string?> GetValueAsync(
|
||||
string tableName, string keyName, string KeyValue,
|
||||
string ResultColumnName)
|
||||
{
|
||||
if (!await TableExistsAsync(tableName))
|
||||
throw new Exception($"Table {tableName} does not exist");
|
||||
|
||||
return await ReadDataAsync($"SELECT {ResultColumnName} FROM {tableName} WHERE {keyName}='{KeyValue}'");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get value from a column in a table
|
||||
/// </summary>
|
||||
/// <param name="tableName">The table name</param>
|
||||
/// <param name="keyName">The column that the search is made by</param>
|
||||
/// <param name="KeyValue">The value that is searched in the specified column</param>
|
||||
/// <param name="ResultColumnName">The column that has the result</param>
|
||||
/// <returns>A string that has the requested value (can be null if nothing found)</returns>
|
||||
public string? GetValue(string tableName, string keyName, string KeyValue, string ResultColumnName)
|
||||
{
|
||||
if (!TableExists(tableName))
|
||||
throw new Exception($"Table {tableName} does not exist");
|
||||
|
||||
return ReadData($"SELECT {ResultColumnName} FROM {tableName} WHERE {keyName}='{KeyValue}'");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stop the connection to the SQL Database
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async void Stop()
|
||||
{
|
||||
await _Connection.CloseAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Change the structure of a table by adding new columns
|
||||
/// </summary>
|
||||
/// <param name="tableName">The table name</param>
|
||||
/// <param name="columns">The columns to be added</param>
|
||||
/// <param name="TYPE">The type of the columns (TEXT, INTEGER, FLOAT, etc)</param>
|
||||
/// <returns></returns>
|
||||
public async Task AddColumnsToTableAsync(string tableName, string[] columns, string TYPE = "TEXT")
|
||||
{
|
||||
var command = _Connection.CreateCommand();
|
||||
command.CommandText = $"SELECT * FROM {tableName}";
|
||||
var reader = await command.ExecuteReaderAsync();
|
||||
var tableColumns = new List<string>();
|
||||
for (var i = 0; i < reader.FieldCount; i++)
|
||||
tableColumns.Add(reader.GetName(i));
|
||||
|
||||
foreach (var column in columns)
|
||||
if (!tableColumns.Contains(column))
|
||||
{
|
||||
command.CommandText = $"ALTER TABLE {tableName} ADD COLUMN {column} {TYPE}";
|
||||
await command.ExecuteNonQueryAsync();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Change the structure of a table by adding new columns
|
||||
/// </summary>
|
||||
/// <param name="tableName">The table name</param>
|
||||
/// <param name="columns">The columns to be added</param>
|
||||
/// <param name="TYPE">The type of the columns (TEXT, INTEGER, FLOAT, etc)</param>
|
||||
/// <returns></returns>
|
||||
public void AddColumnsToTable(string tableName, string[] columns, string TYPE = "TEXT")
|
||||
{
|
||||
var command = _Connection.CreateCommand();
|
||||
command.CommandText = $"SELECT * FROM {tableName}";
|
||||
var reader = command.ExecuteReader();
|
||||
var tableColumns = new List<string>();
|
||||
for (var i = 0; i < reader.FieldCount; i++)
|
||||
tableColumns.Add(reader.GetName(i));
|
||||
|
||||
foreach (var column in columns)
|
||||
if (!tableColumns.Contains(column))
|
||||
{
|
||||
command.CommandText = $"ALTER TABLE {tableName} ADD COLUMN {column} {TYPE}";
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if a table exists
|
||||
/// </summary>
|
||||
/// <param name="tableName">The table name</param>
|
||||
/// <returns>True if the table exists, false if not</returns>
|
||||
public async Task<bool> TableExistsAsync(string tableName)
|
||||
{
|
||||
var cmd = _Connection.CreateCommand();
|
||||
cmd.CommandText = $"SELECT name FROM sqlite_master WHERE type='table' AND name='{tableName}'";
|
||||
var result = await cmd.ExecuteScalarAsync();
|
||||
|
||||
if (result == null)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if a table exists
|
||||
/// </summary>
|
||||
/// <param name="tableName">The table name</param>
|
||||
/// <returns>True if the table exists, false if not</returns>
|
||||
public bool TableExists(string tableName)
|
||||
{
|
||||
var cmd = _Connection.CreateCommand();
|
||||
cmd.CommandText = $"SELECT name FROM sqlite_master WHERE type='table' AND name='{tableName}'";
|
||||
var result = cmd.ExecuteScalar();
|
||||
|
||||
if (result == null)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a table
|
||||
/// </summary>
|
||||
/// <param name="tableName">The table name</param>
|
||||
/// <param name="columns">The columns of the table</param>
|
||||
/// <returns></returns>
|
||||
public async Task CreateTableAsync(string tableName, params string[] columns)
|
||||
{
|
||||
var cmd = _Connection.CreateCommand();
|
||||
cmd.CommandText = $"CREATE TABLE IF NOT EXISTS {tableName} ({string.Join(", ", columns)})";
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a table
|
||||
/// </summary>
|
||||
/// <param name="tableName">The table name</param>
|
||||
/// <param name="columns">The columns of the table</param>
|
||||
/// <returns></returns>
|
||||
public void CreateTable(string tableName, params string[] columns)
|
||||
{
|
||||
var cmd = _Connection.CreateCommand();
|
||||
cmd.CommandText = $"CREATE TABLE IF NOT EXISTS {tableName} ({string.Join(", ", columns)})";
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Execute a custom query
|
||||
/// </summary>
|
||||
/// <param name="query">The query</param>
|
||||
/// <returns>The number of rows that the query modified</returns>
|
||||
public async Task<int> ExecuteAsync(string query)
|
||||
{
|
||||
if (!_Connection.State.HasFlag(ConnectionState.Open))
|
||||
await _Connection.OpenAsync();
|
||||
var command = new SqliteCommand(query, _Connection);
|
||||
var answer = await command.ExecuteNonQueryAsync();
|
||||
return answer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Execute a custom query
|
||||
/// </summary>
|
||||
/// <param name="query">The query</param>
|
||||
/// <returns>The number of rows that the query modified</returns>
|
||||
public int Execute(string query)
|
||||
{
|
||||
if (!_Connection.State.HasFlag(ConnectionState.Open))
|
||||
_Connection.Open();
|
||||
var command = new SqliteCommand(query, _Connection);
|
||||
var r = command.ExecuteNonQuery();
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read data from the result table and return the first row
|
||||
/// </summary>
|
||||
/// <param name="query">The query</param>
|
||||
/// <returns>The result is a string that has all values separated by space character</returns>
|
||||
public async Task<string?> ReadDataAsync(string query)
|
||||
{
|
||||
if (!_Connection.State.HasFlag(ConnectionState.Open))
|
||||
await _Connection.OpenAsync();
|
||||
var command = new SqliteCommand(query, _Connection);
|
||||
var reader = await command.ExecuteReaderAsync();
|
||||
|
||||
var values = new object[reader.FieldCount];
|
||||
if (reader.Read())
|
||||
{
|
||||
reader.GetValues(values);
|
||||
return string.Join<object>(" ", values);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read data from the result table and return the first row
|
||||
/// </summary>
|
||||
/// <param name="query">The query</param>
|
||||
/// <param name="parameters">The parameters of the query</param>
|
||||
/// <returns>The result is a string that has all values separated by space character</returns>
|
||||
public async Task<string?> ReadDataAsync(string query, params KeyValuePair<string, object>[] parameters)
|
||||
{
|
||||
if (!_Connection.State.HasFlag(ConnectionState.Open))
|
||||
await _Connection.OpenAsync();
|
||||
|
||||
var command = new SqliteCommand(query, _Connection);
|
||||
foreach (var parameter in parameters)
|
||||
{
|
||||
var p = CreateParameter(parameter);
|
||||
if (p is not null)
|
||||
command.Parameters.Add(p);
|
||||
}
|
||||
|
||||
var reader = await command.ExecuteReaderAsync();
|
||||
|
||||
var values = new object[reader.FieldCount];
|
||||
if (reader.Read())
|
||||
{
|
||||
reader.GetValues(values);
|
||||
return string.Join<object>(" ", values);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read data from the result table and return the first row
|
||||
/// </summary>
|
||||
/// <param name="query">The query</param>
|
||||
/// <returns>The result is a string that has all values separated by space character</returns>
|
||||
public string? ReadData(string query)
|
||||
{
|
||||
if (!_Connection.State.HasFlag(ConnectionState.Open))
|
||||
_Connection.Open();
|
||||
var command = new SqliteCommand(query, _Connection);
|
||||
var reader = command.ExecuteReader();
|
||||
|
||||
var values = new object[reader.FieldCount];
|
||||
if (reader.Read())
|
||||
{
|
||||
reader.GetValues(values);
|
||||
return string.Join<object>(" ", values);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read data from the result table and return the first row
|
||||
/// </summary>
|
||||
/// <param name="query">The query</param>
|
||||
/// <returns>The first row as separated items</returns>
|
||||
public async Task<object[]?> ReadDataArrayAsync(string query)
|
||||
{
|
||||
if (!_Connection.State.HasFlag(ConnectionState.Open))
|
||||
await _Connection.OpenAsync();
|
||||
var command = new SqliteCommand(query, _Connection);
|
||||
var reader = await command.ExecuteReaderAsync();
|
||||
|
||||
var values = new object[reader.FieldCount];
|
||||
if (reader.Read())
|
||||
{
|
||||
reader.GetValues(values);
|
||||
return values;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public async Task<object[]?> ReadDataArrayAsync(string query, params KeyValuePair<string, object>[] parameters)
|
||||
{
|
||||
if (!_Connection.State.HasFlag(ConnectionState.Open))
|
||||
await _Connection.OpenAsync();
|
||||
|
||||
var command = new SqliteCommand(query, _Connection);
|
||||
foreach (var parameter in parameters)
|
||||
{
|
||||
var p = CreateParameter(parameter);
|
||||
if (p is not null)
|
||||
command.Parameters.Add(p);
|
||||
}
|
||||
|
||||
var reader = await command.ExecuteReaderAsync();
|
||||
|
||||
var values = new object[reader.FieldCount];
|
||||
if (reader.Read())
|
||||
{
|
||||
reader.GetValues(values);
|
||||
return values;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read data from the result table and return the first row
|
||||
/// </summary>
|
||||
/// <param name="query">The query</param>
|
||||
/// <returns>The first row as separated items</returns>
|
||||
public object[]? ReadDataArray(string query)
|
||||
{
|
||||
if (!_Connection.State.HasFlag(ConnectionState.Open))
|
||||
_Connection.Open();
|
||||
var command = new SqliteCommand(query, _Connection);
|
||||
var reader = command.ExecuteReader();
|
||||
|
||||
var values = new object[reader.FieldCount];
|
||||
if (reader.Read())
|
||||
{
|
||||
reader.GetValues(values);
|
||||
return values;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read all rows from the result table and return them as a list of string arrays. The string arrays contain the
|
||||
/// values of each row
|
||||
/// </summary>
|
||||
/// <param name="query">The query</param>
|
||||
/// <returns>A list of string arrays representing the values that the query returns</returns>
|
||||
public async Task<List<string[]>?> ReadAllRowsAsync(string query)
|
||||
{
|
||||
if (!_Connection.State.HasFlag(ConnectionState.Open))
|
||||
await _Connection.OpenAsync();
|
||||
var command = new SqliteCommand(query, _Connection);
|
||||
var reader = await command.ExecuteReaderAsync();
|
||||
|
||||
if (!reader.HasRows)
|
||||
return null;
|
||||
|
||||
List<string[]> rows = new();
|
||||
while (await reader.ReadAsync())
|
||||
{
|
||||
var values = new string[reader.FieldCount];
|
||||
reader.GetValues(values);
|
||||
rows.Add(values);
|
||||
}
|
||||
|
||||
if (rows.Count == 0) return null;
|
||||
|
||||
return rows;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a parameter for a query
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the parameter</param>
|
||||
/// <param name="value">The value of the parameter</param>
|
||||
/// <returns>The SQLiteParameter that has the name, value and DBType set according to your inputs</returns>
|
||||
private static SqliteParameter? CreateParameter(string name, object value)
|
||||
{
|
||||
var parameter = new SqliteParameter();
|
||||
parameter.ParameterName = name;
|
||||
parameter.Value = value;
|
||||
|
||||
if (value is string)
|
||||
parameter.DbType = DbType.String;
|
||||
else if (value is int)
|
||||
parameter.DbType = DbType.Int32;
|
||||
else if (value is long)
|
||||
parameter.DbType = DbType.Int64;
|
||||
else if (value is float)
|
||||
parameter.DbType = DbType.Single;
|
||||
else if (value is double)
|
||||
parameter.DbType = DbType.Double;
|
||||
else if (value is bool)
|
||||
parameter.DbType = DbType.Boolean;
|
||||
else if (value is DateTime)
|
||||
parameter.DbType = DbType.DateTime;
|
||||
else if (value is byte[])
|
||||
parameter.DbType = DbType.Binary;
|
||||
else if (value is Guid)
|
||||
parameter.DbType = DbType.Guid;
|
||||
else if (value is decimal)
|
||||
parameter.DbType = DbType.Decimal;
|
||||
else if (value is TimeSpan)
|
||||
parameter.DbType = DbType.Time;
|
||||
else if (value is DateTimeOffset)
|
||||
parameter.DbType = DbType.DateTimeOffset;
|
||||
else if (value is ushort)
|
||||
parameter.DbType = DbType.UInt16;
|
||||
else if (value is uint)
|
||||
parameter.DbType = DbType.UInt32;
|
||||
else if (value is ulong)
|
||||
parameter.DbType = DbType.UInt64;
|
||||
else if (value is sbyte)
|
||||
parameter.DbType = DbType.SByte;
|
||||
else if (value is short)
|
||||
parameter.DbType = DbType.Int16;
|
||||
else if (value is byte)
|
||||
parameter.DbType = DbType.Byte;
|
||||
else if (value is char)
|
||||
parameter.DbType = DbType.StringFixedLength;
|
||||
else if (value is char[])
|
||||
parameter.DbType = DbType.StringFixedLength;
|
||||
else
|
||||
return null;
|
||||
|
||||
return parameter;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Create a parameter for a query. The function automatically detects the type of the value.
|
||||
/// </summary>
|
||||
/// <param name="parameterValues">The parameter raw inputs. The Key is name and the Value is the value of the parameter</param>
|
||||
/// <returns>The SQLiteParameter that has the name, value and DBType set according to your inputs</returns>
|
||||
private static SqliteParameter? CreateParameter(KeyValuePair<string, object> parameterValues)
|
||||
{
|
||||
return CreateParameter(parameterValues.Key, parameterValues.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Execute a query with parameters
|
||||
/// </summary>
|
||||
/// <param name="query">The query to execute</param>
|
||||
/// <param name="parameters">The parameters of the query</param>
|
||||
/// <returns>The number of rows that the query modified in the database</returns>
|
||||
public async Task<int> ExecuteNonQueryAsync(string query, params KeyValuePair<string, object>[] parameters)
|
||||
{
|
||||
if (!_Connection.State.HasFlag(ConnectionState.Open))
|
||||
await _Connection.OpenAsync();
|
||||
|
||||
var command = new SqliteCommand(query, _Connection);
|
||||
foreach (var parameter in parameters)
|
||||
{
|
||||
var p = CreateParameter(parameter);
|
||||
if (p is not null)
|
||||
command.Parameters.Add(p);
|
||||
}
|
||||
|
||||
return await command.ExecuteNonQueryAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Execute a query with parameters that returns a specific type of object. The function will return the first row of the result transformed into the specified type.
|
||||
/// </summary>
|
||||
/// <param name="query">The query to execute</param>
|
||||
/// <param name="convertor">The convertor function that will convert each row of the response into an object of <typeparamref name="T"/></param>
|
||||
/// <param name="parameters">The parameters of the query</param>
|
||||
/// <typeparam name="T">The return object type</typeparam>
|
||||
/// <returns>An object of type T that represents the output of the convertor function based on the array of objects that the first row of the result has</returns>
|
||||
public async Task<T?> ReadObjectOfTypeAsync<T>(string query, Func<object[], T> convertor, params KeyValuePair<string, object>[] parameters)
|
||||
{
|
||||
if (!_Connection.State.HasFlag(ConnectionState.Open))
|
||||
await _Connection.OpenAsync();
|
||||
|
||||
var command = new SqliteCommand(query, _Connection);
|
||||
foreach (var parameter in parameters)
|
||||
{
|
||||
var p = CreateParameter(parameter);
|
||||
if (p is not null)
|
||||
command.Parameters.Add(p);
|
||||
}
|
||||
|
||||
var reader = await command.ExecuteReaderAsync();
|
||||
var values = new object[reader.FieldCount];
|
||||
if (reader.Read())
|
||||
{
|
||||
reader.GetValues(values);
|
||||
return convertor(values);
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Execute a query with parameters that returns a specific type of object. The function will return a list of objects of the specified type.
|
||||
/// </summary>
|
||||
/// <param name="query">The query to execute</param>
|
||||
/// <param name="convertor">The convertor from object[] to T</param>
|
||||
/// <param name="parameters">The parameters of the query</param>
|
||||
/// <typeparam name="T">The expected object type</typeparam>
|
||||
/// <returns>A list of objects of type T that represents each line of the output of the specified query, converted to T</returns>
|
||||
public async Task<List<T>> ReadListOfTypeAsync<T>(string query, Func<object[], T> convertor,
|
||||
params KeyValuePair<string, object>[] parameters)
|
||||
{
|
||||
if (!_Connection.State.HasFlag(ConnectionState.Open))
|
||||
await _Connection.OpenAsync();
|
||||
|
||||
var command = new SqliteCommand(query, _Connection);
|
||||
foreach (var parameter in parameters)
|
||||
{
|
||||
var p = CreateParameter(parameter);
|
||||
if (p is not null)
|
||||
command.Parameters.Add(p);
|
||||
}
|
||||
|
||||
var reader = await command.ExecuteReaderAsync();
|
||||
//
|
||||
if (!reader.HasRows)
|
||||
return null;
|
||||
|
||||
List<T> rows = new();
|
||||
while (await reader.ReadAsync())
|
||||
{
|
||||
var values = new object[reader.FieldCount];
|
||||
reader.GetValues(values);
|
||||
rows.Add(convertor(values));
|
||||
}
|
||||
|
||||
return rows;
|
||||
}
|
||||
}
|
||||
10
DiscordBotCore.Logging/DiscordBotCore.Logging.csproj
Normal file
10
DiscordBotCore.Logging/DiscordBotCore.Logging.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Platforms>AnyCPU;x64;ARM64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
10
DiscordBotCore.Logging/ILogMessage.cs
Normal file
10
DiscordBotCore.Logging/ILogMessage.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace DiscordBotCore.Logging;
|
||||
|
||||
public interface ILogMessage
|
||||
{
|
||||
public string Message { get; protected set; }
|
||||
public DateTime ThrowTime { get; protected set; }
|
||||
public string SenderName { get; protected set; }
|
||||
public LogType LogMessageType { get; protected set; }
|
||||
|
||||
}
|
||||
13
DiscordBotCore.Logging/ILogger.cs
Normal file
13
DiscordBotCore.Logging/ILogger.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace DiscordBotCore.Logging;
|
||||
|
||||
public interface ILogger
|
||||
{
|
||||
List<ILogMessage> LogMessages { get; protected set; }
|
||||
event Action<ILogMessage>? OnLogReceived;
|
||||
|
||||
void Log(string message);
|
||||
void Log(string message, LogType logType);
|
||||
void Log(string message, object sender);
|
||||
void Log(string message, object sender, LogType type);
|
||||
void LogException(Exception exception, object sender, bool logFullStack = false);
|
||||
}
|
||||
75
DiscordBotCore.Logging/LogMessage.cs
Normal file
75
DiscordBotCore.Logging/LogMessage.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
namespace DiscordBotCore.Logging;
|
||||
|
||||
internal sealed class LogMessage : ILogMessage
|
||||
{
|
||||
private static readonly string _DefaultLogMessageSender = "\b";
|
||||
public string Message { get; set; }
|
||||
public DateTime ThrowTime { get; set; }
|
||||
public string SenderName { get; set; }
|
||||
public LogType LogMessageType { get; set; }
|
||||
|
||||
public LogMessage(string message, LogType logMessageType)
|
||||
{
|
||||
Message = message;
|
||||
LogMessageType = logMessageType;
|
||||
ThrowTime = DateTime.Now;
|
||||
SenderName = string.Empty;
|
||||
}
|
||||
|
||||
public LogMessage(string message, object sender)
|
||||
{
|
||||
Message = message;
|
||||
SenderName = sender is string && sender as string == string.Empty ? _DefaultLogMessageSender : sender.GetType().FullName ?? sender.GetType().Name;
|
||||
ThrowTime = DateTime.Now;
|
||||
LogMessageType = LogType.Info;
|
||||
}
|
||||
|
||||
public LogMessage(string message, object sender, DateTime throwTime)
|
||||
{
|
||||
Message = message;
|
||||
SenderName = sender is string && sender as string == string.Empty ? _DefaultLogMessageSender : sender.GetType().FullName ?? sender.GetType().Name;
|
||||
ThrowTime = throwTime;
|
||||
LogMessageType = LogType.Info;
|
||||
}
|
||||
|
||||
public LogMessage(string message, object sender, LogType logMessageType)
|
||||
{
|
||||
Message = message;
|
||||
SenderName = sender is string && sender as string == string.Empty ? _DefaultLogMessageSender : sender.GetType().FullName ?? sender.GetType().Name;
|
||||
ThrowTime = DateTime.Now;
|
||||
LogMessageType = logMessageType;
|
||||
|
||||
}
|
||||
|
||||
public LogMessage(string message, DateTime throwTime, object sender, LogType logMessageType)
|
||||
{
|
||||
Message = message;
|
||||
ThrowTime = throwTime;
|
||||
SenderName = sender is string && sender as string == string.Empty ? _DefaultLogMessageSender : sender.GetType().FullName ?? sender.GetType().Name;
|
||||
LogMessageType = logMessageType;
|
||||
}
|
||||
|
||||
public LogMessage WithMessage(string message)
|
||||
{
|
||||
this.Message = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LogMessage WithCurrentThrowTime()
|
||||
{
|
||||
this.ThrowTime = DateTime.Now;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LogMessage WithMessageType(LogType logType)
|
||||
{
|
||||
this.LogMessageType = logType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public static LogMessage CreateFromException(Exception exception, object Sender, bool logFullStack)
|
||||
{
|
||||
LogMessage message = new LogMessage(logFullStack? exception.ToString() : exception.Message, Sender, LogType.Error);
|
||||
return message;
|
||||
}
|
||||
}
|
||||
9
DiscordBotCore.Logging/LogType.cs
Normal file
9
DiscordBotCore.Logging/LogType.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace DiscordBotCore.Logging;
|
||||
|
||||
public enum LogType
|
||||
{
|
||||
Info,
|
||||
Warning,
|
||||
Error,
|
||||
Critical
|
||||
}
|
||||
64
DiscordBotCore.Logging/Logger.cs
Normal file
64
DiscordBotCore.Logging/Logger.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
namespace DiscordBotCore.Logging;
|
||||
|
||||
public sealed class Logger : ILogger
|
||||
{
|
||||
private readonly string _LogFile;
|
||||
private readonly string _LogMessageFormat;
|
||||
private readonly int _MaxHistorySize;
|
||||
|
||||
private readonly List<string> _logMessageProperties = typeof(ILogMessage)
|
||||
.GetProperties()
|
||||
.Select(p => p.Name)
|
||||
.ToList();
|
||||
|
||||
|
||||
public List<ILogMessage> LogMessages { get; set; }
|
||||
public event Action<ILogMessage>? OnLogReceived;
|
||||
|
||||
|
||||
public Logger(string logFolder, string logMessageFormat, int maxHistorySize)
|
||||
{
|
||||
this._LogMessageFormat = logMessageFormat;
|
||||
this._LogFile = Path.Combine(logFolder, $"{DateTime.Now:yyyy-MM-dd}.log");
|
||||
this._MaxHistorySize = maxHistorySize;
|
||||
LogMessages = new List<ILogMessage>();
|
||||
}
|
||||
|
||||
public void Log(string message) => Log(new LogMessage(message, string.Empty, LogType.Info));
|
||||
public void Log(string message, LogType logType) => Log(new LogMessage(message, logType));
|
||||
public void Log(string message, object sender) => Log(new LogMessage(message, sender));
|
||||
public void Log(string message, object sender, LogType type) => Log(new LogMessage(message, sender, type));
|
||||
public void LogException(Exception exception, object sender, bool logFullStack = false) => Log(LogMessage.CreateFromException(exception, sender, logFullStack));
|
||||
|
||||
|
||||
private string GenerateLogMessage(ILogMessage message)
|
||||
{
|
||||
string messageAsString = new string(_LogMessageFormat);
|
||||
foreach (var prop in _logMessageProperties)
|
||||
{
|
||||
Type messageType = typeof(ILogMessage);
|
||||
messageAsString = messageAsString.Replace("{" + prop + "}", messageType.GetProperty(prop)?.GetValue(message)?.ToString());
|
||||
}
|
||||
|
||||
return messageAsString;
|
||||
}
|
||||
|
||||
private async Task LogToFile(string message)
|
||||
{
|
||||
await using var streamWriter = new StreamWriter(_LogFile, true);
|
||||
await streamWriter.WriteLineAsync(message);
|
||||
}
|
||||
|
||||
private async void Log(ILogMessage message)
|
||||
{
|
||||
var messageAsString = GenerateLogMessage(message);
|
||||
OnLogReceived?.Invoke(message);
|
||||
LogMessages.Add(message);
|
||||
if (LogMessages.Count > _MaxHistorySize)
|
||||
{
|
||||
LogMessages.RemoveAt(0);
|
||||
}
|
||||
await LogToFile(messageAsString);
|
||||
}
|
||||
|
||||
}
|
||||
10
DiscordBotCore.Networking/DiscordBotCore.Networking.csproj
Normal file
10
DiscordBotCore.Networking/DiscordBotCore.Networking.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Platforms>AnyCPU;x64;ARM64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
25
DiscordBotCore.Networking/FileDownloader.cs
Normal file
25
DiscordBotCore.Networking/FileDownloader.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using DiscordBotCore.Networking.Helpers;
|
||||
|
||||
namespace DiscordBotCore.Networking;
|
||||
|
||||
public class FileDownloader
|
||||
{
|
||||
private readonly string _DownloadUrl;
|
||||
private readonly string _DownloadLocation;
|
||||
|
||||
private readonly HttpClient _HttpClient;
|
||||
|
||||
public FileDownloader(string downloadUrl, string downloadLocation)
|
||||
{
|
||||
_DownloadUrl = downloadUrl;
|
||||
_DownloadLocation = downloadLocation;
|
||||
|
||||
_HttpClient = new HttpClient();
|
||||
}
|
||||
|
||||
public async Task DownloadFile(Action<float> progressCallback)
|
||||
{
|
||||
await using var fileStream = new FileStream(_DownloadLocation, FileMode.Create, FileAccess.Write, FileShare.None);
|
||||
await _HttpClient.DownloadFileAsync(_DownloadUrl, fileStream, new Progress<float>(progressCallback));
|
||||
}
|
||||
}
|
||||
91
DiscordBotCore.Networking/Helpers/OnlineFunctions.cs
Normal file
91
DiscordBotCore.Networking/Helpers/OnlineFunctions.cs
Normal file
@@ -0,0 +1,91 @@
|
||||
namespace DiscordBotCore.Networking.Helpers;
|
||||
|
||||
internal static class OnlineFunctions
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Copy one Stream to another <see langword="async" />
|
||||
/// </summary>
|
||||
/// <param name="stream">The base stream</param>
|
||||
/// <param name="destination">The destination stream</param>
|
||||
/// <param name="bufferSize">The buffer to read</param>
|
||||
/// <param name="progress">The progress</param>
|
||||
/// <param name="cancellationToken">The cancellation token</param>
|
||||
/// <exception cref="ArgumentNullException">Triggered if any <see cref="Stream" /> is empty</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">Triggered if <paramref name="bufferSize" /> is less then or equal to 0</exception>
|
||||
/// <exception cref="InvalidOperationException">Triggered if <paramref name="stream" /> is not readable</exception>
|
||||
/// <exception cref="ArgumentException">Triggered in <paramref name="destination" /> is not writable</exception>
|
||||
private static async Task CopyToOtherStreamAsync(
|
||||
this Stream stream, Stream destination, int bufferSize,
|
||||
IProgress<long>? progress = null,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (stream == null) throw new ArgumentNullException(nameof(stream));
|
||||
if (destination == null) throw new ArgumentNullException(nameof(destination));
|
||||
if (bufferSize <= 0) throw new ArgumentOutOfRangeException(nameof(bufferSize));
|
||||
if (!stream.CanRead) throw new InvalidOperationException("The stream is not readable.");
|
||||
if (!destination.CanWrite)
|
||||
throw new ArgumentException("Destination stream is not writable", nameof(destination));
|
||||
|
||||
var buffer = new byte[bufferSize];
|
||||
long totalBytesRead = 0;
|
||||
int bytesRead;
|
||||
while ((bytesRead = await stream.ReadAsync(buffer, 0, buffer.Length, cancellationToken)
|
||||
.ConfigureAwait(false)) != 0)
|
||||
{
|
||||
await destination.WriteAsync(buffer, 0, bytesRead, cancellationToken).ConfigureAwait(false);
|
||||
totalBytesRead += bytesRead;
|
||||
progress?.Report(totalBytesRead);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Downloads a <see cref="Stream" /> and saves it to another <see cref="Stream" />.
|
||||
/// </summary>
|
||||
/// <param name="client">The <see cref="HttpClient" /> that is used to download the file</param>
|
||||
/// <param name="url">The url to the file</param>
|
||||
/// <param name="destination">The <see cref="Stream" /> to save the downloaded data</param>
|
||||
/// <param name="progress">The <see cref="IProgress{T}" /> that is used to track the download progress</param>
|
||||
/// <param name="cancellation">The cancellation token</param>
|
||||
/// <returns></returns>
|
||||
internal static async Task DownloadFileAsync(
|
||||
this HttpClient client, string url, Stream destination,
|
||||
IProgress<float>? progress = null,
|
||||
IProgress<long>? downloadedBytes = null, int bufferSize = 81920,
|
||||
CancellationToken cancellation = default)
|
||||
{
|
||||
using (var response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead, cancellation))
|
||||
{
|
||||
var contentLength = response.Content.Headers.ContentLength;
|
||||
|
||||
using (var download = await response.Content.ReadAsStreamAsync(cancellation))
|
||||
{
|
||||
// Ignore progress reporting when no progress reporter was
|
||||
// passed or when the content length is unknown
|
||||
if (progress == null || !contentLength.HasValue)
|
||||
{
|
||||
await download.CopyToAsync(destination, cancellation);
|
||||
if (!contentLength.HasValue)
|
||||
progress?.Report(100f);
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert absolute progress (bytes downloaded) into relative progress (0% - 100%)
|
||||
// total ... 100%
|
||||
// downloaded ... x%
|
||||
// x = downloaded * 100 / total => x = downloaded / total * 100
|
||||
var relativeProgress = new Progress<long>(totalBytesDownloaded =>
|
||||
{
|
||||
progress?.Report(totalBytesDownloaded / (float)contentLength.Value * 100);
|
||||
downloadedBytes?.Report(totalBytesDownloaded);
|
||||
}
|
||||
);
|
||||
|
||||
// Use extension method to report progress while downloading
|
||||
await download.CopyToOtherStreamAsync(destination, bufferSize, relativeProgress, cancellation);
|
||||
progress.Report(100f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
89
DiscordBotCore.Networking/ParallelDownloadExecutor.cs
Normal file
89
DiscordBotCore.Networking/ParallelDownloadExecutor.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using DiscordBotCore.Networking.Helpers;
|
||||
|
||||
namespace DiscordBotCore.Networking;
|
||||
|
||||
public class ParallelDownloadExecutor
|
||||
{
|
||||
private readonly List<Task> _listOfTasks;
|
||||
private readonly HttpClient _httpClient;
|
||||
private Action? OnFinishAction { get; set; }
|
||||
|
||||
public ParallelDownloadExecutor(List<Task> listOfTasks)
|
||||
{
|
||||
_httpClient = new HttpClient();
|
||||
_listOfTasks = listOfTasks;
|
||||
}
|
||||
|
||||
public ParallelDownloadExecutor()
|
||||
{
|
||||
_httpClient = new HttpClient();
|
||||
_listOfTasks = new List<Task>();
|
||||
}
|
||||
|
||||
public async Task StartTasks()
|
||||
{
|
||||
await Task.WhenAll(_listOfTasks);
|
||||
OnFinishAction?.Invoke();
|
||||
}
|
||||
|
||||
public async Task ExecuteAllTasks(int maxDegreeOfParallelism = 4)
|
||||
{
|
||||
using var semaphore = new SemaphoreSlim(maxDegreeOfParallelism);
|
||||
|
||||
var tasks = _listOfTasks.Select(async task =>
|
||||
{
|
||||
await semaphore.WaitAsync();
|
||||
try
|
||||
{
|
||||
await task;
|
||||
}
|
||||
finally
|
||||
{
|
||||
semaphore.Release();
|
||||
}
|
||||
});
|
||||
|
||||
await Task.WhenAll(tasks);
|
||||
OnFinishAction?.Invoke();
|
||||
}
|
||||
|
||||
public void SetFinishAction(Action action)
|
||||
{
|
||||
OnFinishAction = action;
|
||||
}
|
||||
|
||||
public void AddTask(string downloadLink, string downloadLocation)
|
||||
{
|
||||
if (string.IsNullOrEmpty(downloadLink) || string.IsNullOrEmpty(downloadLocation))
|
||||
throw new ArgumentException("Download link or location cannot be null or empty.");
|
||||
|
||||
if (Directory.Exists(Path.GetDirectoryName(downloadLocation)) == false)
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(downloadLocation));
|
||||
}
|
||||
|
||||
var task = CreateDownloadTask(downloadLink, downloadLocation, null);
|
||||
_listOfTasks.Add(task);
|
||||
}
|
||||
|
||||
public void AddTask(string downloadLink, string downloadLocation, Action<float> progressCallback)
|
||||
{
|
||||
if (string.IsNullOrEmpty(downloadLink) || string.IsNullOrEmpty(downloadLocation))
|
||||
throw new ArgumentException("Download link or location cannot be null or empty.");
|
||||
|
||||
if (Directory.Exists(Path.GetDirectoryName(downloadLocation)) == false)
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(downloadLocation));
|
||||
}
|
||||
|
||||
var task = CreateDownloadTask(downloadLink, downloadLocation, new Progress<float>(progressCallback));
|
||||
_listOfTasks.Add(task);
|
||||
}
|
||||
|
||||
private Task CreateDownloadTask(string downloadLink, string downloadLocation, IProgress<float> progress)
|
||||
{
|
||||
var fileStream = new FileStream(downloadLocation, FileMode.Create, FileAccess.Write, FileShare.None);
|
||||
return _httpClient.DownloadFileAsync(downloadLink, fileStream, progress);
|
||||
}
|
||||
|
||||
}
|
||||
22
DiscordBotCore.PluginCore/DiscordBotCore.PluginCore.csproj
Normal file
22
DiscordBotCore.PluginCore/DiscordBotCore.PluginCore.csproj
Normal file
@@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Platforms>AnyCPU;x64;ARM64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Discord.Net" Version="3.18.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DiscordBotCore.Logging\DiscordBotCore.Logging.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Helpers\Execution\DbSlashCommand\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,26 @@
|
||||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
using DiscordBotCore.Logging;
|
||||
|
||||
namespace DiscordBotCore.PluginCore.Helpers.Execution.DbCommand;
|
||||
|
||||
public class DbCommandExecutingArgument : IDbCommandExecutingArgument
|
||||
{
|
||||
public SocketCommandContext Context { get; init; }
|
||||
public string CleanContent { get; init; }
|
||||
public string CommandUsed { get; init; }
|
||||
public string[]? Arguments { get; init; }
|
||||
public ILogger Logger { get; init; }
|
||||
public DirectoryInfo PluginBaseDirectory { get; init; }
|
||||
|
||||
public DbCommandExecutingArgument(ILogger logger, SocketCommandContext context, string cleanContent, string commandUsed, string[]? arguments, DirectoryInfo pluginBaseDirectory)
|
||||
{
|
||||
this.Logger = logger;
|
||||
this.Context = context;
|
||||
this.CleanContent = cleanContent;
|
||||
this.CommandUsed = commandUsed;
|
||||
this.Arguments = arguments;
|
||||
this.PluginBaseDirectory = pluginBaseDirectory;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
using DiscordBotCore.Logging;
|
||||
|
||||
namespace DiscordBotCore.PluginCore.Helpers.Execution.DbCommand;
|
||||
|
||||
public interface IDbCommandExecutingArgument
|
||||
{
|
||||
ILogger Logger { get; init; }
|
||||
string CleanContent { get; init; }
|
||||
string CommandUsed { get; init; }
|
||||
string[]? Arguments { get; init; }
|
||||
|
||||
SocketCommandContext Context { get; init; }
|
||||
public DirectoryInfo PluginBaseDirectory { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Discord.WebSocket;
|
||||
using DiscordBotCore.Logging;
|
||||
|
||||
namespace DiscordBotCore.PluginCore.Helpers.Execution.DbEvent;
|
||||
|
||||
public class DbEventExecutingArgument : IDbEventExecutingArgument
|
||||
{
|
||||
public ILogger Logger { get; }
|
||||
public DiscordSocketClient Client { get; }
|
||||
public string BotPrefix { get; }
|
||||
public DirectoryInfo PluginBaseDirectory { get; }
|
||||
|
||||
public DbEventExecutingArgument(ILogger logger, DiscordSocketClient client, string botPrefix, DirectoryInfo pluginBaseDirectory)
|
||||
{
|
||||
Logger = logger;
|
||||
Client = client;
|
||||
BotPrefix = botPrefix;
|
||||
PluginBaseDirectory = pluginBaseDirectory;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using Discord.WebSocket;
|
||||
using DiscordBotCore.Logging;
|
||||
|
||||
namespace DiscordBotCore.PluginCore.Helpers.Execution.DbEvent;
|
||||
|
||||
public interface IDbEventExecutingArgument
|
||||
{
|
||||
public ILogger Logger { get; }
|
||||
public DiscordSocketClient Client { get; }
|
||||
public string BotPrefix { get; }
|
||||
public DirectoryInfo PluginBaseDirectory { get; }
|
||||
}
|
||||
45
DiscordBotCore.PluginCore/Interfaces/IDbCommand.cs
Normal file
45
DiscordBotCore.PluginCore/Interfaces/IDbCommand.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using DiscordBotCore.PluginCore.Helpers.Execution.DbCommand;
|
||||
|
||||
namespace DiscordBotCore.PluginCore.Interfaces;
|
||||
|
||||
public interface IDbCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// Command to be executed
|
||||
/// It's CaSe SeNsItIvE
|
||||
/// </summary>
|
||||
string Command { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Command aliases. Users may use this to execute the command
|
||||
/// </summary>
|
||||
List<string> Aliases { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Command description
|
||||
/// </summary>
|
||||
string Description { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The usage for your command.
|
||||
/// It will be displayed when users type help
|
||||
/// </summary>
|
||||
string Usage { get; }
|
||||
|
||||
/// <summary>
|
||||
/// true if the command requre admin, otherwise false
|
||||
/// </summary>
|
||||
bool RequireAdmin { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The main body of the command. This is what is executed when user calls the command in Server
|
||||
/// </summary>
|
||||
/// <param name="args">The Discord Context</param>
|
||||
Task ExecuteServer(IDbCommandExecutingArgument args) => Task.CompletedTask;
|
||||
|
||||
/// <summary>
|
||||
/// The main body of the command. This is what is executed when user calls the command in DM
|
||||
/// </summary>
|
||||
/// <param name="args">The Discord Context</param>
|
||||
Task ExecuteDm(IDbCommandExecutingArgument args) => Task.CompletedTask;
|
||||
}
|
||||
22
DiscordBotCore.PluginCore/Interfaces/IDbEvent.cs
Normal file
22
DiscordBotCore.PluginCore/Interfaces/IDbEvent.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using DiscordBotCore.PluginCore.Helpers.Execution.DbEvent;
|
||||
|
||||
namespace DiscordBotCore.PluginCore.Interfaces;
|
||||
|
||||
public interface IDbEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the event
|
||||
/// </summary>
|
||||
string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The description of the event
|
||||
/// </summary>
|
||||
string Description { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The method that is invoked when the event is loaded into memory
|
||||
/// </summary>
|
||||
/// <param name="args">The arguments for the start method</param>
|
||||
void Start(IDbEventExecutingArgument args);
|
||||
}
|
||||
22
DiscordBotCore.PluginCore/Interfaces/IDbSlashCommand.cs
Normal file
22
DiscordBotCore.PluginCore/Interfaces/IDbSlashCommand.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Discord;
|
||||
using Discord.WebSocket;
|
||||
using DiscordBotCore.Logging;
|
||||
|
||||
namespace DiscordBotCore.PluginCore.Interfaces;
|
||||
|
||||
public interface IDbSlashCommand
|
||||
{
|
||||
string Name { get; }
|
||||
string Description { get; }
|
||||
bool CanUseDm { get; }
|
||||
bool HasInteraction { get; }
|
||||
|
||||
List<SlashCommandOptionBuilder> Options { get; }
|
||||
|
||||
void ExecuteServer(ILogger logger, SocketSlashCommand context)
|
||||
{ }
|
||||
|
||||
void ExecuteDm(ILogger logger, SocketSlashCommand context) { }
|
||||
|
||||
Task ExecuteInteraction(ILogger logger, SocketInteraction interaction) => Task.CompletedTask;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Platforms>AnyCPU;x64;ARM64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DiscordBotCore.Configuration\DiscordBotCore.Configuration.csproj" />
|
||||
<ProjectReference Include="..\DiscordBotCore.Logging\DiscordBotCore.Logging.csproj" />
|
||||
<ProjectReference Include="..\DiscordBotCore.PluginCore\DiscordBotCore.PluginCore.csproj" />
|
||||
<ProjectReference Include="..\DiscordBotCore.PluginManagement\DiscordBotCore.PluginManagement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace DiscordBotCore.PluginManagement.Loading.Exceptions;
|
||||
|
||||
public class PluginNotFoundException : Exception
|
||||
{
|
||||
public PluginNotFoundException(string pluginName) : base($"Plugin {pluginName} was not found") { }
|
||||
|
||||
public PluginNotFoundException(string pluginName, string url, string branch) :
|
||||
base ($"Plugin {pluginName} was not found on {url} (branch: {branch}") { }
|
||||
}
|
||||
27
DiscordBotCore.PluginManagement.Loading/IPluginLoader.cs
Normal file
27
DiscordBotCore.PluginManagement.Loading/IPluginLoader.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Discord.WebSocket;
|
||||
using DiscordBotCore.PluginCore.Interfaces;
|
||||
|
||||
namespace DiscordBotCore.PluginManagement.Loading;
|
||||
|
||||
public interface IPluginLoader
|
||||
{
|
||||
public IReadOnlyList<IDbCommand> Commands { get; }
|
||||
public IReadOnlyList<IDbEvent> Events { get; }
|
||||
public IReadOnlyList<IDbSlashCommand> SlashCommands { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Discord client for the plugin loader. This is used to initialize the slash commands and events.
|
||||
/// </summary>
|
||||
/// <param name="discordSocketClient">The socket client that represents the running Discord Bot</param>
|
||||
public void SetDiscordClient(DiscordSocketClient discordSocketClient);
|
||||
|
||||
/// <summary>
|
||||
/// Loads all the plugins that are installed.
|
||||
/// </summary>
|
||||
public Task LoadPlugins();
|
||||
|
||||
/// <summary>
|
||||
/// Unload all plugins from the plugin manager.
|
||||
/// </summary>
|
||||
public Task UnloadAllPlugins();
|
||||
}
|
||||
371
DiscordBotCore.PluginManagement.Loading/PluginLoader.cs
Normal file
371
DiscordBotCore.PluginManagement.Loading/PluginLoader.cs
Normal file
@@ -0,0 +1,371 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reflection;
|
||||
using Discord;
|
||||
using Discord.WebSocket;
|
||||
using DiscordBotCore.Configuration;
|
||||
using DiscordBotCore.Logging;
|
||||
using DiscordBotCore.PluginCore.Helpers.Execution.DbEvent;
|
||||
using DiscordBotCore.PluginCore.Interfaces;
|
||||
using DiscordBotCore.PluginManagement.Loading.Exceptions;
|
||||
using DiscordBotCore.Utilities.Responses;
|
||||
|
||||
namespace DiscordBotCore.PluginManagement.Loading;
|
||||
|
||||
public class PluginLoader : IPluginLoader
|
||||
{
|
||||
private static readonly string _HelpCommandNamespaceFullName = "DiscordBotCore.Commands.HelpCommand";
|
||||
|
||||
private readonly IPluginManager _PluginManager;
|
||||
private readonly ILogger _Logger;
|
||||
private readonly IConfiguration _Configuration;
|
||||
|
||||
private DiscordSocketClient? _DiscordClient;
|
||||
private PluginLoaderContext? PluginLoaderContext;
|
||||
|
||||
private readonly List<IDbCommand> _Commands = new List<IDbCommand>();
|
||||
private readonly List<IDbEvent> _Events = new List<IDbEvent>();
|
||||
private readonly List<IDbSlashCommand> _SlashCommands = new List<IDbSlashCommand>();
|
||||
private readonly List<SocketApplicationCommand> _ApplicationCommands = new List<SocketApplicationCommand>();
|
||||
|
||||
public PluginLoader(IPluginManager pluginManager, ILogger logger, IConfiguration configuration)
|
||||
{
|
||||
_PluginManager = pluginManager;
|
||||
_Logger = logger;
|
||||
_Configuration = configuration;
|
||||
}
|
||||
|
||||
public IReadOnlyList<IDbCommand> Commands => _Commands;
|
||||
public IReadOnlyList<IDbEvent> Events => _Events;
|
||||
public IReadOnlyList<IDbSlashCommand> SlashCommands => _SlashCommands;
|
||||
|
||||
public void SetDiscordClient(DiscordSocketClient discordSocketClient)
|
||||
{
|
||||
if (_DiscordClient is not null && discordSocketClient == _DiscordClient)
|
||||
{
|
||||
_Logger.Log("A client is already set. Please set the client only once.", this, LogType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (discordSocketClient.LoginState != LoginState.LoggedIn)
|
||||
{
|
||||
_Logger.Log("The client must be logged in before setting it.", this, LogType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
_DiscordClient = discordSocketClient;
|
||||
}
|
||||
|
||||
public async Task LoadPlugins()
|
||||
{
|
||||
if (PluginLoaderContext is not null)
|
||||
{
|
||||
_Logger.Log("The plugins are already loaded", this, LogType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
_Events.Clear();
|
||||
_Commands.Clear();
|
||||
_SlashCommands.Clear();
|
||||
_ApplicationCommands.Clear();
|
||||
|
||||
await LoadPluginFiles();
|
||||
|
||||
LoadEverythingOfType<IDbEvent>();
|
||||
var helpCommand = AppDomain.CurrentDomain.GetAssemblies()
|
||||
.FirstOrDefault(assembly => assembly.DefinedTypes.Any(type => type.FullName == _HelpCommandNamespaceFullName)
|
||||
&& assembly.FullName != null
|
||||
&& assembly.FullName.StartsWith("DiscordBotCore"));
|
||||
|
||||
if (helpCommand is not null)
|
||||
{
|
||||
var helpCommandType = helpCommand.DefinedTypes.FirstOrDefault(type => type.FullName == _HelpCommandNamespaceFullName &&
|
||||
typeof(IDbCommand).IsAssignableFrom(type));
|
||||
if (helpCommandType is not null)
|
||||
{
|
||||
InitializeType<IDbCommand>(helpCommandType);
|
||||
}
|
||||
}
|
||||
|
||||
LoadEverythingOfType<IDbCommand>();
|
||||
LoadEverythingOfType<IDbSlashCommand>();
|
||||
|
||||
|
||||
_Logger.Log("Loaded plugins", this);
|
||||
}
|
||||
|
||||
public async Task UnloadAllPlugins()
|
||||
{
|
||||
if (PluginLoaderContext is null)
|
||||
{
|
||||
_Logger.Log("The plugins are not loaded. Please load the plugins before unloading them.", this, LogType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
await UnloadSlashCommands();
|
||||
|
||||
PluginLoaderContext.Unload();
|
||||
PluginLoaderContext = null;
|
||||
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
GC.Collect();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private async Task UnloadSlashCommands()
|
||||
{
|
||||
if (_DiscordClient is null)
|
||||
{
|
||||
_Logger.Log("The client is not set. Please set the client before unloading slash commands.", this, LogType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (SocketApplicationCommand command in _ApplicationCommands)
|
||||
{
|
||||
await command.DeleteAsync();
|
||||
}
|
||||
|
||||
_ApplicationCommands.Clear();
|
||||
_Logger.Log("Unloaded all slash commands", this);
|
||||
}
|
||||
|
||||
private async Task LoadPluginFiles()
|
||||
{
|
||||
var installedPlugins = await _PluginManager.GetInstalledPlugins();
|
||||
|
||||
if (installedPlugins.Count == 0)
|
||||
{
|
||||
_Logger.Log("No plugin files found. Please check the plugin files.", this, LogType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var files = installedPlugins.Where(plugin => plugin.IsEnabled).Select(plugin => plugin.FilePath);
|
||||
|
||||
PluginLoaderContext = new PluginLoaderContext(_Logger, "PluginLoader");
|
||||
|
||||
foreach (var file in files)
|
||||
{
|
||||
string fullFilePath = Path.GetFullPath(file);
|
||||
if (string.IsNullOrEmpty(fullFilePath))
|
||||
{
|
||||
_Logger.Log("The file path is empty. Please check the plugin file path.", PluginLoaderContext, LogType.Error);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!File.Exists(fullFilePath))
|
||||
{
|
||||
_Logger.Log("The file does not exist. Please check the plugin file path.", PluginLoaderContext, LogType.Error);
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
PluginLoaderContext.LoadFromAssemblyPath(fullFilePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_Logger.LogException(ex, this);
|
||||
}
|
||||
}
|
||||
|
||||
_Logger.Log($"Loaded {PluginLoaderContext.Assemblies.Count()} assemblies", this);
|
||||
}
|
||||
|
||||
private void LoadEverythingOfType<T>()
|
||||
{
|
||||
if (PluginLoaderContext is null)
|
||||
{
|
||||
_Logger.Log("The plugins are not loaded. Please load the plugins before loading them.", this, LogType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var types = PluginLoaderContext.Assemblies
|
||||
.SelectMany(s => s.GetTypes())
|
||||
.Where(p => typeof(T).IsAssignableFrom(p) && !p.IsInterface);
|
||||
|
||||
foreach (var type in types)
|
||||
{
|
||||
InitializeType<T>(type);
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeType<T>(Type type)
|
||||
{
|
||||
T? plugin = (T?)Activator.CreateInstance(type);
|
||||
if (plugin is null)
|
||||
{
|
||||
_Logger.Log($"Failed to create instance of plugin with type {type.FullName} [{type.Assembly}]", this, LogType.Error);
|
||||
}
|
||||
|
||||
switch (plugin)
|
||||
{
|
||||
case IDbEvent dbEvent:
|
||||
InitializeEvent(dbEvent);
|
||||
break;
|
||||
case IDbCommand dbCommand:
|
||||
InitializeDbCommand(dbCommand);
|
||||
break;
|
||||
case IDbSlashCommand dbSlashCommand:
|
||||
InitializeSlashCommand(dbSlashCommand);
|
||||
break;
|
||||
default:
|
||||
throw new PluginNotFoundException($"Unknown plugin type {plugin.GetType().FullName}");
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeDbCommand(IDbCommand command)
|
||||
{
|
||||
_Commands.Add(command);
|
||||
_Logger.Log("Command loaded: " + command.Command, this);
|
||||
}
|
||||
|
||||
private void InitializeEvent(IDbEvent eEvent)
|
||||
{
|
||||
if (!TryStartEvent(eEvent))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_Events.Add(eEvent);
|
||||
_Logger.Log("Event loaded: " + eEvent, this);
|
||||
}
|
||||
|
||||
private async void InitializeSlashCommand(IDbSlashCommand slashCommand)
|
||||
{
|
||||
bool result = await TryStartSlashCommand(slashCommand);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_DiscordClient is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (slashCommand.HasInteraction)
|
||||
{
|
||||
_DiscordClient.InteractionCreated += interaction => slashCommand.ExecuteInteraction(_Logger, interaction);
|
||||
}
|
||||
|
||||
_SlashCommands.Add(slashCommand);
|
||||
_Logger.Log("Slash command loaded: " + slashCommand.Name, this);
|
||||
}
|
||||
|
||||
private bool TryStartEvent(IDbEvent dbEvent)
|
||||
{
|
||||
string? botPrefix = _Configuration.Get<string>("prefix");
|
||||
if (string.IsNullOrEmpty(botPrefix))
|
||||
{
|
||||
_Logger.Log("Bot prefix is not set. Please set the bot prefix in the configuration.", this, LogType.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_DiscordClient is null)
|
||||
{
|
||||
_Logger.Log("Discord client is not set. Please set the discord client before starting events.", this, LogType.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
string? resourcesFolder = _Configuration.Get<string>("ResourcesFolder");
|
||||
if (string.IsNullOrEmpty(resourcesFolder))
|
||||
{
|
||||
_Logger.Log("Resources folder is not set. Please set the resources folder in the configuration.", this, LogType.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Directory.Exists(resourcesFolder))
|
||||
{
|
||||
_Logger.Log("Resources folder does not exist. Please create the resources folder.", this, LogType.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
string? eventConfigDirectory = Path.Combine(resourcesFolder, dbEvent.GetType().Assembly.GetName().Name);
|
||||
|
||||
Directory.CreateDirectory(eventConfigDirectory);
|
||||
|
||||
IDbEventExecutingArgument args = new DbEventExecutingArgument(
|
||||
_Logger,
|
||||
_DiscordClient,
|
||||
botPrefix,
|
||||
new DirectoryInfo(eventConfigDirectory));
|
||||
|
||||
dbEvent.Start(args);
|
||||
return true;
|
||||
}
|
||||
|
||||
private async Task<bool> TryStartSlashCommand(IDbSlashCommand? dbSlashCommand)
|
||||
{
|
||||
if (dbSlashCommand is null)
|
||||
{
|
||||
_Logger.Log("The loaded slash command was null. Please check the plugin.", this, LogType.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_DiscordClient is null)
|
||||
{
|
||||
_Logger.Log("The client is not set. Please set the client before starting slash commands.", this, LogType.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_DiscordClient.Guilds.Count == 0)
|
||||
{
|
||||
_Logger.Log("The client is not connected to any guilds. Please check the client.", this, LogType.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
var builder = new SlashCommandBuilder();
|
||||
builder.WithName(dbSlashCommand.Name);
|
||||
builder.WithDescription(dbSlashCommand.Description);
|
||||
builder.Options = dbSlashCommand.Options;
|
||||
|
||||
if (dbSlashCommand.CanUseDm)
|
||||
builder.WithContextTypes(InteractionContextType.BotDm, InteractionContextType.Guild);
|
||||
else
|
||||
builder.WithContextTypes(InteractionContextType.Guild);
|
||||
|
||||
List<ulong> serverIds = _Configuration.GetList("ServerIds", new List<ulong>());
|
||||
|
||||
if (serverIds.Any())
|
||||
{
|
||||
foreach(ulong guildId in serverIds)
|
||||
{
|
||||
IResponse<SocketApplicationCommand> result = await EnableSlashCommandPerGuild(guildId, builder);
|
||||
|
||||
if (!result.IsSuccess)
|
||||
{
|
||||
_Logger.Log($"Failed to enable slash command {dbSlashCommand.Name} for guild {guildId}", this, LogType.Error);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (result.Data is null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
_ApplicationCommands.Add(result.Data);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
var command = await _DiscordClient.CreateGlobalApplicationCommandAsync(builder.Build());
|
||||
_ApplicationCommands.Add(command);
|
||||
return true;
|
||||
}
|
||||
|
||||
private async Task<IResponse<SocketApplicationCommand>> EnableSlashCommandPerGuild(ulong guildId, SlashCommandBuilder builder)
|
||||
{
|
||||
SocketGuild? guild = _DiscordClient?.GetGuild(guildId);
|
||||
if (guild is null)
|
||||
{
|
||||
_Logger.Log("Failed to get guild with ID " + guildId, this, LogType.Error);
|
||||
return Response<SocketApplicationCommand>.Failure("Failed to get guild with ID " + guildId);
|
||||
}
|
||||
|
||||
var command = await guild.CreateApplicationCommandAsync(builder.Build());
|
||||
return Response<SocketApplicationCommand>.Success(command);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.Loader;
|
||||
using DiscordBotCore.Logging;
|
||||
|
||||
namespace DiscordBotCore.PluginManagement.Loading;
|
||||
|
||||
public class PluginLoaderContext : AssemblyLoadContext
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public PluginLoaderContext(ILogger logger, string name) : base(name: name, isCollectible: true)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
protected override Assembly? Load(AssemblyName assemblyName)
|
||||
{
|
||||
//_logger.Log("Assembly load requested: " + assemblyName.Name, this);
|
||||
return base.Load(assemblyName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Platforms>AnyCPU;x64;ARM64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http.Extensions" Version="2.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DiscordBotCore.Configuration\DiscordBotCore.Configuration.csproj" />
|
||||
<ProjectReference Include="..\DiscordBotCore.Logging\DiscordBotCore.Logging.csproj" />
|
||||
<ProjectReference Include="..\DiscordBotCore.Networking\DiscordBotCore.Networking.csproj" />
|
||||
<ProjectReference Include="..\DiscordBotCore.Utilities\DiscordBotCore.Utilities.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
14
DiscordBotCore.PluginManagement/Helpers/IPluginRepository.cs
Normal file
14
DiscordBotCore.PluginManagement/Helpers/IPluginRepository.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using DiscordBotCore.PluginManagement.Models;
|
||||
|
||||
namespace DiscordBotCore.PluginManagement.Helpers;
|
||||
|
||||
public interface IPluginRepository
|
||||
{
|
||||
public Task<List<OnlinePlugin>> GetAllPlugins(int operatingSystem, bool includeNotApproved);
|
||||
|
||||
public Task<OnlinePlugin?> GetPluginById(int pluginId);
|
||||
public Task<OnlinePlugin?> GetPluginByName(string pluginName, int operatingSystem, bool includeNotApproved);
|
||||
|
||||
public Task<List<OnlineDependencyInfo>> GetDependenciesForPlugin(int pluginId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace DiscordBotCore.PluginManagement.Helpers;
|
||||
|
||||
public interface IPluginRepositoryConfiguration
|
||||
{
|
||||
public string BaseUrl { get; }
|
||||
|
||||
public string PluginRepositoryLocation { get; }
|
||||
public string DependenciesRepositoryLocation { get; }
|
||||
}
|
||||
161
DiscordBotCore.PluginManagement/Helpers/PluginRepository.cs
Normal file
161
DiscordBotCore.PluginManagement/Helpers/PluginRepository.cs
Normal file
@@ -0,0 +1,161 @@
|
||||
using System.Net.Mime;
|
||||
using DiscordBotCore.Logging;
|
||||
using DiscordBotCore.PluginManagement.Models;
|
||||
using DiscordBotCore.Utilities;
|
||||
using Microsoft.AspNetCore.Http.Extensions;
|
||||
|
||||
namespace DiscordBotCore.PluginManagement.Helpers;
|
||||
|
||||
public class PluginRepository : IPluginRepository
|
||||
{
|
||||
private readonly IPluginRepositoryConfiguration _pluginRepositoryConfiguration;
|
||||
private readonly HttpClient _httpClient;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public PluginRepository(IPluginRepositoryConfiguration pluginRepositoryConfiguration, ILogger logger)
|
||||
{
|
||||
_pluginRepositoryConfiguration = pluginRepositoryConfiguration;
|
||||
_httpClient = new HttpClient();
|
||||
_httpClient.BaseAddress = new Uri(_pluginRepositoryConfiguration.BaseUrl);
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task<List<OnlinePlugin>> GetAllPlugins(int operatingSystem, bool includeNotApproved)
|
||||
{
|
||||
string url = CreateUrlWithQueryParams(_pluginRepositoryConfiguration.PluginRepositoryLocation,
|
||||
"get-all-plugins", new Dictionary<string, string>
|
||||
{
|
||||
{ "operatingSystem", operatingSystem.ToString() },
|
||||
{ "includeNotApproved", includeNotApproved.ToString() }
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
HttpResponseMessage response = await _httpClient.GetAsync(url);
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
string content = await response.Content.ReadAsStringAsync();
|
||||
List<OnlinePlugin> plugins = await JsonManager.ConvertFromJson<List<OnlinePlugin>>(content);
|
||||
|
||||
return plugins;
|
||||
}
|
||||
catch (HttpRequestException exception)
|
||||
{
|
||||
_logger.LogException(exception,this);
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task<OnlinePlugin?> GetPluginById(int pluginId)
|
||||
{
|
||||
string url = CreateUrlWithQueryParams(_pluginRepositoryConfiguration.PluginRepositoryLocation,
|
||||
"get-by-id", new Dictionary<string, string>
|
||||
{
|
||||
{ "pluginId", pluginId.ToString() },
|
||||
{ "includeNotApproved", "false" }
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
HttpResponseMessage response = await _httpClient.GetAsync(url);
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string content = await response.Content.ReadAsStringAsync();
|
||||
OnlinePlugin plugin = await JsonManager.ConvertFromJson<OnlinePlugin>(content);
|
||||
|
||||
return plugin;
|
||||
}
|
||||
catch (HttpRequestException exception)
|
||||
{
|
||||
_logger.LogException(exception, this);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task<OnlinePlugin?> GetPluginByName(string pluginName, int operatingSystem, bool includeNotApproved)
|
||||
{
|
||||
string url = CreateUrlWithQueryParams(_pluginRepositoryConfiguration.PluginRepositoryLocation,
|
||||
"get-by-name", new Dictionary<string, string>
|
||||
{
|
||||
{ "pluginName", pluginName },
|
||||
{ "operatingSystem", operatingSystem.ToString() },
|
||||
{ "includeNotApproved", includeNotApproved.ToString() }
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
HttpResponseMessage response = await _httpClient.GetAsync(url);
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
_logger.Log($"Plugin {pluginName} not found");
|
||||
return null;
|
||||
}
|
||||
|
||||
string content = await response.Content.ReadAsStringAsync();
|
||||
OnlinePlugin plugin = await JsonManager.ConvertFromJson<OnlinePlugin>(content);
|
||||
|
||||
return plugin;
|
||||
}
|
||||
catch (HttpRequestException exception)
|
||||
{
|
||||
_logger.LogException(exception, this);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task<List<OnlineDependencyInfo>> GetDependenciesForPlugin(int pluginId)
|
||||
{
|
||||
string url = CreateUrlWithQueryParams(_pluginRepositoryConfiguration.DependenciesRepositoryLocation,
|
||||
"get-by-plugin-id", new Dictionary<string, string>
|
||||
{
|
||||
{ "pluginId", pluginId.ToString() }
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
HttpResponseMessage response = await _httpClient.GetAsync(url);
|
||||
if(!response.IsSuccessStatusCode)
|
||||
{
|
||||
_logger.Log($"Failed to get dependencies for plugin with ID {pluginId}");
|
||||
return [];
|
||||
}
|
||||
|
||||
string content = await response.Content.ReadAsStringAsync();
|
||||
List<OnlineDependencyInfo> dependencies = await JsonManager.ConvertFromJson<List<OnlineDependencyInfo>>(content);
|
||||
|
||||
return dependencies;
|
||||
}
|
||||
catch(HttpRequestException exception)
|
||||
{
|
||||
_logger.LogException(exception, this);
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private string CreateUrlWithQueryParams(string baseUrl, string endpoint, Dictionary<string, string> queryParams)
|
||||
{
|
||||
QueryBuilder queryBuilder = new QueryBuilder();
|
||||
foreach (var(key,value) in queryParams)
|
||||
{
|
||||
queryBuilder.Add(key, value);
|
||||
}
|
||||
|
||||
string queryString = queryBuilder.ToQueryString().ToString();
|
||||
string url = baseUrl + endpoint + queryString;
|
||||
|
||||
return url;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace DiscordBotCore.PluginManagement.Helpers;
|
||||
|
||||
public class PluginRepositoryConfiguration : IPluginRepositoryConfiguration
|
||||
{
|
||||
public static PluginRepositoryConfiguration Default => new ("http://localhost:8080/api/v1/",
|
||||
"plugin/",
|
||||
"dependency/");
|
||||
|
||||
public string BaseUrl { get; }
|
||||
public string PluginRepositoryLocation { get; }
|
||||
public string DependenciesRepositoryLocation { get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public PluginRepositoryConfiguration(string baseUrl, string pluginRepositoryLocation, string dependenciesRepositoryLocation)
|
||||
{
|
||||
BaseUrl = baseUrl;
|
||||
PluginRepositoryLocation = pluginRepositoryLocation;
|
||||
DependenciesRepositoryLocation = dependenciesRepositoryLocation;
|
||||
}
|
||||
}
|
||||
20
DiscordBotCore.PluginManagement/IPluginManager.cs
Normal file
20
DiscordBotCore.PluginManagement/IPluginManager.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using DiscordBotCore.PluginManagement.Models;
|
||||
using DiscordBotCore.Utilities.Responses;
|
||||
|
||||
namespace DiscordBotCore.PluginManagement;
|
||||
|
||||
public interface IPluginManager
|
||||
{
|
||||
Task<List<OnlinePlugin>> GetPluginsList();
|
||||
Task<IResponse<OnlinePlugin>> GetPluginDataByName(string pluginName);
|
||||
Task<IResponse<OnlinePlugin>> GetPluginDataById(int pluginId);
|
||||
Task<IResponse<bool>> AppendPluginToDatabase(LocalPlugin pluginData);
|
||||
Task<List<LocalPlugin>> GetInstalledPlugins();
|
||||
Task<IResponse<string>> GetDependencyLocation(string dependencyName);
|
||||
Task<IResponse<string>> GetDependencyLocation(string dependencyName, string pluginName);
|
||||
string GenerateDependencyRelativePath(string pluginName, string dependencyPath);
|
||||
Task<IResponse<bool>> InstallPlugin(OnlinePlugin plugin, IProgress<float> progress);
|
||||
Task SetEnabledStatus(string pluginName, bool status);
|
||||
Task<IResponse<bool>> UninstallPluginByName(string pluginName);
|
||||
Task<IResponse<LocalPlugin>> GetLocalPluginByName(string pluginName);
|
||||
}
|
||||
46
DiscordBotCore.PluginManagement/Models/LocalPlugin.cs
Normal file
46
DiscordBotCore.PluginManagement/Models/LocalPlugin.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace DiscordBotCore.PluginManagement.Models;
|
||||
|
||||
public class LocalPlugin
|
||||
{
|
||||
public string PluginName { get; private set; }
|
||||
public string PluginVersion { get; private set; }
|
||||
public string FilePath { get; private set; }
|
||||
public Dictionary<string, string> ListOfExecutableDependencies {get; private set;}
|
||||
public bool IsOfflineAdded { get; internal set; }
|
||||
public bool IsEnabled { get; internal set; }
|
||||
|
||||
[JsonConstructor]
|
||||
public LocalPlugin(string pluginName, string pluginVersion, string filePath, Dictionary<string, string> listOfExecutableDependencies, bool isOfflineAdded, bool isEnabled)
|
||||
{
|
||||
PluginName = pluginName;
|
||||
PluginVersion = pluginVersion;
|
||||
ListOfExecutableDependencies = listOfExecutableDependencies;
|
||||
FilePath = filePath;
|
||||
IsOfflineAdded = isOfflineAdded;
|
||||
IsEnabled = isEnabled;
|
||||
}
|
||||
|
||||
private LocalPlugin(string pluginName, string pluginVersion, string filePath,
|
||||
Dictionary<string, string> listOfExecutableDependencies)
|
||||
{
|
||||
PluginName = pluginName;
|
||||
PluginVersion = pluginVersion;
|
||||
ListOfExecutableDependencies = listOfExecutableDependencies;
|
||||
FilePath = filePath;
|
||||
IsOfflineAdded = false;
|
||||
IsEnabled = true;
|
||||
}
|
||||
|
||||
public static LocalPlugin FromOnlineInfo(OnlinePlugin plugin, List<OnlineDependencyInfo> dependencies, string downloadLocation)
|
||||
{
|
||||
LocalPlugin localPlugin = new LocalPlugin(
|
||||
plugin.Name, plugin.Version, downloadLocation,
|
||||
dependencies.Where(dependency => dependency.IsExecutable)
|
||||
.ToDictionary(dependency => dependency.DependencyName, dependency => dependency.DownloadLocation)
|
||||
);
|
||||
|
||||
return localPlugin;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace DiscordBotCore.PluginManagement.Models;
|
||||
|
||||
public class OnlineDependencyInfo
|
||||
{
|
||||
public string DependencyName { get; private set; }
|
||||
[JsonPropertyName("dependencyLink")]
|
||||
public string DownloadLink { get; private set; }
|
||||
[JsonPropertyName("dependencyLocation")]
|
||||
public string DownloadLocation { get; private set; }
|
||||
public bool IsExecutable { get; private set; }
|
||||
|
||||
[JsonConstructor]
|
||||
public OnlineDependencyInfo(string dependencyName, string downloadLink, string downloadLocation, bool isExecutable)
|
||||
{
|
||||
DependencyName = dependencyName;
|
||||
DownloadLink = downloadLink;
|
||||
DownloadLocation = downloadLocation;
|
||||
IsExecutable = isExecutable;
|
||||
}
|
||||
}
|
||||
29
DiscordBotCore.PluginManagement/Models/OnlinePlugin.cs
Normal file
29
DiscordBotCore.PluginManagement/Models/OnlinePlugin.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace DiscordBotCore.PluginManagement.Models;
|
||||
|
||||
public class OnlinePlugin
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; }
|
||||
public string Description { get; private set; }
|
||||
public string Version { get; private set; }
|
||||
public string Author { get; private set; }
|
||||
public string DownloadLink { get; private set; }
|
||||
public int OperatingSystem { get; private set; }
|
||||
public bool IsApproved { get; private set; }
|
||||
|
||||
[JsonConstructor]
|
||||
public OnlinePlugin(int id, string name, string description, string version,
|
||||
string author, string downloadLink, int operatingSystem, bool isApproved)
|
||||
{
|
||||
Id = id;
|
||||
Name = name;
|
||||
Description = description;
|
||||
Version = version;
|
||||
Author = author;
|
||||
DownloadLink = downloadLink;
|
||||
OperatingSystem = operatingSystem;
|
||||
IsApproved = isApproved;
|
||||
}
|
||||
}
|
||||
316
DiscordBotCore.PluginManagement/PluginManager.cs
Normal file
316
DiscordBotCore.PluginManagement/PluginManager.cs
Normal file
@@ -0,0 +1,316 @@
|
||||
using System.Diagnostics;
|
||||
using DiscordBotCore.Logging;
|
||||
using DiscordBotCore.Networking;
|
||||
using DiscordBotCore.PluginManagement.Helpers;
|
||||
using DiscordBotCore.PluginManagement.Models;
|
||||
using DiscordBotCore.Utilities;
|
||||
using DiscordBotCore.Configuration;
|
||||
using DiscordBotCore.Utilities.Responses;
|
||||
using OperatingSystem = DiscordBotCore.Utilities.OperatingSystem;
|
||||
|
||||
namespace DiscordBotCore.PluginManagement;
|
||||
|
||||
public sealed class PluginManager : IPluginManager
|
||||
{
|
||||
private static readonly string _LibrariesBaseFolder = "Libraries";
|
||||
private readonly IPluginRepository _PluginRepository;
|
||||
private readonly ILogger _Logger;
|
||||
private readonly IConfiguration _Configuration;
|
||||
|
||||
public PluginManager(IPluginRepository pluginRepository, ILogger logger, IConfiguration configuration)
|
||||
{
|
||||
_PluginRepository = pluginRepository;
|
||||
_Logger = logger;
|
||||
_Configuration = configuration;
|
||||
}
|
||||
|
||||
public async Task<List<OnlinePlugin>> GetPluginsList()
|
||||
{
|
||||
int os = OperatingSystem.GetOperatingSystemInt();
|
||||
var onlinePlugins = await _PluginRepository.GetAllPlugins(os, false);
|
||||
|
||||
if (!onlinePlugins.Any())
|
||||
{
|
||||
_Logger.Log($"No plugins found for operatingSystem: {OperatingSystem.GetOperatingSystemString((OperatingSystem.OperatingSystemEnum)os)}", LogType.Warning);
|
||||
return [];
|
||||
}
|
||||
|
||||
return onlinePlugins;
|
||||
}
|
||||
|
||||
public async Task<IResponse<OnlinePlugin>> GetPluginDataByName(string pluginName)
|
||||
{
|
||||
int os = OperatingSystem.GetOperatingSystemInt();
|
||||
var plugin = await _PluginRepository.GetPluginByName(pluginName, os, false);
|
||||
|
||||
if (plugin is null)
|
||||
{
|
||||
return Response<OnlinePlugin>.Failure($"Plugin {pluginName} not found in the repository for operating system {OperatingSystem.GetOperatingSystemString((OperatingSystem.OperatingSystemEnum)os)}.");
|
||||
}
|
||||
|
||||
return Response<OnlinePlugin>.Success(plugin);
|
||||
}
|
||||
|
||||
public async Task<IResponse<OnlinePlugin>> GetPluginDataById(int pluginId)
|
||||
{
|
||||
var plugin = await _PluginRepository.GetPluginById(pluginId);
|
||||
if (plugin is null)
|
||||
{
|
||||
return Response<OnlinePlugin>.Failure($"Plugin {pluginId} not found in the repository.");
|
||||
}
|
||||
|
||||
return Response<OnlinePlugin>.Success(plugin);
|
||||
}
|
||||
|
||||
private async Task<IResponse<bool>> RemovePluginFromDatabase(string pluginName)
|
||||
{
|
||||
string? pluginDatabaseFile = _Configuration.Get<string>("PluginDatabase");
|
||||
|
||||
if (pluginDatabaseFile is null)
|
||||
{
|
||||
return Response.Failure("PluginDatabase file path is not present in the config file");
|
||||
}
|
||||
|
||||
List<LocalPlugin> installedPlugins = await JsonManager.ConvertFromJson<List<LocalPlugin>>(await File.ReadAllTextAsync(pluginDatabaseFile));
|
||||
|
||||
installedPlugins.RemoveAll(p => p.PluginName == pluginName);
|
||||
await JsonManager.SaveToJsonFile(pluginDatabaseFile, installedPlugins);
|
||||
|
||||
return Response.Success();
|
||||
}
|
||||
|
||||
public async Task<IResponse<bool>> AppendPluginToDatabase(LocalPlugin pluginData)
|
||||
{
|
||||
string? pluginDatabaseFile = _Configuration.Get<string>("PluginDatabase");
|
||||
if (pluginDatabaseFile is null)
|
||||
{
|
||||
return Response.Failure("PluginDatabase file path is not present in the config file");
|
||||
}
|
||||
|
||||
List<LocalPlugin> installedPlugins = await GetInstalledPlugins();
|
||||
|
||||
foreach (var dependency in pluginData.ListOfExecutableDependencies)
|
||||
{
|
||||
pluginData.ListOfExecutableDependencies[dependency.Key] = dependency.Value;
|
||||
}
|
||||
|
||||
if (installedPlugins.Any(plugin => plugin.PluginName == pluginData.PluginName))
|
||||
{
|
||||
_Logger.Log($"Plugin {pluginData.PluginName} already exists in the database. Updating...", this, LogType.Info);
|
||||
installedPlugins.RemoveAll(p => p.PluginName == pluginData.PluginName);
|
||||
}
|
||||
|
||||
installedPlugins.Add(pluginData);
|
||||
await JsonManager.SaveToJsonFile(pluginDatabaseFile, installedPlugins);
|
||||
|
||||
return Response.Success();
|
||||
}
|
||||
|
||||
public async Task<List<LocalPlugin>> GetInstalledPlugins()
|
||||
{
|
||||
string? pluginDatabaseFile = _Configuration.Get<string>("PluginDatabase");
|
||||
if (pluginDatabaseFile is null)
|
||||
{
|
||||
_Logger.Log("Plugin database file path is not present in the config file", this, LogType.Warning);
|
||||
return [];
|
||||
}
|
||||
|
||||
if (!File.Exists(pluginDatabaseFile))
|
||||
{
|
||||
_Logger.Log("Plugin database file not found", this, LogType.Warning);
|
||||
await CreateEmptyPluginDatabase();
|
||||
return [];
|
||||
}
|
||||
|
||||
return await JsonManager.ConvertFromJson<List<LocalPlugin>>(await File.ReadAllTextAsync(pluginDatabaseFile));
|
||||
}
|
||||
|
||||
public async Task<IResponse<string>> GetDependencyLocation(string dependencyName)
|
||||
{
|
||||
List<LocalPlugin> installedPlugins = await GetInstalledPlugins();
|
||||
|
||||
foreach (var plugin in installedPlugins)
|
||||
{
|
||||
if (plugin.ListOfExecutableDependencies.TryGetValue(dependencyName, out var dependencyPath))
|
||||
{
|
||||
string relativePath = GenerateDependencyRelativePath(plugin.PluginName, dependencyPath);
|
||||
return Response<string>.Success(relativePath);
|
||||
}
|
||||
}
|
||||
|
||||
return Response<string>.Failure($"Dependency {dependencyName} not found in the installed plugins.");
|
||||
}
|
||||
|
||||
public async Task<IResponse<string>> GetDependencyLocation(string dependencyName, string pluginName)
|
||||
{
|
||||
List<LocalPlugin> installedPlugins = await GetInstalledPlugins();
|
||||
|
||||
foreach (var plugin in installedPlugins)
|
||||
{
|
||||
if (plugin.PluginName == pluginName && plugin.ListOfExecutableDependencies.ContainsKey(dependencyName))
|
||||
{
|
||||
string dependencyPath = plugin.ListOfExecutableDependencies[dependencyName];
|
||||
string relativePath = GenerateDependencyRelativePath(pluginName, dependencyPath);
|
||||
return Response<string>.Success(relativePath);
|
||||
}
|
||||
}
|
||||
|
||||
return Response<string>.Failure($"Dependency {dependencyName} not found in the installed plugins.");
|
||||
}
|
||||
|
||||
public string GenerateDependencyRelativePath(string pluginName, string dependencyPath)
|
||||
{
|
||||
string relative = $"./{_LibrariesBaseFolder}/{pluginName}/{dependencyPath}";
|
||||
return relative;
|
||||
}
|
||||
|
||||
public async Task<IResponse<bool>> InstallPlugin(OnlinePlugin plugin, IProgress<float> progress)
|
||||
{
|
||||
string? pluginsFolder = _Configuration.Get<string>("PluginFolder");
|
||||
if (pluginsFolder is null)
|
||||
{
|
||||
return Response.Failure("Plugin folder path is not present in the config file");
|
||||
}
|
||||
|
||||
var localPluginResponse = await GetLocalPluginByName(plugin.Name);
|
||||
if (localPluginResponse is { IsSuccess: true, Data: not null })
|
||||
{
|
||||
var response = await IsNewVersion(localPluginResponse.Data.PluginVersion, plugin.Version);
|
||||
if (!response.IsSuccess)
|
||||
{
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
List<OnlineDependencyInfo> dependencies = await _PluginRepository.GetDependenciesForPlugin(plugin.Id);
|
||||
|
||||
string downloadLocation = $"{pluginsFolder}/{plugin.Name}.dll";
|
||||
|
||||
IProgress<float> downloadProgress = new Progress<float>(progress.Report);
|
||||
|
||||
FileDownloader fileDownloader = new FileDownloader(plugin.DownloadLink, downloadLocation);
|
||||
await fileDownloader.DownloadFile(downloadProgress.Report);
|
||||
|
||||
ParallelDownloadExecutor executor = new ParallelDownloadExecutor();
|
||||
|
||||
foreach (var dependency in dependencies)
|
||||
{
|
||||
string dependencyLocation = GenerateDependencyRelativePath(plugin.Name, dependency.DownloadLocation);
|
||||
|
||||
executor.AddTask(dependency.DownloadLink, dependencyLocation, progress.Report);
|
||||
}
|
||||
|
||||
await executor.ExecuteAllTasks();
|
||||
|
||||
LocalPlugin localPlugin = LocalPlugin.FromOnlineInfo(plugin, dependencies, downloadLocation);
|
||||
var result = await AppendPluginToDatabase(localPlugin);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task SetEnabledStatus(string pluginName, bool status)
|
||||
{
|
||||
var plugins = await GetInstalledPlugins();
|
||||
var plugin = plugins.Find(p => p.PluginName == pluginName);
|
||||
|
||||
if (plugin == null)
|
||||
return;
|
||||
|
||||
plugin.IsEnabled = status;
|
||||
|
||||
await RemovePluginFromDatabase(pluginName);
|
||||
await AppendPluginToDatabase(plugin);
|
||||
|
||||
}
|
||||
|
||||
public async Task<IResponse<bool>> UninstallPluginByName(string pluginName)
|
||||
{
|
||||
var localPluginResponse = await GetLocalPluginByName(pluginName);
|
||||
if (!localPluginResponse.IsSuccess)
|
||||
{
|
||||
return Response.Failure(localPluginResponse.Message);
|
||||
}
|
||||
|
||||
var localPlugin = localPluginResponse.Data;
|
||||
|
||||
if (localPlugin is null)
|
||||
{
|
||||
return Response.Failure($"Plugin {pluginName} not found in the database");
|
||||
}
|
||||
|
||||
File.Delete(localPlugin.FilePath);
|
||||
|
||||
if (Directory.Exists($"./{_LibrariesBaseFolder}/{pluginName}"))
|
||||
{
|
||||
foreach (var file in Directory.EnumerateFiles($"./{_LibrariesBaseFolder}/{pluginName}"))
|
||||
{
|
||||
File.Delete(file);
|
||||
}
|
||||
}
|
||||
|
||||
var response = await RemovePluginFromDatabase(pluginName);
|
||||
return response;
|
||||
}
|
||||
|
||||
public async Task<IResponse<LocalPlugin>> GetLocalPluginByName(string pluginName)
|
||||
{
|
||||
List<LocalPlugin> installedPlugins = await GetInstalledPlugins();
|
||||
var plugin = installedPlugins.Find(p => p.PluginName == pluginName);
|
||||
|
||||
if (plugin is null)
|
||||
{
|
||||
return Response<LocalPlugin>.Failure($"Plugin {pluginName} not found in the database");
|
||||
}
|
||||
|
||||
return Response<LocalPlugin>.Success(plugin);
|
||||
}
|
||||
|
||||
private async Task<IResponse<bool>> IsNewVersion(string currentVersion, string newVersion)
|
||||
{
|
||||
// currentVersion = "1.0.0"
|
||||
// newVersion = "1.0.1"
|
||||
|
||||
var currentVersionParts = currentVersion.Split('.').Select(int.Parse).ToArray();
|
||||
var newVersionParts = newVersion.Split('.').Select(int.Parse).ToArray();
|
||||
|
||||
if (currentVersionParts.Length != 3 || newVersionParts.Length != 3)
|
||||
{
|
||||
return Response.Failure("Invalid version format");
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (newVersionParts[i] > currentVersionParts[i])
|
||||
{
|
||||
return Response.Success();
|
||||
}
|
||||
else if (newVersionParts[i] < currentVersionParts[i])
|
||||
{
|
||||
return Response.Failure("Current version is newer");
|
||||
}
|
||||
}
|
||||
|
||||
return Response.Failure("Versions are the same");
|
||||
}
|
||||
|
||||
private async Task<bool> CreateEmptyPluginDatabase()
|
||||
{
|
||||
string ? pluginDatabaseFile = _Configuration.Get<string>("PluginDatabase");
|
||||
if (pluginDatabaseFile is null)
|
||||
{
|
||||
_Logger.Log("Plugin database file path is not present in the config file", this, LogType.Warning);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (File.Exists(pluginDatabaseFile))
|
||||
{
|
||||
_Logger.Log("Plugin database file already exists", this, LogType.Warning);
|
||||
return false;
|
||||
}
|
||||
|
||||
List<LocalPlugin> installedPlugins = new List<LocalPlugin>();
|
||||
await JsonManager.SaveToJsonFile(pluginDatabaseFile, installedPlugins);
|
||||
_Logger.Log("Plugin database file created", this, LogType.Info);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
189
DiscordBotCore.Utilities/ArchiveManager.cs
Normal file
189
DiscordBotCore.Utilities/ArchiveManager.cs
Normal file
@@ -0,0 +1,189 @@
|
||||
using System.IO.Compression;
|
||||
using DiscordBotCore.Logging;
|
||||
using DiscordBotCore.Configuration;
|
||||
|
||||
namespace DiscordBotCore.Utilities;
|
||||
|
||||
public class ArchiveManager
|
||||
{
|
||||
private readonly ILogger _Logger;
|
||||
private readonly IConfiguration _Configuration;
|
||||
|
||||
public ArchiveManager(ILogger logger, IConfiguration configuration)
|
||||
{
|
||||
_Logger = logger;
|
||||
_Configuration = configuration;
|
||||
}
|
||||
|
||||
public void CreateFromFile(string file, string folder)
|
||||
{
|
||||
if (!Directory.Exists(folder))
|
||||
Directory.CreateDirectory(folder);
|
||||
|
||||
var archiveName = folder + Path.GetFileNameWithoutExtension(file) + ".zip";
|
||||
if (File.Exists(archiveName))
|
||||
File.Delete(archiveName);
|
||||
|
||||
using ZipArchive archive = ZipFile.Open(archiveName, ZipArchiveMode.Create);
|
||||
archive.CreateEntryFromFile(file, Path.GetFileName(file));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a file from a zip archive. The output is a byte array
|
||||
/// </summary>
|
||||
/// <param name="fileName">The file name in the archive</param>
|
||||
/// <param name="archName">The archive location on the disk</param>
|
||||
/// <returns>An array of bytes that represents the Stream value from the file that was read inside the archive</returns>
|
||||
public async Task<byte[]?> ReadAllBytes(string fileName, string archName)
|
||||
{
|
||||
string? archiveFolderBasePath = _Configuration.Get<string>("ArchiveFolder");
|
||||
if(archiveFolderBasePath is null)
|
||||
throw new Exception("Archive folder not found");
|
||||
|
||||
Directory.CreateDirectory(archiveFolderBasePath);
|
||||
|
||||
archName = Path.Combine(archiveFolderBasePath, archName);
|
||||
|
||||
if (!File.Exists(archName))
|
||||
throw new Exception("Failed to load file !");
|
||||
|
||||
using var zip = ZipFile.OpenRead(archName);
|
||||
var entry = zip.Entries.FirstOrDefault(entry => entry.FullName == fileName || entry.Name == fileName);
|
||||
if (entry is null) throw new Exception("File not found in archive");
|
||||
|
||||
await using var memoryStream = new MemoryStream();
|
||||
var stream = entry.Open();
|
||||
await stream.CopyToAsync(memoryStream);
|
||||
var data = memoryStream.ToArray();
|
||||
|
||||
stream.Close();
|
||||
memoryStream.Close();
|
||||
|
||||
Console.WriteLine("Read file from archive: " + fileName);
|
||||
Console.WriteLine("Size: " + data.Length);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read data from a file that is inside an archive (ZIP format)
|
||||
/// </summary>
|
||||
/// <param name="fileName">The file name that is inside the archive or its full path</param>
|
||||
/// <param name="archFile">The archive location from the PAKs folder</param>
|
||||
/// <returns>A string that represents the content of the file or null if the file does not exists or it has no content</returns>
|
||||
public async Task<string?> ReadFromPakAsync(string fileName, string archFile)
|
||||
{
|
||||
string? archiveFolderBasePath = _Configuration.Get<string>("ArchiveFolder");
|
||||
if(archiveFolderBasePath is null)
|
||||
throw new Exception("Archive folder not found");
|
||||
|
||||
Directory.CreateDirectory(archiveFolderBasePath);
|
||||
|
||||
archFile = Path.Combine(archiveFolderBasePath, archFile);
|
||||
|
||||
if (!File.Exists(archFile))
|
||||
throw new Exception("Failed to load file !");
|
||||
|
||||
try
|
||||
{
|
||||
string? textValue = null;
|
||||
using (var fs = new FileStream(archFile, FileMode.Open))
|
||||
using (var zip = new ZipArchive(fs, ZipArchiveMode.Read))
|
||||
{
|
||||
foreach (var entry in zip.Entries)
|
||||
if (entry.Name == fileName || entry.FullName == fileName)
|
||||
using (var s = entry.Open())
|
||||
using (var reader = new StreamReader(s))
|
||||
{
|
||||
textValue = await reader.ReadToEndAsync();
|
||||
reader.Close();
|
||||
s.Close();
|
||||
fs.Close();
|
||||
}
|
||||
}
|
||||
|
||||
return textValue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_Logger.LogException(ex, this);
|
||||
await Task.Delay(100);
|
||||
return await ReadFromPakAsync(fileName, archFile);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extract zip to location
|
||||
/// </summary>
|
||||
/// <param name="zip">The zip location</param>
|
||||
/// <param name="folder">The target location</param>
|
||||
/// <param name="progress">The progress that is updated as a file is processed</param>
|
||||
/// <param name="type">The type of progress</param>
|
||||
/// <returns></returns>
|
||||
public async Task ExtractArchive(
|
||||
string zip, string folder, IProgress<float> progress,
|
||||
UnzipProgressType type)
|
||||
{
|
||||
Directory.CreateDirectory(folder);
|
||||
using var archive = ZipFile.OpenRead(zip);
|
||||
var totalZipFiles = archive.Entries.Count();
|
||||
if (type == UnzipProgressType.PercentageFromNumberOfFiles)
|
||||
{
|
||||
var currentZipFile = 0;
|
||||
foreach (var entry in archive.Entries)
|
||||
{
|
||||
if (entry.FullName.EndsWith("/")) // it is a folder
|
||||
Directory.CreateDirectory(Path.Combine(folder, entry.FullName));
|
||||
|
||||
else
|
||||
try
|
||||
{
|
||||
entry.ExtractToFile(Path.Combine(folder, entry.FullName), true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_Logger.LogException(ex, this);
|
||||
}
|
||||
|
||||
currentZipFile++;
|
||||
await Task.Delay(10);
|
||||
if (progress != null)
|
||||
progress.Report((float)currentZipFile / totalZipFiles * 100);
|
||||
}
|
||||
}
|
||||
else if (type == UnzipProgressType.PercentageFromTotalSize)
|
||||
{
|
||||
ulong zipSize = 0;
|
||||
|
||||
foreach (var entry in archive.Entries)
|
||||
zipSize += (ulong)entry.CompressedLength;
|
||||
|
||||
ulong currentSize = 0;
|
||||
foreach (var entry in archive.Entries)
|
||||
{
|
||||
if (entry.FullName.EndsWith("/"))
|
||||
{
|
||||
Directory.CreateDirectory(Path.Combine(folder, entry.FullName));
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
string path = Path.Combine(folder, entry.FullName);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
|
||||
entry.ExtractToFile(path, true);
|
||||
currentSize += (ulong)entry.CompressedLength;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_Logger.LogException(ex, this);
|
||||
}
|
||||
|
||||
await Task.Delay(10);
|
||||
if (progress != null)
|
||||
progress.Report((float)currentSize / zipSize * 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user