Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 4

[*.cs]
# Unused private members
dotnet_diagnostic.IDE0051.severity = warning
dotnet_diagnostic.IDE0052.severity = warning
tab_width = 4

# Discord.Net discovers command handlers via reflection — they appear unused to static analysis
[DiscordBot/Modules/**.cs]
dotnet_diagnostic.IDE0051.severity = none

[*.json]
indent_size = 2
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"ms-dotnettools.csharp"
]
}
54 changes: 28 additions & 26 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/DiscordBot/bin/Debug/netcoreapp2.1/DiscordBot.dll",
"args": [],
"cwd": "${workspaceFolder}/DiscordBot",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
// Requires the C# extension (ms-dotnettools.csharp), recommended in extensions.json.
// See tasks.json for why the bot is built for net8.0 and run with DOTNET_ROLL_FORWARD.
"version": "0.2.0",
"configurations": [
{
"name": "Launch bot",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build and check settings",
"program": "${workspaceFolder}/DiscordBot/bin/Debug/net8.0/DiscordBot.dll",
"args": [],
// The bot reads Settings/, Assets/ and SERVER/ relative to this folder.
"cwd": "${workspaceFolder}/DiscordBot",
"env": {
"DOTNET_ROLL_FORWARD": "Major"
},
// The integrated terminal shows the bot's coloured log output.
"console": "integratedTerminal",
"stopAtEntry": false
},
{
"name": "Attach to bot",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
165 changes: 125 additions & 40 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,127 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/DiscordBot/DiscordBot.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/DiscordBot/DiscordBot.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/DiscordBot/DiscordBot.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
// Tasks build and run net8.0 only (the target used by Docker and CI), so any .NET 8+ SDK works.
// DOTNET_ROLL_FORWARD=Major lets the net8.0 build run on a newer runtime when .NET 8 isn't installed.
// The bot reads Settings/, Assets/ and SERVER/ relative to DiscordBot/, so run tasks use that as cwd.
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/DiscordBot/DiscordBot.csproj",
"--framework",
"net8.0",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$msCompile"
},
{
"label": "check settings",
"detail": "Fails with a hint if DiscordBot/Settings/Settings.json is missing",
"type": "shell",
"command": "test -f Settings/Settings.json || { echo 'DiscordBot/Settings/Settings.json is missing. Copy DiscordBot/Settings/Settings.example.json to Settings.json and fill in Token and DbConnectionString.'; exit 1; }",
"windows": {
"command": "if (-not (Test-Path Settings/Settings.json)) { Write-Host 'DiscordBot/Settings/Settings.json is missing. Copy DiscordBot/Settings/Settings.example.json to Settings.json and fill in Token and DbConnectionString.'; exit 1 }",
"options": {
"cwd": "${workspaceFolder}/DiscordBot",
"shell": {
"executable": "powershell.exe",
"args": ["-NoProfile", "-Command"]
}
}
]
}
},
"options": {
"cwd": "${workspaceFolder}/DiscordBot"
},
"presentation": {
"reveal": "silent",
"revealProblems": "never"
},
"problemMatcher": []
},
{
"label": "build and check settings",
"detail": "Used by the launch configuration",
"dependsOn": ["check settings", "build"],
"dependsOrder": "sequence",
"problemMatcher": []
},
{
"label": "test",
"command": "dotnet",
"type": "process",
"args": [
"test",
"${workspaceFolder}/DiscordBot.Tests/DiscordBot.Tests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"options": {
"env": {
"DOTNET_ROLL_FORWARD": "Major"
}
},
"group": {
"kind": "test",
"isDefault": true
},
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"detail": "Run the bot and restart it on code changes",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/DiscordBot/DiscordBot.csproj",
"--framework",
"net8.0"
],
"options": {
"cwd": "${workspaceFolder}/DiscordBot",
"env": {
"DOTNET_ROLL_FORWARD": "Major"
}
},
"isBackground": true,
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/DiscordBot/DiscordBot.csproj",
"--configuration",
"Release",
"--framework",
"net8.0",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "start database",
"detail": "Start the local PostgreSQL container from docker-compose.yml",
"command": "docker",
"type": "process",
"args": ["compose", "up", "-d", "db"],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": []
}
]
}
Loading
Loading