diff --git a/BUILDS/net5.0/CMD_LevelingSystem.deps.json b/BUILDS/net5.0/CMD_LevelingSystem.deps.json new file mode 100644 index 0000000..85f25c7 --- /dev/null +++ b/BUILDS/net5.0/CMD_LevelingSystem.deps.json @@ -0,0 +1,268 @@ +{ + "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.1.0": { + "dependencies": { + "Discord.Net.Commands": "3.1.0", + "Discord.Net.Core": "3.1.0", + "Discord.Net.Interactions": "3.1.0", + "Discord.Net.Rest": "3.1.0", + "Discord.Net.WebSocket": "3.1.0", + "Discord.Net.Webhook": "3.1.0" + } + }, + "Discord.Net.Commands/3.1.0": { + "dependencies": { + "Discord.Net.Core": "3.1.0" + }, + "runtime": { + "lib/net5.0/Discord.Net.Commands.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.1.0.0" + } + } + }, + "Discord.Net.Core/3.1.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.1.0.0", + "fileVersion": "3.1.0.0" + } + } + }, + "Discord.Net.Interactions/3.1.0": { + "dependencies": { + "Discord.Net.Core": "3.1.0", + "Discord.Net.Rest": "3.1.0", + "Discord.Net.WebSocket": "3.1.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.1.0.0", + "fileVersion": "3.1.0.0" + } + } + }, + "Discord.Net.Rest/3.1.0": { + "dependencies": { + "Discord.Net.Core": "3.1.0" + }, + "runtime": { + "lib/net5.0/Discord.Net.Rest.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.1.0.0" + } + } + }, + "Discord.Net.Webhook/3.1.0": { + "dependencies": { + "Discord.Net.Core": "3.1.0", + "Discord.Net.Rest": "3.1.0" + }, + "runtime": { + "lib/net5.0/Discord.Net.Webhook.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.1.0.0" + } + } + }, + "Discord.Net.WebSocket/3.1.0": { + "dependencies": { + "Discord.Net.Core": "3.1.0", + "Discord.Net.Rest": "3.1.0" + }, + "runtime": { + "lib/net5.0/Discord.Net.WebSocket.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.1.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.1.0" + }, + "runtime": { + "PluginManager.dll": {} + } + } + } + }, + "libraries": { + "CMD_LevelingSystem/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Discord.Net/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-GAY7d+k8UN5BsObGpysvg7ca6YwTqvesTouM8S8eBWSmwGnK38iceVkURg0QNAG70tlJ4w8S/BOjocRRvXU2MQ==", + "path": "discord.net/3.1.0", + "hashPath": "discord.net.3.1.0.nupkg.sha512" + }, + "Discord.Net.Commands/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-EZdtrAqj6Uspyz4CvIwFP/UQ4XUpXjIPG1b5LrfAKOo12ks4k6XO7up2h+UsHexk7mEz4sfZxkEXGrW6PSh+/Q==", + "path": "discord.net.commands/3.1.0", + "hashPath": "discord.net.commands.3.1.0.nupkg.sha512" + }, + "Discord.Net.Core/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Oxz3CiWVvenSaHRYZeCKgRqzcWqdjGYmpxVVN2vPikt6bTN+xHAR4jczk8plKDDdINt7Lac37iLsRaqzUtJZpQ==", + "path": "discord.net.core/3.1.0", + "hashPath": "discord.net.core.3.1.0.nupkg.sha512" + }, + "Discord.Net.Interactions/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-XzLChVRQGniUU8kdLMDYEOjifzvrcsOiAdKm/pO/PGPpZSMWSzPWlJUWaQlWMtOImrYULzRejOeoc2/3K3R30Q==", + "path": "discord.net.interactions/3.1.0", + "hashPath": "discord.net.interactions.3.1.0.nupkg.sha512" + }, + "Discord.Net.Rest/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-97kdAYjlNuuOnhRQW/OoGK2oBObvpzZlCSPJjIcI4DneEq6k2WIFhG00fvxK7DCVTlB5BgBMAT1BeRUk4/rUxQ==", + "path": "discord.net.rest/3.1.0", + "hashPath": "discord.net.rest.3.1.0.nupkg.sha512" + }, + "Discord.Net.Webhook/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-cZFxFf9H3GUBITlx1b7IskglgjJxSYpOIZOtyVW2WnPp7LpnxlOi1piRG22fH9fdhCC/RyDx3gZtYfN6WzacCw==", + "path": "discord.net.webhook/3.1.0", + "hashPath": "discord.net.webhook.3.1.0.nupkg.sha512" + }, + "Discord.Net.WebSocket/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-6OsLNXHNKC/laDKoBD+T0Km0vzqHaCcBOaI/NA8Qsed935MtEOTy7juorF22gF6TYOeoclUgSINrHCY4zWvxpA==", + "path": "discord.net.websocket/3.1.0", + "hashPath": "discord.net.websocket.3.1.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": "" + } + } +} \ No newline at end of file diff --git a/BUILDS/net5.0/CMD_LevelingSystem.dll b/BUILDS/net5.0/CMD_LevelingSystem.dll new file mode 100644 index 0000000..7fd2b21 Binary files /dev/null and b/BUILDS/net5.0/CMD_LevelingSystem.dll differ diff --git a/BUILDS/net5.0/CMD_Utils.deps.json b/BUILDS/net5.0/CMD_Utils.deps.json new file mode 100644 index 0000000..6dd7496 --- /dev/null +++ b/BUILDS/net5.0/CMD_Utils.deps.json @@ -0,0 +1,268 @@ +{ + "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.1.0": { + "dependencies": { + "Discord.Net.Commands": "3.1.0", + "Discord.Net.Core": "3.1.0", + "Discord.Net.Interactions": "3.1.0", + "Discord.Net.Rest": "3.1.0", + "Discord.Net.WebSocket": "3.1.0", + "Discord.Net.Webhook": "3.1.0" + } + }, + "Discord.Net.Commands/3.1.0": { + "dependencies": { + "Discord.Net.Core": "3.1.0" + }, + "runtime": { + "lib/net5.0/Discord.Net.Commands.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.1.0.0" + } + } + }, + "Discord.Net.Core/3.1.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.1.0.0", + "fileVersion": "3.1.0.0" + } + } + }, + "Discord.Net.Interactions/3.1.0": { + "dependencies": { + "Discord.Net.Core": "3.1.0", + "Discord.Net.Rest": "3.1.0", + "Discord.Net.WebSocket": "3.1.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.1.0.0", + "fileVersion": "3.1.0.0" + } + } + }, + "Discord.Net.Rest/3.1.0": { + "dependencies": { + "Discord.Net.Core": "3.1.0" + }, + "runtime": { + "lib/net5.0/Discord.Net.Rest.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.1.0.0" + } + } + }, + "Discord.Net.Webhook/3.1.0": { + "dependencies": { + "Discord.Net.Core": "3.1.0", + "Discord.Net.Rest": "3.1.0" + }, + "runtime": { + "lib/net5.0/Discord.Net.Webhook.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.1.0.0" + } + } + }, + "Discord.Net.WebSocket/3.1.0": { + "dependencies": { + "Discord.Net.Core": "3.1.0", + "Discord.Net.Rest": "3.1.0" + }, + "runtime": { + "lib/net5.0/Discord.Net.WebSocket.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.1.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.1.0" + }, + "runtime": { + "PluginManager.dll": {} + } + } + } + }, + "libraries": { + "CMD_Utils/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Discord.Net/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-GAY7d+k8UN5BsObGpysvg7ca6YwTqvesTouM8S8eBWSmwGnK38iceVkURg0QNAG70tlJ4w8S/BOjocRRvXU2MQ==", + "path": "discord.net/3.1.0", + "hashPath": "discord.net.3.1.0.nupkg.sha512" + }, + "Discord.Net.Commands/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-EZdtrAqj6Uspyz4CvIwFP/UQ4XUpXjIPG1b5LrfAKOo12ks4k6XO7up2h+UsHexk7mEz4sfZxkEXGrW6PSh+/Q==", + "path": "discord.net.commands/3.1.0", + "hashPath": "discord.net.commands.3.1.0.nupkg.sha512" + }, + "Discord.Net.Core/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Oxz3CiWVvenSaHRYZeCKgRqzcWqdjGYmpxVVN2vPikt6bTN+xHAR4jczk8plKDDdINt7Lac37iLsRaqzUtJZpQ==", + "path": "discord.net.core/3.1.0", + "hashPath": "discord.net.core.3.1.0.nupkg.sha512" + }, + "Discord.Net.Interactions/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-XzLChVRQGniUU8kdLMDYEOjifzvrcsOiAdKm/pO/PGPpZSMWSzPWlJUWaQlWMtOImrYULzRejOeoc2/3K3R30Q==", + "path": "discord.net.interactions/3.1.0", + "hashPath": "discord.net.interactions.3.1.0.nupkg.sha512" + }, + "Discord.Net.Rest/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-97kdAYjlNuuOnhRQW/OoGK2oBObvpzZlCSPJjIcI4DneEq6k2WIFhG00fvxK7DCVTlB5BgBMAT1BeRUk4/rUxQ==", + "path": "discord.net.rest/3.1.0", + "hashPath": "discord.net.rest.3.1.0.nupkg.sha512" + }, + "Discord.Net.Webhook/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-cZFxFf9H3GUBITlx1b7IskglgjJxSYpOIZOtyVW2WnPp7LpnxlOi1piRG22fH9fdhCC/RyDx3gZtYfN6WzacCw==", + "path": "discord.net.webhook/3.1.0", + "hashPath": "discord.net.webhook.3.1.0.nupkg.sha512" + }, + "Discord.Net.WebSocket/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-6OsLNXHNKC/laDKoBD+T0Km0vzqHaCcBOaI/NA8Qsed935MtEOTy7juorF22gF6TYOeoclUgSINrHCY4zWvxpA==", + "path": "discord.net.websocket/3.1.0", + "hashPath": "discord.net.websocket.3.1.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": "" + } + } +} \ No newline at end of file diff --git a/BUILDS/net5.0/CMD_Utils.dll b/BUILDS/net5.0/CMD_Utils.dll new file mode 100644 index 0000000..bb1fc45 Binary files /dev/null and b/BUILDS/net5.0/CMD_Utils.dll differ diff --git a/BUILDS/net5.0/EVE_LevelingSystem.deps.json b/BUILDS/net5.0/EVE_LevelingSystem.deps.json new file mode 100644 index 0000000..21334b2 --- /dev/null +++ b/BUILDS/net5.0/EVE_LevelingSystem.deps.json @@ -0,0 +1,268 @@ +{ + "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.1.0": { + "dependencies": { + "Discord.Net.Commands": "3.1.0", + "Discord.Net.Core": "3.1.0", + "Discord.Net.Interactions": "3.1.0", + "Discord.Net.Rest": "3.1.0", + "Discord.Net.WebSocket": "3.1.0", + "Discord.Net.Webhook": "3.1.0" + } + }, + "Discord.Net.Commands/3.1.0": { + "dependencies": { + "Discord.Net.Core": "3.1.0" + }, + "runtime": { + "lib/net5.0/Discord.Net.Commands.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.1.0.0" + } + } + }, + "Discord.Net.Core/3.1.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.1.0.0", + "fileVersion": "3.1.0.0" + } + } + }, + "Discord.Net.Interactions/3.1.0": { + "dependencies": { + "Discord.Net.Core": "3.1.0", + "Discord.Net.Rest": "3.1.0", + "Discord.Net.WebSocket": "3.1.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.1.0.0", + "fileVersion": "3.1.0.0" + } + } + }, + "Discord.Net.Rest/3.1.0": { + "dependencies": { + "Discord.Net.Core": "3.1.0" + }, + "runtime": { + "lib/net5.0/Discord.Net.Rest.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.1.0.0" + } + } + }, + "Discord.Net.Webhook/3.1.0": { + "dependencies": { + "Discord.Net.Core": "3.1.0", + "Discord.Net.Rest": "3.1.0" + }, + "runtime": { + "lib/net5.0/Discord.Net.Webhook.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.1.0.0" + } + } + }, + "Discord.Net.WebSocket/3.1.0": { + "dependencies": { + "Discord.Net.Core": "3.1.0", + "Discord.Net.Rest": "3.1.0" + }, + "runtime": { + "lib/net5.0/Discord.Net.WebSocket.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.1.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.1.0" + }, + "runtime": { + "PluginManager.dll": {} + } + } + } + }, + "libraries": { + "EVE_LevelingSystem/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Discord.Net/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-GAY7d+k8UN5BsObGpysvg7ca6YwTqvesTouM8S8eBWSmwGnK38iceVkURg0QNAG70tlJ4w8S/BOjocRRvXU2MQ==", + "path": "discord.net/3.1.0", + "hashPath": "discord.net.3.1.0.nupkg.sha512" + }, + "Discord.Net.Commands/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-EZdtrAqj6Uspyz4CvIwFP/UQ4XUpXjIPG1b5LrfAKOo12ks4k6XO7up2h+UsHexk7mEz4sfZxkEXGrW6PSh+/Q==", + "path": "discord.net.commands/3.1.0", + "hashPath": "discord.net.commands.3.1.0.nupkg.sha512" + }, + "Discord.Net.Core/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Oxz3CiWVvenSaHRYZeCKgRqzcWqdjGYmpxVVN2vPikt6bTN+xHAR4jczk8plKDDdINt7Lac37iLsRaqzUtJZpQ==", + "path": "discord.net.core/3.1.0", + "hashPath": "discord.net.core.3.1.0.nupkg.sha512" + }, + "Discord.Net.Interactions/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-XzLChVRQGniUU8kdLMDYEOjifzvrcsOiAdKm/pO/PGPpZSMWSzPWlJUWaQlWMtOImrYULzRejOeoc2/3K3R30Q==", + "path": "discord.net.interactions/3.1.0", + "hashPath": "discord.net.interactions.3.1.0.nupkg.sha512" + }, + "Discord.Net.Rest/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-97kdAYjlNuuOnhRQW/OoGK2oBObvpzZlCSPJjIcI4DneEq6k2WIFhG00fvxK7DCVTlB5BgBMAT1BeRUk4/rUxQ==", + "path": "discord.net.rest/3.1.0", + "hashPath": "discord.net.rest.3.1.0.nupkg.sha512" + }, + "Discord.Net.Webhook/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-cZFxFf9H3GUBITlx1b7IskglgjJxSYpOIZOtyVW2WnPp7LpnxlOi1piRG22fH9fdhCC/RyDx3gZtYfN6WzacCw==", + "path": "discord.net.webhook/3.1.0", + "hashPath": "discord.net.webhook.3.1.0.nupkg.sha512" + }, + "Discord.Net.WebSocket/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-6OsLNXHNKC/laDKoBD+T0Km0vzqHaCcBOaI/NA8Qsed935MtEOTy7juorF22gF6TYOeoclUgSINrHCY4zWvxpA==", + "path": "discord.net.websocket/3.1.0", + "hashPath": "discord.net.websocket.3.1.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": "" + } + } +} \ No newline at end of file diff --git a/BUILDS/net5.0/EVE_LevelingSystem.dll b/BUILDS/net5.0/EVE_LevelingSystem.dll new file mode 100644 index 0000000..5c2caaa Binary files /dev/null and b/BUILDS/net5.0/EVE_LevelingSystem.dll differ diff --git a/BUILDS/net5.0/PluginManager.dll b/BUILDS/net5.0/PluginManager.dll new file mode 100644 index 0000000..b24bd2d Binary files /dev/null and b/BUILDS/net5.0/PluginManager.dll differ diff --git a/BUILDS/net5.0/StartupEvents.deps.json b/BUILDS/net5.0/StartupEvents.deps.json new file mode 100644 index 0000000..ac69826 --- /dev/null +++ b/BUILDS/net5.0/StartupEvents.deps.json @@ -0,0 +1,268 @@ +{ + "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.1.0": { + "dependencies": { + "Discord.Net.Commands": "3.1.0", + "Discord.Net.Core": "3.1.0", + "Discord.Net.Interactions": "3.1.0", + "Discord.Net.Rest": "3.1.0", + "Discord.Net.WebSocket": "3.1.0", + "Discord.Net.Webhook": "3.1.0" + } + }, + "Discord.Net.Commands/3.1.0": { + "dependencies": { + "Discord.Net.Core": "3.1.0" + }, + "runtime": { + "lib/net5.0/Discord.Net.Commands.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.1.0.0" + } + } + }, + "Discord.Net.Core/3.1.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.1.0.0", + "fileVersion": "3.1.0.0" + } + } + }, + "Discord.Net.Interactions/3.1.0": { + "dependencies": { + "Discord.Net.Core": "3.1.0", + "Discord.Net.Rest": "3.1.0", + "Discord.Net.WebSocket": "3.1.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.1.0.0", + "fileVersion": "3.1.0.0" + } + } + }, + "Discord.Net.Rest/3.1.0": { + "dependencies": { + "Discord.Net.Core": "3.1.0" + }, + "runtime": { + "lib/net5.0/Discord.Net.Rest.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.1.0.0" + } + } + }, + "Discord.Net.Webhook/3.1.0": { + "dependencies": { + "Discord.Net.Core": "3.1.0", + "Discord.Net.Rest": "3.1.0" + }, + "runtime": { + "lib/net5.0/Discord.Net.Webhook.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.1.0.0" + } + } + }, + "Discord.Net.WebSocket/3.1.0": { + "dependencies": { + "Discord.Net.Core": "3.1.0", + "Discord.Net.Rest": "3.1.0" + }, + "runtime": { + "lib/net5.0/Discord.Net.WebSocket.dll": { + "assemblyVersion": "3.1.0.0", + "fileVersion": "3.1.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.1.0" + }, + "runtime": { + "PluginManager.dll": {} + } + } + } + }, + "libraries": { + "StartupEvents/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Discord.Net/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-GAY7d+k8UN5BsObGpysvg7ca6YwTqvesTouM8S8eBWSmwGnK38iceVkURg0QNAG70tlJ4w8S/BOjocRRvXU2MQ==", + "path": "discord.net/3.1.0", + "hashPath": "discord.net.3.1.0.nupkg.sha512" + }, + "Discord.Net.Commands/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-EZdtrAqj6Uspyz4CvIwFP/UQ4XUpXjIPG1b5LrfAKOo12ks4k6XO7up2h+UsHexk7mEz4sfZxkEXGrW6PSh+/Q==", + "path": "discord.net.commands/3.1.0", + "hashPath": "discord.net.commands.3.1.0.nupkg.sha512" + }, + "Discord.Net.Core/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Oxz3CiWVvenSaHRYZeCKgRqzcWqdjGYmpxVVN2vPikt6bTN+xHAR4jczk8plKDDdINt7Lac37iLsRaqzUtJZpQ==", + "path": "discord.net.core/3.1.0", + "hashPath": "discord.net.core.3.1.0.nupkg.sha512" + }, + "Discord.Net.Interactions/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-XzLChVRQGniUU8kdLMDYEOjifzvrcsOiAdKm/pO/PGPpZSMWSzPWlJUWaQlWMtOImrYULzRejOeoc2/3K3R30Q==", + "path": "discord.net.interactions/3.1.0", + "hashPath": "discord.net.interactions.3.1.0.nupkg.sha512" + }, + "Discord.Net.Rest/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-97kdAYjlNuuOnhRQW/OoGK2oBObvpzZlCSPJjIcI4DneEq6k2WIFhG00fvxK7DCVTlB5BgBMAT1BeRUk4/rUxQ==", + "path": "discord.net.rest/3.1.0", + "hashPath": "discord.net.rest.3.1.0.nupkg.sha512" + }, + "Discord.Net.Webhook/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-cZFxFf9H3GUBITlx1b7IskglgjJxSYpOIZOtyVW2WnPp7LpnxlOi1piRG22fH9fdhCC/RyDx3gZtYfN6WzacCw==", + "path": "discord.net.webhook/3.1.0", + "hashPath": "discord.net.webhook.3.1.0.nupkg.sha512" + }, + "Discord.Net.WebSocket/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-6OsLNXHNKC/laDKoBD+T0Km0vzqHaCcBOaI/NA8Qsed935MtEOTy7juorF22gF6TYOeoclUgSINrHCY4zWvxpA==", + "path": "discord.net.websocket/3.1.0", + "hashPath": "discord.net.websocket.3.1.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": "" + } + } +} \ No newline at end of file diff --git a/BUILDS/net5.0/StartupEvents.dll b/BUILDS/net5.0/StartupEvents.dll new file mode 100644 index 0000000..ad9fca9 Binary files /dev/null and b/BUILDS/net5.0/StartupEvents.dll differ diff --git a/BUILDS/net5.0/ref/CMD_LevelingSystem.dll b/BUILDS/net5.0/ref/CMD_LevelingSystem.dll new file mode 100644 index 0000000..46b3c6f Binary files /dev/null and b/BUILDS/net5.0/ref/CMD_LevelingSystem.dll differ diff --git a/BUILDS/net5.0/ref/CMD_Utils.dll b/BUILDS/net5.0/ref/CMD_Utils.dll new file mode 100644 index 0000000..782729d Binary files /dev/null and b/BUILDS/net5.0/ref/CMD_Utils.dll differ diff --git a/BUILDS/net5.0/ref/EVE_LevelingSystem.dll b/BUILDS/net5.0/ref/EVE_LevelingSystem.dll new file mode 100644 index 0000000..1317ae7 Binary files /dev/null and b/BUILDS/net5.0/ref/EVE_LevelingSystem.dll differ diff --git a/BUILDS/net5.0/ref/StartupEvents.dll b/BUILDS/net5.0/ref/StartupEvents.dll new file mode 100644 index 0000000..ce85f38 Binary files /dev/null and b/BUILDS/net5.0/ref/StartupEvents.dll differ diff --git a/CMD_LevelingSystem/CMD_LevelingSystem.csproj b/CMD_LevelingSystem/CMD_LevelingSystem.csproj new file mode 100644 index 0000000..8495526 --- /dev/null +++ b/CMD_LevelingSystem/CMD_LevelingSystem.csproj @@ -0,0 +1,19 @@ + + + + net5.0 + + + + E:\DiscordBot\BUILDS\ + DEBUG;TRACE + prompt + none + false + + + + + + + diff --git a/CMD_LevelingSystem/Commands/level.cs b/CMD_LevelingSystem/Commands/level.cs new file mode 100644 index 0000000..ef5f8dc --- /dev/null +++ b/CMD_LevelingSystem/Commands/level.cs @@ -0,0 +1,55 @@ +using Discord; +using Discord.Commands; +using Discord.WebSocket; + +using PluginManager.Interfaces; +using PluginManager.LanguageSystem; + +using System; + + +public class level : DBCommand +{ + public string Command => "rank"; + + public string Description => "Display your current level"; + + public string Usage => "rank"; + + public bool canUseDM => false; + + public bool canUseServer => true; + + public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM) + { + + try + { + int cLv = Data.GetLevel(message.Author.Id); + Int64 cEXP = Data.GetExp(message.Author.Id); + Int64 rEXP = Data.GetReqEXP(message.Author.Id); + + var embed = new EmbedBuilder() + { + Title = "Leveling System", + Description = message.Author.Mention + }; + embed.WithColor(Color.Blue); + embed.AddField("Level", cLv); + embed.AddField("Current EXP", cEXP); + embed.AddField("Required Exp to Level up", rEXP); + embed.WithCurrentTimestamp(); + await message.Channel.SendMessageAsync(embed: embed.Build()); + } + catch + { + if (Language.ActiveLanguage != null) + await message.Channel.SendMessageAsync(Language.ActiveLanguage.LanguageWords["DB_COMMAND_RANK_NO_RANK"]); + else await message.Channel.SendMessageAsync("You are unranked now. Please type a message in chat that is not a command and try again this command"); + return; + } + + + } +} + diff --git a/CMD_LevelingSystem/Items/Leveling System/Core.cs b/CMD_LevelingSystem/Items/Leveling System/Core.cs new file mode 100644 index 0000000..10314f4 --- /dev/null +++ b/CMD_LevelingSystem/Items/Leveling System/Core.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; + +public class Core +{ + + public static Dictionary playerMessages = new Dictionary(); + + private static readonly string folder = @".\Data\Resources\LevelingSystem\"; + + public static int GetLevel(ulong id) => int.Parse(File.ReadAllText(Path.Combine(folder, id.ToString() + ".data")).Split(',')[0].Split('=')[1]); + + + public static Int64 GetExp(ulong id) => Int64.Parse(File.ReadAllText(Path.Combine(folder, id.ToString() + ".data")).Split(',')[1].Split('=')[1]); + + + public static Int64 GetReqEXP(ulong id) => Int64.Parse(File.ReadAllText(Path.Combine(folder, id.ToString() + ".data")).Split(',')[2].Split('=')[1]); + public static void SaveData(ulong id, int lv, Int64 cexp, Int64 rexp) + { + Directory.CreateDirectory(folder); + File.WriteAllText(Path.Combine(folder, id.ToString() + ".data"), $"Level={lv},EXP={cexp},REXP={rexp}"); + } + private static Int64 NextLevelXP(int level) + { + return (level * level) + 2 * level + 75; + } + + public static (bool, int) MessageSent(ulong id, int messageLength) + { + WaitForTimeToRemoveFromList(id, 60); + + if (!File.Exists(Path.Combine(folder, id.ToString() + ".data"))) + { + SaveData(id, 0, 0, 0); + } + Int64 cEXp = GetExp(id); + Int64 rExp = GetReqEXP(id); + int random = new System.Random().Next(3, 6) + messageLength; + cEXp += random; + if (cEXp >= rExp) + { + cEXp = cEXp - rExp; + int lv = GetLevel(id); + rExp = NextLevelXP(lv); + lv++; + SaveData(id, lv, cEXp, rExp); + return (true, lv); + } + + SaveData(id, GetLevel(id), cEXp, rExp); + return (false, -1); + } + + public static async void WaitForTimeToRemoveFromList(ulong id, int time_seconds) + { + await Task.Delay(time_seconds * 1000); + playerMessages.Remove(id); + } + +} \ No newline at end of file diff --git a/CMD_LevelingSystem/Items/Leveling System/Data.cs b/CMD_LevelingSystem/Items/Leveling System/Data.cs new file mode 100644 index 0000000..44ffb76 --- /dev/null +++ b/CMD_LevelingSystem/Items/Leveling System/Data.cs @@ -0,0 +1,24 @@ +using Discord.WebSocket; + +using System; +using System.IO; +public static class Data +{ + private static readonly string folder = @".\Data\Resources\LevelingSystem\"; + public static void registerPlayer(SocketGuildUser user) + { + ulong id = user.Id; + Directory.CreateDirectory(folder); + File.WriteAllText(Path.Combine(folder, id.ToString() + ".data"), "Level=0,EXP=0,REXP=100"); + } + + public static int GetLevel(ulong id) => int.Parse(File.ReadAllText(Path.Combine(folder, id.ToString() + ".data")).Split(',')[0].Split('=')[1]); + + + public static Int64 GetExp(ulong id) => Int64.Parse(File.ReadAllText(Path.Combine(folder, id.ToString() + ".data")).Split(',')[1].Split('=')[1]); + + + public static Int64 GetReqEXP(ulong id) => Int64.Parse(File.ReadAllText(Path.Combine(folder, id.ToString() + ".data")).Split(',')[2].Split('=')[1]); + + +} diff --git a/CMD_Utils/CMD_Utils.csproj b/CMD_Utils/CMD_Utils.csproj new file mode 100644 index 0000000..6d89c4e --- /dev/null +++ b/CMD_Utils/CMD_Utils.csproj @@ -0,0 +1,15 @@ + + + + net5.0 + + + + E:\DiscordBot\BUILDS\ + + + + + + + diff --git a/CMD_Utils/Echo.cs b/CMD_Utils/Echo.cs new file mode 100644 index 0000000..90286a8 --- /dev/null +++ b/CMD_Utils/Echo.cs @@ -0,0 +1,22 @@ +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 async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM) + { + string m = message.Content.Substring(6); + await message.Channel.SendMessageAsync(m); + } +} diff --git a/CMD_Utils/FlipCoin.cs b/CMD_Utils/FlipCoin.cs new file mode 100644 index 0000000..04446f4 --- /dev/null +++ b/CMD_Utils/FlipCoin.cs @@ -0,0 +1,35 @@ +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 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"); + } + } +} diff --git a/CMD_Utils/Random.cs b/CMD_Utils/Random.cs new file mode 100644 index 0000000..4794634 --- /dev/null +++ b/CMD_Utils/Random.cs @@ -0,0 +1,40 @@ +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 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); + } + } +} diff --git a/DiscordBot.sln b/DiscordBot.sln new file mode 100644 index 0000000..6ae28f2 --- /dev/null +++ b/DiscordBot.sln @@ -0,0 +1,69 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31729.503 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscordBot", "DiscordBot\DiscordBot.csproj", "{087E64F4-1E1C-4899-8223-295356C9894A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PluginManager", "PluginManager\PluginManager.csproj", "{EDD4D9B3-98DD-4367-A09F-D1C5ACB61132}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{1862ABD5-7C30-4F15-A561-45AC8A9CA10E}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Events", "Events", "{A290C028-77C4-4D1D-AB43-DDFE6ABD9012}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Commands", "Commands", "{449FA364-0B72-43FF-B3A3-806E2916200E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CMD_LevelingSystem", "CMD_LevelingSystem\CMD_LevelingSystem.csproj", "{A48E8DC6-DBA2-4B47-9D59-46F4835F82CC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EVE_LevelingSystem", "EVE_LevelingSystem\EVE_LevelingSystem.csproj", "{1C1E7F3D-E05A-4A87-9789-62D98904C200}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StartupEvents", "StartupEvents\StartupEvents.csproj", "{CE9DBF06-38A0-4192-8B3E-4009210D040D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CMD_Utils", "CMD_Utils\CMD_Utils.csproj", "{E26C87A4-3DD6-4B58-B14B-C8E086B852F9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {087E64F4-1E1C-4899-8223-295356C9894A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {087E64F4-1E1C-4899-8223-295356C9894A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {087E64F4-1E1C-4899-8223-295356C9894A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {087E64F4-1E1C-4899-8223-295356C9894A}.Release|Any CPU.Build.0 = Release|Any CPU + {EDD4D9B3-98DD-4367-A09F-D1C5ACB61132}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EDD4D9B3-98DD-4367-A09F-D1C5ACB61132}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EDD4D9B3-98DD-4367-A09F-D1C5ACB61132}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EDD4D9B3-98DD-4367-A09F-D1C5ACB61132}.Release|Any CPU.Build.0 = Release|Any CPU + {A48E8DC6-DBA2-4B47-9D59-46F4835F82CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A48E8DC6-DBA2-4B47-9D59-46F4835F82CC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A48E8DC6-DBA2-4B47-9D59-46F4835F82CC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A48E8DC6-DBA2-4B47-9D59-46F4835F82CC}.Release|Any CPU.Build.0 = Release|Any CPU + {1C1E7F3D-E05A-4A87-9789-62D98904C200}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1C1E7F3D-E05A-4A87-9789-62D98904C200}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1C1E7F3D-E05A-4A87-9789-62D98904C200}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1C1E7F3D-E05A-4A87-9789-62D98904C200}.Release|Any CPU.Build.0 = Release|Any CPU + {CE9DBF06-38A0-4192-8B3E-4009210D040D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CE9DBF06-38A0-4192-8B3E-4009210D040D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CE9DBF06-38A0-4192-8B3E-4009210D040D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CE9DBF06-38A0-4192-8B3E-4009210D040D}.Release|Any CPU.Build.0 = Release|Any CPU + {E26C87A4-3DD6-4B58-B14B-C8E086B852F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E26C87A4-3DD6-4B58-B14B-C8E086B852F9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E26C87A4-3DD6-4B58-B14B-C8E086B852F9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E26C87A4-3DD6-4B58-B14B-C8E086B852F9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {A290C028-77C4-4D1D-AB43-DDFE6ABD9012} = {1862ABD5-7C30-4F15-A561-45AC8A9CA10E} + {449FA364-0B72-43FF-B3A3-806E2916200E} = {1862ABD5-7C30-4F15-A561-45AC8A9CA10E} + {A48E8DC6-DBA2-4B47-9D59-46F4835F82CC} = {449FA364-0B72-43FF-B3A3-806E2916200E} + {1C1E7F3D-E05A-4A87-9789-62D98904C200} = {A290C028-77C4-4D1D-AB43-DDFE6ABD9012} + {CE9DBF06-38A0-4192-8B3E-4009210D040D} = {A290C028-77C4-4D1D-AB43-DDFE6ABD9012} + {E26C87A4-3DD6-4B58-B14B-C8E086B852F9} = {449FA364-0B72-43FF-B3A3-806E2916200E} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3FB3C5DE-ED21-4D2E-ABDD-3A00EE4A2FFF} + EndGlobalSection +EndGlobal diff --git a/DiscordBot/App.config b/DiscordBot/App.config new file mode 100644 index 0000000..ffaf540 --- /dev/null +++ b/DiscordBot/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/DiscordBot/Discord/Commands/Help.cs b/DiscordBot/Discord/Commands/Help.cs new file mode 100644 index 0000000..593b9f5 --- /dev/null +++ b/DiscordBot/Discord/Commands/Help.cs @@ -0,0 +1,37 @@ +using Discord.Commands; +using Discord.WebSocket; + +using PluginManager.Loaders; +using PluginManager.Interfaces; + +namespace PluginManager.Commands +{ + internal class Help : DBCommand + { + public string Command => "help"; + + public string Description => "This command allows you to check all loadded commands"; + + public string Usage => "help"; + + public bool canUseDM => true; + public bool canUseServer => true; + + public void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM) + { + if (isDM) + { + foreach (DBCommand p in PluginLoader.Plugins!) + if (p.canUseDM) + context.Channel.SendMessageAsync(p.Usage + "\t" + p.Description); + } + else + { + foreach (DBCommand p in PluginLoader.Plugins!) + if (p.canUseServer) + context.Channel.SendMessageAsync(p.Usage + "\t" + p.Description); + } + + } + } +} \ No newline at end of file diff --git a/DiscordBot/Discord/Core/Boot.cs b/DiscordBot/Discord/Core/Boot.cs new file mode 100644 index 0000000..a55bd41 --- /dev/null +++ b/DiscordBot/Discord/Core/Boot.cs @@ -0,0 +1,113 @@ +using Discord; +using Discord.Commands; +using Discord.WebSocket; + +using System; +using System.Threading.Tasks; + +using static PluginManager.Others.Functions; + +namespace PluginManager.Core +{ + internal class Boot + { + private readonly string botPrefix; + private readonly string botToken; + + private bool isReady = false; + + public DiscordSocketClient? client; + private CommandHandler? commandServiceHandler; + private CommandService? service; + + public Boot(string botToken, string botPrefix) + { + this.botPrefix = botPrefix; + this.botToken = botToken; + } + + 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(); + + while (!isReady) ; + + } + + public async Task ShutDown() + { + if (client == null) return; + await client.StopAsync(); + } + + 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; + 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; + } + } +} diff --git a/DiscordBot/Discord/Core/CommandHandler.cs b/DiscordBot/Discord/Core/CommandHandler.cs new file mode 100644 index 0000000..b141584 --- /dev/null +++ b/DiscordBot/Discord/Core/CommandHandler.cs @@ -0,0 +1,85 @@ +using Discord.Commands; +using Discord.WebSocket; + +using PluginManager.Interfaces; + +using System.Reflection; +using PluginManager.Others; +using PluginManager.Loaders; + +using System.Threading.Tasks; +using System.Linq; + +namespace PluginManager.Core +{ + internal class CommandHandler + { + private readonly DiscordSocketClient client; + private readonly CommandService commandService; + private readonly string botPrefix; + + public CommandHandler(DiscordSocketClient client, CommandService commandService, string botPrefix) + { + this.client = client; + this.commandService = commandService; + this.botPrefix = botPrefix; + } + + public async Task InstallCommandsAsync() + { + client.MessageReceived += MessageHandler; + await commandService.AddModulesAsync(assembly: Assembly.GetEntryAssembly(), services: null); + } + + private async Task MessageHandler(SocketMessage Message) + { + try + { + if (Message as SocketUserMessage == null) + return; + + var message = Message as SocketUserMessage; + + if (message == null) return; + + int argPos = 0; + + if (message.HasMentionPrefix(client.CurrentUser, ref argPos)) + { + await message.Channel.SendMessageAsync("Can not exec mentioned commands !"); + return; + } + + if (!(message.HasStringPrefix(botPrefix, ref argPos) || message.Author.IsBot)) + return; + + var context = new SocketCommandContext(client, message); + + await commandService.ExecuteAsync( + context: context, + argPos: argPos, + services: null + ); + + DBCommand? plugin = PluginLoader.Plugins!.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) + { + plugin.Execute(context, message, client, true); + Functions.WriteLogFile("Executed command (DM) : " + plugin.Command); + } + return; + } + plugin.Execute(context, message, client, false); + Functions.WriteLogFile("Executed command : " + plugin.Command); + } + } + catch { } + + } + } +} \ No newline at end of file diff --git a/DiscordBot/DiscordBot.csproj b/DiscordBot/DiscordBot.csproj new file mode 100644 index 0000000..46319c7 --- /dev/null +++ b/DiscordBot/DiscordBot.csproj @@ -0,0 +1,35 @@ + + + + Exe + net5.0 + enable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DiscordBot/Program.cs b/DiscordBot/Program.cs new file mode 100644 index 0000000..93698e0 --- /dev/null +++ b/DiscordBot/Program.cs @@ -0,0 +1,469 @@ +using Discord; +using System; +using System.IO; +using System.Threading.Tasks; + +using PluginManager.Core; +using PluginManager.Others; + +using PluginManager.Loaders; +using PluginManager.LanguageSystem; +using PluginManager.Online; +namespace DiscordBot +{ + public class Program + { + private static PluginsManager manager = new PluginsManager("https://sethdiscordbot.000webhostapp.com/Storage/Discord%20Bot/Plugins"); + private static LanguageManager languageManager = new LanguageManager("https://sethdiscordbot.000webhostapp.com/Storage/Discord%20Bot/Languages"); + + private static bool loadPluginsOnStartup = false; + + /// + /// The main entry point for the application. + /// + [STAThread] + [Obsolete] + + public static void Main(string[] args) + { + AppDomain.CurrentDomain.AppendPrivatePath(".\\Requirements"); + Console.Clear(); + Directory.CreateDirectory("./Data/Resources"); + Directory.CreateDirectory("./Data/Languages"); + Directory.CreateDirectory("./Data/Plugins/Commands"); + Directory.CreateDirectory("./Data/Plugins/Events"); + if (!File.Exists("./Data/Resources/DiscordBotCore.data") || Functions.readCodeFromFile("./Data/Resources/DiscordBotCore.data", "BOT_TOKEN", '\t').Length != 59) + { + File.WriteAllText("./Data/Resources/DiscordBotCore.data", "BOT_TOKEN\ttoken\nBOT_PREFIX\t!\n"); + while (true) + { + Console.WriteLine("Please insert your token: "); + Console.Write("TOKEN: "); + string botToken = Console.ReadLine(); + if (botToken.Length == 59) + { + string prefix = Functions.readCodeFromFile("./Data/Resources/DiscordBotCore.data", "BOT_PREFIX", + '\t'); + if (prefix == String.Empty || prefix == null) + prefix = "!"; + File.WriteAllText("./Data/Resources/DiscordBotCore.data", $"BOT_TOKEN\t{botToken}\nBOT_PREFIX\t{prefix}\n"); + break; + } + else Console.WriteLine("Invalid Token !"); + } + } + + HandleInput(args).Wait(); + } + + /// + /// Reset all settings for the bot + /// + private static Task ResetSettings() + { + string[] files = Directory.GetFiles(@"./Data/Resources"); + foreach (string file in files) File.Delete(file); + return Task.CompletedTask; + } + + /// + /// The main loop for the discord bot + /// + /// The discord booter used to start the application + private static async Task NoGUI(Boot discordbooter) + { + LoadLanguage(); + if (loadPluginsOnStartup) LoadPlugins(discordbooter); + while (true) + { + Console.ForegroundColor = ConsoleColor.White; + Console.Write('$'); + string[] data = Console.ReadLine().Split(' '); + if (data[0].Length < 2) continue; + switch (data[0]) + { + case "shutdown": + case "sd": + if (discordbooter.client.ConnectionState == ConnectionState.Connected) + await discordbooter.ShutDown().ContinueWith(t => { Environment.Exit(0); }); + break; + + case "listplugs": + await manager.ListAvailablePlugins(); + break; + + case "dwplug": + string name = data.MergeStrings(1); + string[] info = await manager.GetPluginLinkByName(name); + if (info[1] == null) // link is null + { + if (name == "") + { + Functions.WriteColorText($"Name is invalid"); + break; + } + Functions.WriteColorText($"Failed to find plugin &b{name} &c! Use &glistplugs &ccommand to display all available plugins !"); + break; + + } + Downloader dw = new Downloader(name + ".dll", info[1]); + await dw.DownloadFileAsync("./Data/Plugins/", info[0]); + break; + case "setlang": + if (data.Length == 2) + SetLanguage(data[1]); + break; + case "set-setting": + if (data.Length >= 3) + Functions.WriteToSettingsFast(data[1], Functions.MergeStrings(data, 2)); + else Console.WriteLine("Failed to write to settings. Invalid params"); + break; + case "listlang": + await languageManager.ListAllLanguages(); + break; + case "dwlang": + string Lname = data.MergeStrings(1); + string[] link = await languageManager.GetDownloadLink(Lname); + if (link[0] == null) + { + if (Lname == "") + { + Functions.WriteColorText($"Name is invalid"); + break; + } + Functions.WriteColorText("Failed to find language &b" + Lname + " &c! Use &glistlang &ccommand to display all available languages !"); + break; + } + if (link[1].Contains("CrossPlatform") || link[1].Contains("cp")) + { + Downloader dwn = new Downloader(Lname + ".lng", link[0]); + await dwn.DownloadFileAsync(Functions.langFolder); + } + else Functions.WriteColorText("The language you are trying to download (&b" + Lname + "&c) is not compatible with the version of this bot. User &glistlang &ccommand in order to see all available languages for your current version !\n" + link[1]); + break; + case "loadplugins": + case "lp": + LoadPlugins(discordbooter); + break; + case "help": + Console.ForegroundColor = ConsoleColor.DarkYellow; + Console.WriteLine( + "lp | loadplugins -> load all plugins\n" + + "sd | shutdown->close connection to the server(stop bot)\n" + + "token -> display the current token\n" + + "listplugs -> list all available plugins\n" + + "dwplug [name] -> download plugin by name\n" + + "listlang -> list all available languages\n" + + "dwlang -> download language by name\n" + + "setlang [name] -> set language from the downloaded languages\n" + + "set-setting [setting.path] [value] -> set setting value" + ); + Console.ForegroundColor = ConsoleColor.White; + break; + case "token": + if (File.Exists("./Data/Resources/DiscordBotCore.data")) + Console.WriteLine("Token: " + Functions.readCodeFromFile("./Data/Resources/DiscordBotCore.data", "BOT_TOKEN", '\t')); + else Console.WriteLine("File could not be found. Please register token"); + break; + default: + goto case "help"; + } + } + } + + private static void LoadPlugins(Boot discordbooter) + { + var loader = new PluginLoader(discordbooter.client); + loader.onCMDLoad += (name, typeName, success, exception) => + { + Console.ForegroundColor = ConsoleColor.Green; + if (name == null || name.Length < 2) + name = typeName; + if (success) + if (Language.ActiveLanguage == null) + Console.WriteLine("[CMD] Successfully loaded command : " + name); + else Console.WriteLine(Language.ActiveLanguage.FormatText(Language.ActiveLanguage.LanguageWords["COMMAND_LOAD_SUCCESS"], name)); + else + if (Language.ActiveLanguage == null) + Console.WriteLine("[CMD] Failed to load command : " + name + " because " + exception.Message); + else + Console.WriteLine(Language.ActiveLanguage.FormatText(Language.ActiveLanguage.LanguageWords["COMMAND_LOAD_FAIL"], name, exception.Message)); + Console.ForegroundColor = ConsoleColor.Red; + }; + loader.onEVELoad += (name, typeName, success, exception) => + { + if (name == null || name.Length < 2) + name = typeName; + Console.ForegroundColor = ConsoleColor.Green; + if (success) + if (Language.ActiveLanguage == null) + Console.WriteLine("[EVENT] Successfully loaded event : " + name); + else + Console.WriteLine(Language.ActiveLanguage.FormatText(Language.ActiveLanguage.LanguageWords["EVENT_LOAD_SUCCESS"], name)); + else + if (Language.ActiveLanguage == null) + Console.WriteLine("[EVENT] Failed to load event : " + name + " because " + exception.Message); + else + Console.WriteLine(Language.ActiveLanguage.FormatText(Language.ActiveLanguage.LanguageWords["EVENT_LOAD_FAIL"], name, exception.Message)); + Console.ForegroundColor = ConsoleColor.Red; + }; + loader.LoadPlugins(); + } + + /// + /// Load the language from the specified file + /// + private static bool LoadLanguage() + { + string folder = Functions.langFolder; + string langSettings = "./Data/Resources/Language.txt"; + if (!File.Exists(langSettings)) + File.WriteAllText(langSettings, "Language=English"); + //Load language from the specified file ... + Language.ActiveLanguage = null; + + string langname = File.ReadAllText(langSettings).Split('=')[1]; + if (langname == "English") + { + Language.ActiveLanguage = null; + return true; + } + foreach (var file in Directory.GetFiles(folder)) + { + if (Functions.readCodeFromFile(file, "LANGUAGE_NAME", '=') == langname) + { + Language.ActiveLanguage = Language.CreateLanguageFromFile(file); + + return true; + } + } + + if (Language.ActiveLanguage == null) + { + File.WriteAllText(langSettings, "Language=English"); + Functions.WriteColorText($"Failed to find language &r{langname} &c! Check available languages using command: &glistlang"); + + return false; + } + + return false; + } + + public static void SetLanguage(string LanguageName) + { + + string folder = Functions.langFolder; + string langSettings = Functions.dataFolder + "Language.txt"; + File.WriteAllText(langSettings, "Language=" + LanguageName); + + try + { + bool success = LoadLanguage(); + if (success) + { + Functions.WriteColorText($"Language has been setted to: &g{LanguageName}"); + return; + } + } + catch (Exception ex) + { + Functions.WriteColorText($"Could not find language &r{LanguageName}."); + Functions.WriteErrFile(ex.ToString()); + File.WriteAllText(langSettings, "Language=English"); + LoadLanguage(); + } + } + + /// + /// Start the bot without user interface + /// + /// Returns the boot loader for the Discord Bot + private static async Task StartNoGUI() + { + + Console.Clear(); + Console.ForegroundColor = ConsoleColor.DarkYellow; + Console.WriteLine("Discord BOT for Cross Platform\n\nCreated by: Wizzy\nDiscord: Wizzy#9181\nCommands:"); + Console.WriteLine( + "lp | loadplugins -> load all plugins\n" + + "sd | shutdown->close connection to the server(stop bot)\n" + + "token -> display the current token\n" + + "listplugs -> list all available plugins\n" + + "dwplug [name] -> download plugin by name\n" + + "listlang -> list all available languages\n" + + "dwlang -> download language by name\n" + + "setlang [name] -> set language from the downloaded languages\n" + + "set-setting [setting.path] [value] -> set setting value" + ); + Console.ForegroundColor = ConsoleColor.White; + Console.WriteLine("============================ Discord BOT - Cross Platform ============================"); + string token = + Functions.readCodeFromFile((Functions.dataFolder + "DiscordBotCore.data"), "BOT_TOKEN", + '\t'); + string prefix = Functions.readCodeFromFile((Functions.dataFolder + "DiscordBotCore.data"), + "BOT_PREFIX", + '\t'); + + Console.WriteLine("Detected prefix: " + prefix); + var discordbooter = new Boot(token, prefix); + await discordbooter.Awake(); + return discordbooter; + } + + /// + /// Clear folder + /// + /// Directory path + 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; + } + + /// + /// Replace text in the file + /// + /// The file location (path) + /// The setting key code where to replace + /// The new value + /// If the does not exist, then this error is thrown + private static void ReplaceText(string file, string code, string value) + { + try + { + var f = false; + string[] text = File.ReadAllLines(file); + foreach (string line in text) + if (line.StartsWith(code)) + { + line.Replace(line.Split('\t')[1], value); + f = true; + } + + if (f) + File.WriteAllLines(@"./Data/Resources/DiscordBotCore.data", text); + else throw new FileNotFoundException(); + } + catch (FileNotFoundException) + { + File.AppendAllText(file, code + "\t" + value + "\n"); + } + } + + /// + /// Handle user input arguments from the startup of the application + /// + /// The arguments + 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 + "Login.dat"); + Console.WriteLine("Logged out. Please restart the application !"); + return; + } + + if (len == 2 && args[0] == "--encrypt") + { + Console.WriteLine("MD5: " + await Cryptography.CreateMD5(args[1])); + System.Console.WriteLine("SHA356: " + await Cryptography.CreateSHA256(args[1])); + return; + } + + if (len == 1 && args[0] == "--execute:lp") + { + loadPluginsOnStartup = true; + 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/Addons"); + 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; + } + } + } + } +} diff --git a/EVE_LevelingSystem/Core.cs b/EVE_LevelingSystem/Core.cs new file mode 100644 index 0000000..10314f4 --- /dev/null +++ b/EVE_LevelingSystem/Core.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; + +public class Core +{ + + public static Dictionary playerMessages = new Dictionary(); + + private static readonly string folder = @".\Data\Resources\LevelingSystem\"; + + public static int GetLevel(ulong id) => int.Parse(File.ReadAllText(Path.Combine(folder, id.ToString() + ".data")).Split(',')[0].Split('=')[1]); + + + public static Int64 GetExp(ulong id) => Int64.Parse(File.ReadAllText(Path.Combine(folder, id.ToString() + ".data")).Split(',')[1].Split('=')[1]); + + + public static Int64 GetReqEXP(ulong id) => Int64.Parse(File.ReadAllText(Path.Combine(folder, id.ToString() + ".data")).Split(',')[2].Split('=')[1]); + public static void SaveData(ulong id, int lv, Int64 cexp, Int64 rexp) + { + Directory.CreateDirectory(folder); + File.WriteAllText(Path.Combine(folder, id.ToString() + ".data"), $"Level={lv},EXP={cexp},REXP={rexp}"); + } + private static Int64 NextLevelXP(int level) + { + return (level * level) + 2 * level + 75; + } + + public static (bool, int) MessageSent(ulong id, int messageLength) + { + WaitForTimeToRemoveFromList(id, 60); + + if (!File.Exists(Path.Combine(folder, id.ToString() + ".data"))) + { + SaveData(id, 0, 0, 0); + } + Int64 cEXp = GetExp(id); + Int64 rExp = GetReqEXP(id); + int random = new System.Random().Next(3, 6) + messageLength; + cEXp += random; + if (cEXp >= rExp) + { + cEXp = cEXp - rExp; + int lv = GetLevel(id); + rExp = NextLevelXP(lv); + lv++; + SaveData(id, lv, cEXp, rExp); + return (true, lv); + } + + SaveData(id, GetLevel(id), cEXp, rExp); + return (false, -1); + } + + public static async void WaitForTimeToRemoveFromList(ulong id, int time_seconds) + { + await Task.Delay(time_seconds * 1000); + playerMessages.Remove(id); + } + +} \ No newline at end of file diff --git a/EVE_LevelingSystem/Data.cs b/EVE_LevelingSystem/Data.cs new file mode 100644 index 0000000..44ffb76 --- /dev/null +++ b/EVE_LevelingSystem/Data.cs @@ -0,0 +1,24 @@ +using Discord.WebSocket; + +using System; +using System.IO; +public static class Data +{ + private static readonly string folder = @".\Data\Resources\LevelingSystem\"; + public static void registerPlayer(SocketGuildUser user) + { + ulong id = user.Id; + Directory.CreateDirectory(folder); + File.WriteAllText(Path.Combine(folder, id.ToString() + ".data"), "Level=0,EXP=0,REXP=100"); + } + + public static int GetLevel(ulong id) => int.Parse(File.ReadAllText(Path.Combine(folder, id.ToString() + ".data")).Split(',')[0].Split('=')[1]); + + + public static Int64 GetExp(ulong id) => Int64.Parse(File.ReadAllText(Path.Combine(folder, id.ToString() + ".data")).Split(',')[1].Split('=')[1]); + + + public static Int64 GetReqEXP(ulong id) => Int64.Parse(File.ReadAllText(Path.Combine(folder, id.ToString() + ".data")).Split(',')[2].Split('=')[1]); + + +} diff --git a/EVE_LevelingSystem/EVE_LevelingSystem.csproj b/EVE_LevelingSystem/EVE_LevelingSystem.csproj new file mode 100644 index 0000000..1eefd33 --- /dev/null +++ b/EVE_LevelingSystem/EVE_LevelingSystem.csproj @@ -0,0 +1,17 @@ + + + + net5.0 + + + + E:\DiscordBot\BUILDS\ + none + false + + + + + + + diff --git a/EVE_LevelingSystem/LevelingSystem.cs b/EVE_LevelingSystem/LevelingSystem.cs new file mode 100644 index 0000000..9b399b0 --- /dev/null +++ b/EVE_LevelingSystem/LevelingSystem.cs @@ -0,0 +1,36 @@ +using System.Threading.Tasks; + +using Discord.WebSocket; + +using PluginManager.Others; +using PluginManager.Interfaces; +using PluginManager.LanguageSystem; +public class LevelingSystem : DBEvent +{ + public string name => "Leveling System"; + + public string description => "Leveling System Event"; + + public void Start(DiscordSocketClient client) + { + client.MessageReceived += Client_MessageReceived; + } + + private async Task Client_MessageReceived(SocketMessage arg) + { + if (arg.Author.IsBot || arg.Attachments.Count > 0 || arg.Content.StartsWith(Functions.readCodeFromFile(System.IO.Path.Combine(Functions.dataFolder, "DiscordBotCore.data"), "BOT_PREFIX", '\t'))) + return; + + if (Core.playerMessages.ContainsKey(arg.Author.Id)) + return; + + (bool x, int lv) = Core.MessageSent(arg.Author.Id, arg.Content.Length); + Core.playerMessages.Add(arg.Author.Id, arg.Content); + if (x) + if (Language.ActiveLanguage != null) + await arg.Channel.SendMessageAsync(Language.ActiveLanguage.LanguageWords["DB_EVENT_LEVEL_SYSTEM_LEVEL_UP"].Replace("{0}", lv.ToString())); + else await arg.Channel.SendMessageAsync("You've successfully leveled up to level " + lv); + + } +} + diff --git a/PluginManager/Interfaces/DBCommand.cs b/PluginManager/Interfaces/DBCommand.cs new file mode 100644 index 0000000..9fce268 --- /dev/null +++ b/PluginManager/Interfaces/DBCommand.cs @@ -0,0 +1,19 @@ +namespace PluginManager.Interfaces +{ + public interface DBCommand + { + string Command { get; } + + string Description { get; } + + string Usage { get; } + + bool canUseDM { get; } + bool canUseServer { get; } + + void Execute(Discord.Commands.SocketCommandContext context, + Discord.WebSocket.SocketMessage message, + Discord.WebSocket.DiscordSocketClient client, + bool isDM); + } +} \ No newline at end of file diff --git a/PluginManager/Interfaces/DBEvent.cs b/PluginManager/Interfaces/DBEvent.cs new file mode 100644 index 0000000..8741e81 --- /dev/null +++ b/PluginManager/Interfaces/DBEvent.cs @@ -0,0 +1,12 @@ +using Discord.WebSocket; + +namespace PluginManager.Interfaces +{ + public interface DBEvent + { + string name { get; } + string description { get; } + + void Start(DiscordSocketClient client); + } +} diff --git a/PluginManager/Items/CustomProgressBar.cs b/PluginManager/Items/CustomProgressBar.cs new file mode 100644 index 0000000..0efdccc --- /dev/null +++ b/PluginManager/Items/CustomProgressBar.cs @@ -0,0 +1,27 @@ +using System; +namespace PluginManager.Items +{ + public class CustomProgressBar + { + private const char _block = '#'; + private const char _emptyBlock = ' '; + private const char _leftMargin = '['; + private const char _rightMargin = ']'; + + const string _back = "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"; + public static void WriteProgressBar(int percent) + { + Console.Write(_back); + Console.Write(_leftMargin); + var p = (int)((percent / 10f) + .5f); + for (var i = 0; i < 10; ++i) + { + if (i >= p) + Console.Write(_emptyBlock); + else + Console.Write(_block); + } + Console.Write($"{_rightMargin} " + percent + " %"); + } + } +} diff --git a/PluginManager/Items/Spinner.cs b/PluginManager/Items/Spinner.cs new file mode 100644 index 0000000..5888eae --- /dev/null +++ b/PluginManager/Items/Spinner.cs @@ -0,0 +1,40 @@ +using System; +using System.Threading.Tasks; + +namespace PluginManager.Items +{ + public class Spinner + { + public bool isSpinning; + + public Spinner() + { + isSpinning = false; + } + + public async void Start() + { + isSpinning = true; + int cnt = 0; + + while (isSpinning) + { + cnt++; + switch (cnt % 4) + { + case 0: Console.Write("/"); break; + case 1: Console.Write("-"); break; + case 2: Console.Write("\\"); break; + case 3: Console.Write("|"); break; + } + Console.SetCursorPosition(Console.CursorLeft - 1, Console.CursorTop); + await Task.Delay(500); + } + } + + public void Stop() + { + isSpinning = false; + } + } +} \ No newline at end of file diff --git a/PluginManager/Language System/Language.cs b/PluginManager/Language System/Language.cs new file mode 100644 index 0000000..97a68a6 --- /dev/null +++ b/PluginManager/Language System/Language.cs @@ -0,0 +1,69 @@ +using PluginManager.Others; +using System.Collections.Generic; + +using System; +using System.IO; + +namespace PluginManager.LanguageSystem +{ + public class Language + { + public static Language? ActiveLanguage = null; + + private static readonly string LanguageFileExtension = ".lng"; + + private Language(string fileName, Dictionary words, string LanguageName) + { + this.fileName = fileName; + this.LanguageName = LanguageName; + LanguageWords = words; + } + + public string LanguageName { get; } + + public string fileName { get; } + + public Dictionary LanguageWords { get; } + + public static Language? CreateLanguageFromFile(string LanguageFileLocation) + { + if (!LanguageFileLocation.EndsWith(LanguageFileExtension)) + { + Console.WriteLine("Failed to load Language from file: " + LanguageFileLocation + + "\nFile extension is not .lng"); + return null; + } + + string[] lines = File.ReadAllLines(LanguageFileLocation); + var languageName = "Unknown"; + var words = new Dictionary(); + + foreach (string line in lines) + { + if (line.StartsWith("#") || line.Length < 4) + continue; + string[] sLine = line.Split('='); + + if (sLine[0] == "LANGUAGE_NAME") + { + languageName = sLine[1]; + continue; + } + + words.Add(sLine[0], sLine[1]); + } + + Functions.WriteLogFile("Successfully loaded language: " + languageName + " from file : " + + LanguageFileLocation.Replace('\\', '/')); + return new Language(LanguageFileLocation, words, languageName); + } + + public string FormatText(string text, params string[] args) + { + if (ActiveLanguage == null) return text; + int l = args.Length; + for (var i = 0; i < l; i++) text = text.Replace($"{i}", args[i]); + return text; + } + } +} \ No newline at end of file diff --git a/PluginManager/Loaders/CommandsLoader.cs b/PluginManager/Loaders/CommandsLoader.cs new file mode 100644 index 0000000..b1cea89 --- /dev/null +++ b/PluginManager/Loaders/CommandsLoader.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; + +using PluginManager.Interfaces; + +namespace PluginManager.Loaders +{ + public class CommandsLoader + { + private readonly string CMDPath; + private readonly string CMDExtension; + + public delegate void onCommandLoaded(string name, bool success, DBCommand? command = null, Exception? exception = null); + + public delegate void onCommandFileLoaded(string path); + + public onCommandLoaded? OnCommandLoaded; + public onCommandFileLoaded? OnCommandFileLoaded; + + public CommandsLoader(string CommandPath, string CommandExtension) + { + CMDPath = CommandPath; + CMDExtension = CommandExtension; + } + + public List? LoadCommands() + { + if (!Directory.Exists(CMDPath)) + { + Directory.CreateDirectory(CMDPath); + return null; + } + string[] files = Directory.GetFiles(CMDPath, $"*{CMDExtension}", SearchOption.AllDirectories); + + foreach (var file in files) + { + Assembly.LoadFile(Path.GetFullPath(file)); + if (OnCommandFileLoaded != null) + OnCommandFileLoaded.Invoke(file); + } + + List plugins = new List(); + + try + { + Type interfaceType = typeof(DBCommand); + Type[] types = AppDomain.CurrentDomain.GetAssemblies() + .SelectMany(a => a.GetTypes()) + .Where(p => interfaceType.IsAssignableFrom(p) && p.IsClass) + .ToArray(); + foreach (Type type in types) + { + try + { + DBCommand plugin = (DBCommand)Activator.CreateInstance(type)!; + plugins.Add(plugin); + + if (OnCommandLoaded != null) + OnCommandLoaded.Invoke(type.FullName!, true, plugin); + } + catch (Exception e) + { + if (OnCommandLoaded != null) + OnCommandLoaded.Invoke(type.FullName!, false, null, e); + } + + } + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + return null; + } + + return plugins; + + } + } +} diff --git a/PluginManager/Loaders/EventsLoader.cs b/PluginManager/Loaders/EventsLoader.cs new file mode 100644 index 0000000..d7fdc74 --- /dev/null +++ b/PluginManager/Loaders/EventsLoader.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; + +using PluginManager.Interfaces; + +namespace PluginManager.Loaders +{ + public class EventsLoader + { + + private readonly string EVPath; + private readonly string EVExtension; + + public delegate void onEventLoad(string name, bool success, DBEvent? ev = null, Exception? e = null); + public delegate void onEventFileLoaded(string path); + + public onEventLoad? EventLoad; + public onEventFileLoaded? EventFileLoaded; + + public EventsLoader(string path, string ext) + { + EVPath = path; + EVExtension = ext; + } + + public List? LoadEvents() + { + + if (!Directory.Exists(EVPath)) + { + Directory.CreateDirectory(EVPath); + return null; + } + + string[] files = Directory.GetFiles(EVPath, $"*{EVExtension}", SearchOption.AllDirectories); + + foreach (var file in files) + { + Assembly.LoadFile(Path.GetFullPath(file)); + if (EventFileLoaded != null) + EventFileLoaded.Invoke(file); + } + + List events = new List(); + + try + { + Type interfaceType = typeof(DBEvent); + Type[] types = AppDomain.CurrentDomain.GetAssemblies() + .SelectMany(a => a.GetTypes()) + .Where(p => interfaceType.IsAssignableFrom(p) && p.IsClass) + .ToArray(); + foreach (Type type in types) + { + try + { + DBEvent ev = (DBEvent)Activator.CreateInstance(type)!; + events.Add(ev); + + if (EventLoad != null) + EventLoad.Invoke(type.FullName!, true, ev); + } + catch (Exception e) + { + if (EventLoad != null) + EventLoad.Invoke(type.FullName!, false, null, e); + } + + } + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + return null; + } + + return events; + + } + } +} \ No newline at end of file diff --git a/PluginManager/Loaders/PluginLoader.cs b/PluginManager/Loaders/PluginLoader.cs new file mode 100644 index 0000000..d223d58 --- /dev/null +++ b/PluginManager/Loaders/PluginLoader.cs @@ -0,0 +1,86 @@ +using Discord.WebSocket; + +using PluginManager.Interfaces; +using PluginManager.Others; + +using System; +using System.Collections.Generic; +namespace PluginManager.Loaders +{ + public class PluginLoader + { + private DiscordSocketClient client; + public PluginLoader(DiscordSocketClient discordSocketClient) + { + this.client = discordSocketClient; + } + + private const string pluginCMDFolder = @"./Data/Plugins/Commands/"; + private const string pluginEVEFolder = @"./Data/Plugins/Events/"; + + private const string pluginCMDExtension = ".dll"; + private const string pluginEVEExtension = ".dll"; + + + public static List? Plugins { get; set; } + public static List? Events { get; set; } + + public delegate void CMDLoaded(string name, string typeName, bool success, Exception? e = null); + + public delegate void EVELoaded(string name, string typeName, bool success, Exception? e = null); + + public CMDLoaded? onCMDLoad; + public EVELoaded? onEVELoad; + + public void LoadPlugins() + { + + Plugins = new List(); + Events = new List(); + + Functions.WriteLogFile("Starting plugin loader..."); + if (LanguageSystem.Language.ActiveLanguage != null) + Functions.WriteColorText(LanguageSystem.Language.ActiveLanguage.FormatText(LanguageSystem.Language.ActiveLanguage.LanguageWords["PLUGIN_LOADING_START"])); + + //Load commands + CommandsLoader CMDLoader = new CommandsLoader(pluginCMDFolder, pluginCMDExtension); + CMDLoader.OnCommandLoaded += OnCommandLoaded!; + CMDLoader.OnCommandFileLoaded += OnCommandFileLoaded; + Plugins = CMDLoader.LoadCommands(); + + + //Load Events + EventsLoader EVLoader = new EventsLoader(pluginEVEFolder, pluginEVEExtension); + EVLoader.EventLoad += OnEventLoaded!; + EVLoader.EventFileLoaded += EventFileLoaded; + Events = EVLoader.LoadEvents(); + + } + + private void EventFileLoaded(string path) + { + if (path != null) + Functions.WriteLogFile($"[EVENT] Event from file [{path}] has been successfully created !"); + } + + private void OnCommandFileLoaded(string path) + { + if (path != null) + Functions.WriteLogFile($"[CMD] Command from file [{path}] has been successfully loaded !"); + } + + private void OnEventLoaded(string typename, bool success, DBEvent eve, Exception exception) + { + if (eve != null && success) + eve.Start(client); + if (onEVELoad != null) + onEVELoad.Invoke(eve!.name, typename, success, exception); + } + + private void OnCommandLoaded(string name, bool success, DBCommand command, Exception exception) + { + if (onCMDLoad != null) + onCMDLoad.Invoke(command.Command, name, success, exception); + } + } +} diff --git a/PluginManager/Online/Downloader.cs b/PluginManager/Online/Downloader.cs new file mode 100644 index 0000000..5c439a6 --- /dev/null +++ b/PluginManager/Online/Downloader.cs @@ -0,0 +1,82 @@ +using System; +using System.IO; +using System.Net; +using System.Threading.Tasks; + +using PluginManager.Items; + +namespace PluginManager.Online +{ + public class Downloader + { + public bool isWorking { get; private set; } + + public int percent { get; private set; } + private string fileName; + private string downloadLink; + + public Downloader(string fileName, string fileLink) + { + this.downloadLink = fileLink; + this.fileName = fileName; + } + + + public async Task DownloadFileAsync(string location = @"./Downloads/", string? pluginType = null) + { + Directory.CreateDirectory(location); + if (isWorking) return; + isWorking = true; + percent = 0; + + Spinner s = new Spinner(); + Console.Write("Downloading:\t\t"); + s.Start(); + +#pragma warning disable SYSLIB0014 + WebClient client = new WebClient(); +#pragma warning restore SYSLIB0014 + + client.DownloadFileCompleted += (sender, args) => + { + isWorking = false; + s.Stop(); + var c = Console.ForegroundColor; + Console.ForegroundColor = ConsoleColor.DarkGreen; + Console.Write("OK"); + Console.ForegroundColor = c; + Console.Write(" !\n"); + //Console.WriteLine("Your plugin has been successfully downloaded !"); + if (pluginType == "Event/Command" || pluginType == "Command/Event") + { + File.Copy(location + fileName, location + "Commands/" + fileName, true); + File.Move(location + fileName, location + "Events/" + fileName, true); + } + + }; + + string l = ""; + if (pluginType == "Command") + l = location + "Commands/" + fileName; + else if (pluginType == "Event") + l = location + "Events/" + fileName; + else l = location + fileName; + try + { + await client.DownloadFileTaskAsync(new Uri(this.downloadLink), l); + } + catch + { + var c = Console.ForegroundColor; + Console.ForegroundColor = ConsoleColor.Red; + Console.Write("FAIL"); + Console.ForegroundColor = c; + Console.Write(" !\n"); + } + + + + } + + } +} diff --git a/PluginManager/Online/LanguageManager.cs b/PluginManager/Online/LanguageManager.cs new file mode 100644 index 0000000..5c97711 --- /dev/null +++ b/PluginManager/Online/LanguageManager.cs @@ -0,0 +1,75 @@ +using System; +using System.IO; +using System.Threading.Tasks; +using System.Net; +using System.Collections.Generic; + +using PluginManager.Others; + +namespace PluginManager.Online +{ + public class LanguageManager + { + private string link; + public LanguageManager(string link) => this.link = link; + + public async Task ListAllLanguages() + { + try + { +#pragma warning disable SYSLIB0014 + WebClient client = new WebClient(); +#pragma warning restore SYSLIB0014 + Stream data = await client.OpenReadTaskAsync(link); + string[] lines = (await new StreamReader(data).ReadToEndAsync()).Split('\n'); + List info = new List(); + info.Add(new string[] { "-", "-" }); + info.Add(new string[] { "Language Name", "File Size" }); + info.Add(new string[] { "-", "-" }); + foreach (var line in lines) + { + if (line.Length <= 2) continue; + string[] d = line.Split(','); + if (d[3].Contains("cp") || d[3].Contains("CrossPlatform")) + info.Add(new string[] { d[0], d[1] }); + } + info.Add(new string[] { "-", "-" }); + Functions.FormatAndAlignTable(info); + } + + catch (Exception exception) + { + Console.WriteLine("Failed to execute command: listlang\nReason: " + exception.Message); + Others.Functions.WriteErrFile(exception.ToString()); + } + + } + + public async Task GetDownloadLink(string langName) + { + try + { +#pragma warning disable SYSLIB0014 + WebClient client = new WebClient(); +#pragma warning restore SYSLIB0014 + Stream data = await client.OpenReadTaskAsync(link); + string[] lines = (await new StreamReader(data).ReadToEndAsync()).Split('\n'); + foreach (var line in lines) + { + if (line.Length <= 2) continue; + string[] d = line.Split(','); + if (d[0].Equals(langName) && (d[3].Contains("cp") || d[3].Contains("CrossPlatform"))) + return new string[] { d[2], d[3] }; + } + } + catch (Exception exception) + { + Console.WriteLine("Failed to execute command: listlang\nReason: " + exception.Message); + Others.Functions.WriteErrFile(exception.ToString()); + } + + + return null; + } + } +} \ No newline at end of file diff --git a/PluginManager/Online/PluginsManager.cs b/PluginManager/Online/PluginsManager.cs new file mode 100644 index 0000000..35af46e --- /dev/null +++ b/PluginManager/Online/PluginsManager.cs @@ -0,0 +1,108 @@ +using System; +using System.IO; +using System.Net; +using System.Threading.Tasks; +using System.Collections.Generic; + +using PluginManager.Others; + +namespace PluginManager.Online +{ + public class PluginsManager + { + public string PluginsLink { get; private set; } + + public PluginsManager(string link) + { + PluginsLink = link; + } + + public async Task ListAvailablePlugins() + { + try + { +#pragma warning disable SYSLIB0014 + WebClient client = new WebClient(); +#pragma warning restore SYSLIB0014 + Stream s = await client.OpenReadTaskAsync(PluginsLink); + string text = await new StreamReader(s).ReadToEndAsync(); + + + List data = new List(); + var op = Functions.GetOperatinSystem(); + string[] lines = text.Split('\n'); + int len = lines.Length; + string[] titles = { "Name", "Description", "Plugin Type" }; + data.Add(new string[] { "-", "-", "-" }); + data.Add(titles); + data.Add(new string[] { "-", "-", "-" }); + for (int i = 0; i < len; i++) + { + if (lines[i].Length <= 2) continue; + string[] content = lines[i].Split(','); + string[] display = new string[3]; + if (op == PluginManager.Others.OperatingSystem.WINDOWS) + { + if (content[4].Contains("Windows")) + { + display[0] = content[0]; + display[1] = content[1]; + display[2] = content[2]; + data.Add(display); + continue; + } + } + else if (op == PluginManager.Others.OperatingSystem.LINUX) + { + if (content[4].Contains("Linux")) + { + display[0] = content[0]; + display[1] = content[1]; + display[2] = content[2]; + data.Add(display); + continue; + } + } + } + + data.Add(new string[] { "-", "-", "-" }); + + Functions.FormatAndAlignTable(data); + } + catch (Exception exception) + { + Console.WriteLine("Failed to execute command: listlang\nReason: " + exception.Message); + Others.Functions.WriteErrFile(exception.ToString()); + } + + } + + public async Task GetPluginLinkByName(string name) + { + try + { +#pragma warning disable SYSLIB0014 + WebClient client = new WebClient(); +#pragma warning restore SYSLIB0014 + Stream s = await client.OpenReadTaskAsync(PluginsLink); + string text = await new StreamReader(s).ReadToEndAsync(); + + string[] lines = text.Split('\n'); + int len = lines.Length; + for (int i = 0; i < len; i++) + { + string[] contents = lines[i].Split(','); + if (contents[0] == name) + return new string[] { contents[2], contents[3] }; + } + } + catch (Exception exception) + { + Console.WriteLine("Failed to execute command: listlang\nReason: " + exception.Message); + Others.Functions.WriteErrFile(exception.ToString()); + } + + return new string[] { null!, null! }; + } + } +} diff --git a/PluginManager/Others/Channels.cs b/PluginManager/Others/Channels.cs new file mode 100644 index 0000000..84682a7 --- /dev/null +++ b/PluginManager/Others/Channels.cs @@ -0,0 +1,15 @@ +using Discord; + +using System.Threading.Tasks; + +namespace PluginManager.Others +{ + public static class ChannelManagement + { + public static IGuildChannel GetTextChannel(this IGuild server, string name) => server.GetTextChannel(name); + public static IGuildChannel GetVoiceChannel(this IGuild server, string name) => server.GetVoiceChannel(name); + public static async Task GetDMChannel(IGuildUser user) => await user.CreateDMChannelAsync(); + public static IChannel GetChannel(IMessage message) => message.Channel; + + } +} \ No newline at end of file diff --git a/PluginManager/Others/Cryptography.cs b/PluginManager/Others/Cryptography.cs new file mode 100644 index 0000000..d9e53e4 --- /dev/null +++ b/PluginManager/Others/Cryptography.cs @@ -0,0 +1,44 @@ +namespace PluginManager.Others +{ + public class Cryptography + { + public static async System.Threading.Tasks.Task CreateMD5(string text) + { + string output = ""; + using (System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create()) + { + using (var s = GenerateStreamFromString(text)) + { + byte[] t = await md5.ComputeHashAsync(s); + output = System.Convert.ToBase64String(t); + } + } + + return output; + } + + public static async System.Threading.Tasks.Task CreateSHA256(string text) + { + string output = ""; + using (System.Security.Cryptography.SHA256 sha = System.Security.Cryptography.SHA256.Create()) + { + using (var s = GenerateStreamFromString(text)) + { + byte[] t = await sha.ComputeHashAsync(s); + output = System.Convert.ToBase64String(t); + } + } + return output; + } + + public static System.IO.Stream GenerateStreamFromString(string s) + { + var stream = new System.IO.MemoryStream(); + var writer = new System.IO.StreamWriter(stream); + writer.Write(s); + writer.Flush(); + stream.Position = 0; + return stream; + } + } +} \ No newline at end of file diff --git a/PluginManager/Others/Enums.cs b/PluginManager/Others/Enums.cs new file mode 100644 index 0000000..90d89a4 --- /dev/null +++ b/PluginManager/Others/Enums.cs @@ -0,0 +1,14 @@ +namespace PluginManager.Others +{ + + /// + /// A list of operating systems + /// + public enum OperatingSystem + { WINDOWS, LINUX, MAC_OS, UNKNOWN } + + public enum Error + { UNKNOWN_ERROR, GUILD_NOT_FOUND, } + + public enum OutputLogLevel { NONE, INFO, WARNING, ERROR, CRITICAL } +} \ No newline at end of file diff --git a/PluginManager/Others/Exceptions/APIException.cs b/PluginManager/Others/Exceptions/APIException.cs new file mode 100644 index 0000000..34d6b48 --- /dev/null +++ b/PluginManager/Others/Exceptions/APIException.cs @@ -0,0 +1,37 @@ +using System; + +namespace PluginManager.Others.Exceptions +{ + [System.Serializable] + public class APIException : Exception + { + public string? Function { get; } + public Error? ErrorCode { get; } + + public APIException(string message, string? function, Error? errorCode) : base(message) + { + ErrorCode = errorCode; + Function = function; + } + + public APIException(string message, string? function) : base(message) + { + ErrorCode = Error.UNKNOWN_ERROR; + Function = function; + } + + public APIException(string message) : base(message) + { + ErrorCode = Error.UNKNOWN_ERROR; + Function = "Unspecified_Function"; + } + + public void Print() + { + Console.WriteLine("Message Content: " + Message); + Console.WriteLine("Function: " + Function); + Console.WriteLine("Error Code: " + ErrorCode.ToString()); + } + } + +} \ No newline at end of file diff --git a/PluginManager/Others/Functions.cs b/PluginManager/Others/Functions.cs new file mode 100644 index 0000000..d8ba88b --- /dev/null +++ b/PluginManager/Others/Functions.cs @@ -0,0 +1,300 @@ +using System.IO.Compression; +using System.IO; +using System; +using System.Threading.Tasks; +using System.Linq; +using System.Collections.Generic; + + +namespace PluginManager.Others +{ + public static class Functions + { + /// + /// The location for the Resources folder + /// + public static readonly string dataFolder = @"./Data/Resources/"; + + /// + /// The location for all logs + /// + public static readonly string logFolder = @"./Output/Logs/"; + + /// + /// The location for all errors + /// + public static readonly string errFolder = @"./Output/Errors/"; + + /// + /// The location for all languages + /// + public static readonly string langFolder = @"./Data/Languages/"; + + /// + /// Archives folder + /// + public static readonly string pakFolder = @"./Data/Resources/PAKS/"; + + /// + /// The mark that the line is a comment + /// + private static readonly char commentMark = '#'; + + /// + /// Read data from file + /// + /// File name + /// Setting name + /// Separator between setting key code and its value + /// The value of the specified setting key code in the specified file (STRING) + public static string? readCodeFromFile(string fileName, string Code, char separator) + => File.ReadAllLines(fileName) + .Where(p => p.StartsWith(Code) && !p.StartsWith(commentMark.ToString())) + .First().Split(separator)[1] ?? null; + + /// + /// Read data from a file that is inside an archive (ZIP format) + /// + /// The file name that is inside the archive or its full path + /// The archive location from the PAKs folder + /// A string that represents the content of the file or null if the file does not exists or it has no content + public static async Task ReadFromPakAsync(string FileName, string archFile) + { + archFile = pakFolder + archFile; + Directory.CreateDirectory(pakFolder); + if (!File.Exists(archFile)) + { + throw new Exception("Failed to load file !"); + } + + string? textValue = null; + var fs = new FileStream(archFile, FileMode.Open); + var zip = new ZipArchive(fs, ZipArchiveMode.Read); + foreach (var entry in zip.Entries) + { + if (entry.Name == FileName || entry.FullName == FileName) + { + Stream s = entry.Open(); + StreamReader reader = new StreamReader(s); + textValue = await reader.ReadToEndAsync(); + reader.Close(); + s.Close(); + fs.Close(); + break; + } + } + return textValue; + } + + /// + /// Write logs to file + /// + /// The message to be wrote + public static void WriteLogFile(string LogMessage) + { + string logsPath = logFolder + "Log.txt"; + if (!Directory.Exists(logFolder)) + Directory.CreateDirectory(logFolder); + File.AppendAllText(logsPath, LogMessage + " \n"); + } + + /// + /// Write error to file + /// + /// The message to be wrote + public static void WriteErrFile(string ErrMessage) + { + string errPath = errFolder + "Error.txt"; + if (!Directory.Exists(errFolder)) + Directory.CreateDirectory(errFolder); + File.AppendAllText(errPath, ErrMessage + " \n"); + } + + /// + /// Write to settings file + /// + /// The settings file path + /// The Key value of the setting + /// The new value of the settings + /// The separator between the key and the value + public static void WriteToSettings(string file, string Code, string newValue, char separator) + { + + string[] lines = File.ReadAllLines(file); + File.Delete(file); + bool ok = false; + foreach (var line in lines) + if (line.StartsWith(Code)) + { + File.AppendAllText(file, Code + separator + newValue + "\n"); ok = true; + } + else File.AppendAllText(file, line + "\n"); + + if (!ok) + File.AppendAllText(file, Code + separator + newValue + "\n"); + } + + /// + /// Merge one array of strings into one string + /// + /// The array of strings + /// The index from where the merge should start (included) + /// A string built based on the array + public static string MergeStrings(this string[] s, int indexToStart) + { + string r = ""; + int len = s.Length; + if (len <= indexToStart) return ""; + for (int i = indexToStart; i < len - 1; ++i) + { + r += s[i] + " "; + } + + r += s[len - 1]; + + return r; + } + + /// + /// Get the Operating system you are runnin on + /// + /// An Operating system + public static OperatingSystem GetOperatinSystem() + { + if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows)) return OperatingSystem.WINDOWS; + if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Linux)) return OperatingSystem.LINUX; + if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.OSX)) return OperatingSystem.MAC_OS; + return OperatingSystem.UNKNOWN; + } + + /// + /// A way to create a table based on input data + /// EpicWings (Pasca Robert) este cel mai bun + /// Special thanks to Kami-sama <3 + /// + /// The List of arrays of strings that represent the rows. + public static void FormatAndAlignTable(List data) + { + int maxLen = 0; + foreach (string[] row in data) + foreach (string s in row) + if (s.Length > maxLen) + maxLen = s.Length; + + int div = (maxLen + 4) / 2; + + foreach (string[] row in data) + { + Console.Write("\t"); + if (row[0] == "-") Console.Write("+"); + else Console.Write("|"); + + foreach (string s in row) + { + if (s == "-") + { + for (int i = 0; i < maxLen + 4; ++i) + Console.Write("-"); + } + else if (s.Length == maxLen) + { + Console.Write(" "); + Console.Write(s); + Console.Write(" "); + } + else + { + int lenHalf = s.Length / 2; + for (int i = 0; i < div - lenHalf; ++i) + Console.Write(" "); + Console.Write(s); + for (int i = div + lenHalf + 1; i < maxLen + 4; ++i) + Console.Write(" "); + if (s.Length % 2 == 0) + Console.Write(" "); + } + + if (s == "-") Console.Write("+"); + else Console.Write("|"); + } + Console.WriteLine(); //end line + } + } + + /// + /// Write the text using color options( &g-green; &b-blue; &r-red; &c-clear; ) + /// + /// The text + public static void WriteColorText(string text) + { + string[] words = text.Split(' '); + Dictionary colors = new Dictionary() + { + {"&g", ConsoleColor.Green }, + {"&b", ConsoleColor.Blue }, + {"&r", ConsoleColor.Red }, + {"&c", Console.ForegroundColor } + }; + foreach (string word in words) + { + if (word.Length >= 2) + { + string prefix = word.Substring(0, 2); + if (colors.ContainsKey(prefix)) + Console.ForegroundColor = colors[prefix]; + } + + string m = word.Replace("&g", "").Replace("&b", "").Replace("&r", "").Replace("&c", ""); + Console.Write(m + " "); + } + Console.Write('\n'); + } + + /// + /// Write setting + /// + /// The full path to the setting + /// The new Value + public static void WriteToSettingsFast(string SettingName, string NewValue) + { + + string path = dataFolder; // Resources/ + + string[] args = SettingName.Split('.'); + + int len = args.Length; + if (len < 2) return; + for (int i = 0; i < len - 2; i++) + path += args[i] + "/"; + path += args[len - 2] + ".txt"; + + + WriteToSettings(path, args[len - 1].Replace('_', ' '), NewValue, '='); + + } + + public static string FromHexToString(string hexString) + { + var bytes = new byte[hexString.Length / 2]; + for (var i = 0; i < bytes.Length; i++) + { + bytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16); + } + + return System.Text.Encoding.Unicode.GetString(bytes); + } + + public static string ToHexString(string str) + { + var sb = new System.Text.StringBuilder(); + + var bytes = System.Text.Encoding.Unicode.GetBytes(str); + foreach (var t in bytes) + { + sb.Append(t.ToString("X2")); + } + + return sb.ToString(); + } + } +} diff --git a/PluginManager/Others/Permissions.cs b/PluginManager/Others/Permissions.cs new file mode 100644 index 0000000..9d1ea87 --- /dev/null +++ b/PluginManager/Others/Permissions.cs @@ -0,0 +1,20 @@ +using Discord; +using Discord.WebSocket; + +using System.Linq; + +namespace PluginManager.Others +{ + public static class Permissions + { + public static bool hasPermission(this IRole role, GuildPermission permission) => role.Permissions.Has(permission); + + public static bool hasRole(this SocketGuildUser user, IRole role) => user.Roles.Contains(role); + + public static bool hasPermission(this SocketGuildUser user, GuildPermission permission) + => user.Roles.Where(role => role.hasPermission(permission)).Any(); + + } + + +} \ No newline at end of file diff --git a/PluginManager/PluginManager.csproj b/PluginManager/PluginManager.csproj new file mode 100644 index 0000000..c084911 --- /dev/null +++ b/PluginManager/PluginManager.csproj @@ -0,0 +1,12 @@ + + + + net5.0 + enable + + + + + + + diff --git a/StartupEvents/OnUserJoin.cs b/StartupEvents/OnUserJoin.cs new file mode 100644 index 0000000..ce5bbf7 --- /dev/null +++ b/StartupEvents/OnUserJoin.cs @@ -0,0 +1,56 @@ +using PluginManager.Others; +using PluginManager.Interfaces; + +public class OnUserJoin : DBEvent +{ + public string name => "OnPlayerJoin"; + + public string description => "An event that is triggered when an user joins the server"; + + public async void Start(Discord.WebSocket.DiscordSocketClient client) + { + + string UtilsPath = Functions.dataFolder + "StartupEvents/"; + string ConfigFile = UtilsPath + "UserJoinEvent.txt"; + + System.IO.Directory.CreateDirectory(UtilsPath); + + if (!System.IO.File.Exists(ConfigFile)) + { + await System.IO.File.WriteAllTextAsync(ConfigFile, + "Enabled=True\nEmbed=True\n" + + "#Available placeholders:\n" + + "#{user.Name} => Username of the user\n" + + "#{time.date} => Current Date\n" + + "#{time.time} => Current time (hh:mm::ss)\n" + + "MessageTitle = Welcome {user.Name}\n" + + "MessageDescription=Embed description\n" + + "MessageField1Title=Custom Title\n" + + "MessageFiled1Text=Custom Filed 1 text\n" + + "MessageField2Title=Custom Title\n" + + "MessageFiled2Text=Custom Filed 2 text\n" + + "MessageFooter=Today: {time.date} at {time.time}"); + } + + if (Functions.readCodeFromFile(ConfigFile, "Enabled", '=') != "True") return; + + client.UserJoined += async (user) => + { + Discord.EmbedBuilder embed = new Discord.EmbedBuilder + { + Title = Functions.readCodeFromFile(ConfigFile, "MessageTitle", '='), + Description = Functions.readCodeFromFile(ConfigFile, "MessageDescription", '=') + }; + + embed + .AddField(Functions.readCodeFromFile(ConfigFile, "MessageField1Title", '=').Replace("{user.Name}", user.Username).Replace("{time.date}", System.DateTime.Now.ToShortDateString()).Replace("{time.time}", System.DateTime.Now.ToShortTimeString()), Functions.readCodeFromFile(ConfigFile, "MessageField1Text", '=').Replace("{user.Name}", user.Username).Replace("{time.date}", System.DateTime.Now.ToShortDateString()).Replace("{time.time}", System.DateTime.Now.ToShortTimeString())) + .AddField(Functions.readCodeFromFile(ConfigFile, "MessageField2Title", '=').Replace("{user.Name}", user.Username).Replace("{time.date}", System.DateTime.Now.ToShortDateString()).Replace("{time.time}", System.DateTime.Now.ToShortTimeString()), Functions.readCodeFromFile(ConfigFile, "MessageField2Text", '=').Replace("{user.Name}", user.Username).Replace("{time.date}", System.DateTime.Now.ToShortDateString()).Replace("{time.time}", System.DateTime.Now.ToShortTimeString())) + .WithFooter(Functions.readCodeFromFile(ConfigFile, "MessageFooter", '=').Replace("{user.Name}", user.Username).Replace("{time.date}", System.DateTime.Now.ToShortDateString()).Replace("{time.time}", System.DateTime.Now.ToShortTimeString())); + + await user.Guild.DefaultChannel.SendMessageAsync(embed: embed.Build()); + // await (await user.GetOrCreateDMChannelAsync()).SendMessageAsync(embed: embed.Build()); + }; + + + } +} \ No newline at end of file diff --git a/StartupEvents/SetGameOnLogin.cs b/StartupEvents/SetGameOnLogin.cs new file mode 100644 index 0000000..4a2d2d9 --- /dev/null +++ b/StartupEvents/SetGameOnLogin.cs @@ -0,0 +1,48 @@ +public class SetGameOnLogin : PluginManager.Interfaces.DBEvent +{ + public string name => "Set Game on Startup"; + public string description => "Set Custom Game to the bot at initialization"; + public async void Start(Discord.WebSocket.DiscordSocketClient client) + { + string UtilsPath = PluginManager.Others.Functions.dataFolder + "StartupEvents/"; + string ConfigFile = UtilsPath + "LoginEvent.txt"; + + System.IO.Directory.CreateDirectory(UtilsPath); + if (!System.IO.File.Exists(ConfigFile)) + { + System.Console.WriteLine($"First time setup. Open file: {ConfigFile} to change settings or use the following commands\nNote: For space ( ) use underline (_). Example: 'Hello_World' will output 'Hello World'"); + System.Console.WriteLine($"set-setting StartupEvents.LoginEvent.Title [Custom_Title(s)]"); + System.Console.WriteLine($"set-setting StartupEvents.LoginEvent.Dynamic_Title [True/False]"); + System.Console.WriteLine($"set-setting StartupEvents.LoginEvent.Dynamic_Title_Change_Rate [interval in milliseconds]"); + await System.IO.File.WriteAllTextAsync(ConfigFile, "Enabled=True\n\nDynamic Title=False\n#For dynamic title add titles like this:\n#Title=Hello,World,Test,Test2\nTitle=!help\nDynamic Title Change Rate=3500\n"); + } + + if (PluginManager.Others.Functions.readCodeFromFile(ConfigFile, "Enabled", '=') != "True") + return; + + bool isDynamic = PluginManager.Others.Functions.readCodeFromFile(ConfigFile, "Dynamic Title", '=') == "True"; + string Title = PluginManager.Others.Functions.readCodeFromFile(ConfigFile, "Title", '='); + if (Title == null || Title.Length < 2) return; + if (!isDynamic) + await client.SetGameAsync(Title, null, Discord.ActivityType.Playing); + else + { + string[] Titles = Title.Split(','); + int delayMS = 3500; + try + { + delayMS = int.Parse(PluginManager.Others.Functions.readCodeFromFile(ConfigFile, "Dynamic Title Change Rate", '=')); + } + catch { } + while (true) + { + foreach (var title in Titles) + { + await client.SetGameAsync(title, null, Discord.ActivityType.Playing); + await System.Threading.Tasks.Task.Delay(delayMS); + } + } + } + + } +} \ No newline at end of file diff --git a/StartupEvents/StartupEvents.csproj b/StartupEvents/StartupEvents.csproj new file mode 100644 index 0000000..7cb7c93 --- /dev/null +++ b/StartupEvents/StartupEvents.csproj @@ -0,0 +1,17 @@ + + + + net5.0 + + + + E:\DiscordBot\BUILDS\ + none + false + + + + + + +