Skip to content

Commit

Permalink
Merge pull request #1 from Akko-Bot/net6
Browse files Browse the repository at this point in the history
Migrate the project to .NET 6
  • Loading branch information
Kaoticz authored Nov 15, 2021
2 parents fe4c46a + 7fff16d commit c91952e
Show file tree
Hide file tree
Showing 299 changed files with 23,791 additions and 23,739 deletions.
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -313,4 +313,5 @@ dotnet_diagnostic.IDE0004.severity = error
dotnet_diagnostic.IDE0058.severity = none

# IDE0011: Add braces to 'if'/'else' statement
dotnet_diagnostic.IDE0011.severity = none
dotnet_diagnostic.IDE0011.severity = none
csharp_style_namespace_declarations=file_scoped:error
21 changes: 11 additions & 10 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ on:
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '37 8 * * 6'

jobs:
analyze:
Expand Down Expand Up @@ -50,11 +48,20 @@ jobs:
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

- name: Set up .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.x'

- name: Add DSharpPlus Nightly Repository
run: |
dotnet nuget add source https://nuget.emzi0767.com/api/v3/index.json -n DSharpPlusNightly
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
##- name: Autobuild
## uses: github/codeql-action/autobuild@v1
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -63,11 +70,5 @@ jobs:
# and modify them (or add more) to build your code if your project
# uses a compiled language

- name: Build
run: |
dotnet nuget add source https://nuget.emzi0767.com/api/v3/index.json -n DSharpPlusNightly
dotnet restore
dotnet build --no-restore
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
6 changes: 3 additions & 3 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 6.0.x
- name: Add DSharpPlus Nightly source
run: dotnet nuget add source https://nuget.emzi0767.com/api/v3/index.json -n DSharpPlusNightly
- name: Restore dependencies
Expand All @@ -43,7 +43,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 6.0.x
- name: Add DSharpPlus Nightly source
run: dotnet nuget add source https://nuget.emzi0767.com/api/v3/index.json -n DSharpPlusNightly
- name: Restore dependencies
Expand All @@ -66,7 +66,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
dotnet-version: 6.0.x
- name: Add DSharpPlus Nightly source
run: dotnet nuget add source https://nuget.emzi0767.com/api/v3/index.json -n DSharpPlusNightly
- name: Restore dependencies
Expand Down
7 changes: 4 additions & 3 deletions AkkoBot.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30804.86
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AkkoBot", "AkkoBot\AkkoBot.csproj", "{6F18035D-76D3-43C1-9154-C1BFBEE88ADC}"
EndProject
Expand All @@ -10,6 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
.gitattributes = .gitattributes
.gitignore = .gitignore
CONTRIBUTING.md = CONTRIBUTING.md
LICENSE = LICENSE
README.md = README.md
EndProjectSection
Expand All @@ -18,7 +19,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AkkoTests", "AkkoTests\Akko
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AkkoCore", "AkkoCore\AkkoCore.csproj", "{4A7EA748-1C32-49CE-A57A-E5029A2ADC6C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AkkoCog.DangerousCommands", "AkkoCog.DangerousCommands\AkkoCog.DangerousCommands.csproj", "{6097907C-6DD1-467A-8090-F89E80C2A71D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AkkoCog.DangerousCommands", "AkkoCog.DangerousCommands\AkkoCog.DangerousCommands.csproj", "{6097907C-6DD1-467A-8090-F89E80C2A71D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
5 changes: 3 additions & 2 deletions AkkoBot/AkkoBot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<StartupObject>AkkoBot.Program</StartupObject>
<AssemblyName>AkkoBot</AssemblyName>
<RootNamespace>AkkoBot</RootNamespace>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<DebugType>embedded</DebugType>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.11">
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
8 changes: 4 additions & 4 deletions AkkoBot/Data/Localization/Responses_en-US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ arg_mention: A valid Discord ID or mention.
arg_module: A valid module.
arg_nickname: The new nickname.
arg_notice: The notice to be added to this user's modlog.
arg_permission: A Discord [permission](https://github.com/Kaoticz/AkkoBot/wiki/Permissions), wrapped around quotation marks.
arg_permissions: Discord [permissions](https://github.com/Kaoticz/AkkoBot/wiki/Permissions), wrapped around quotation marks and separated by space.
arg_permission: A Discord [permission](https://github.com/Akko-Bot/AkkoBot/wiki/Permissions), wrapped around quotation marks.
arg_permissions: Discord [permissions](https://github.com/Akko-Bot/AkkoBot/wiki/Permissions), wrapped around quotation marks and separated by space.
arg_poll_id: ID of the poll.
arg_poll_qanswer: The question and the answers, separated by a semicolon `;`.
arg_poll_question: A question.
Expand Down Expand Up @@ -325,7 +325,7 @@ cmd_moveuser: Moves a user to another voice channel. Provide no channel to force
cmd_mute: Mutes a user from text and voice channels.
cmd_notice: Adds a notice about a user.
cmd_nsfwtoggle: Toggles the NSFW property of the current text channel.
cmd_override: Groups commands for managing permission overrides. Use them to modify the permissions required for a command to be run. Using it in direct message with the bot requires bot ownership and makes the override global. Server overrides always take precedence over global overrides. Bot ownership cannot be overriden.
cmd_override: Groups commands for managing permission overrides. Use them to modify the permissions required to run a command. Using it in direct message with the bot requires bot ownership and makes the override global. Server overrides always take precedence over global overrides. Bot ownership cannot be overriden.
cmd_override_channel: Toggles command usage for the specified channel.
cmd_override_clear: Removes all permission overrides from the specified command.
cmd_override_clearall: Removes all permission overrides from this server. Using it in direct message removes all global overrides.
Expand Down Expand Up @@ -376,7 +376,7 @@ cmd_rotatestatus: Toggles the rotation of the statuses in the rotation list.
cmd_sanitizedname: Sets the nickname to be assigned to users who have special characters at the beginning of their name. Providing no parameter to sanitize the original nickname.
cmd_sanitizenames: Toggles whether nicknames should have special characters removed from the beginning.
cmd_savechat: Saves the last messages sent in a text channel to a file. Bot messages are ignored. Users with no bot ownership are limited to 100 messages. Provide no parameters to save the last 100 messages from the current channel.
cmd_say: Sends a message to the specified channel. If the channel is omitted, the message is sent to the current channel.
cmd_say: Sends a message to the specified channel. If the channel is omitted, the message is sent to the current channel. It accepts `.txt` attachments for messages that are too long to type on Discord.
cmd_sban: Kicks a user from the server and deletes their messages.
cmd_search: Searches for a command with the specified keyword.
cmd_send: Sends a message to the specified Discord channel.
Expand Down
6 changes: 3 additions & 3 deletions AkkoBot/Data/Localization/Respostas_pt-BR.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ arg_mention: Um ID ou menção válido do Discord.
arg_module: Um módulo válido.
arg_nickname: O novo apelido.
arg_notice: A anotação a ser adicionada ao modlog desse usuário.
arg_permission: Uma [permissão](https://github.com/Kaoticz/AkkoBot/wiki/Permissions) do Discord, dentro de aspas.
arg_permissions: '[Permissões](https://github.com/Kaoticz/AkkoBot/wiki/Permissions) do Discord, dentro de aspas e separados por espaço.'
arg_permission: Uma [permissão](https://github.com/Akko-Bot/AkkoBot/wiki/Permissions) do Discord, dentro de aspas.
arg_permissions: '[Permissões](https://github.com/Akko-Bot/AkkoBot/wiki/Permissions) do Discord, dentro de aspas e separados por espaço.'
arg_poll_id: ID da enquete.
arg_poll_qanswer: A pergunta e as respostas, separadas por ponto-vírgula `;`.
arg_poll_question: Uma pergunta.
Expand Down Expand Up @@ -376,7 +376,7 @@ cmd_rotatestatus: Ativa/Desativa a rotação dos status na lista de rotação.
cmd_sanitizedname: Define o apelido a ser designado a usuários que tiverem caracteres especiais no início de seu apelido. Forneça nenhum parâmetro para sanitizar o apelido original.
cmd_sanitizenames: Ativa ou desativa a sanitização de apelidos que começam com caracteres especiais.
cmd_savechat: Salva em um arquivo as últimas mensagens enviadas a um canal de texto. Mensagens de bots são ignoradas. Usuários sem autoria do bot são limitados a 100 mensagens. Forneça nenhum parâmetro para salvar as 100 últimas mensagens do canal atual.
cmd_say: Envia uma mensagem ao canal especificado. Se o canal for omitido, a mensagem será enviada ao canal atual.
cmd_say: Envia uma mensagem ao canal especificado. Se o canal for omitido, a mensagem será enviada ao canal atual. Aceita anexos `.txt` para mensagens que são longas demais para enviar no Discord.
cmd_sban: Expulsa um usuário do servidor e exclui suas mensagens.
cmd_search: Busca por um comando com a palavra-chave especificada.
cmd_send: Envia uma mensagem ao canal do Discord especificado.
Expand Down
45 changes: 22 additions & 23 deletions AkkoBot/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,34 @@
using System;
using System.Threading;

namespace AkkoBot
namespace AkkoBot;

internal class Program
{
internal class Program
{
private static bool _restartBot = true;
private static CancellationTokenSource? _shutdownToken;
private static bool _restartBot = true;
private static CancellationTokenSource? _shutdownToken;

// Entry point.
private static void Main()
{
// Print the process ID
Console.WriteLine($"Pid: {Environment.ProcessId}");
// Entry point.
private static void Main()
{
// Print the process ID
Console.WriteLine($"Pid: {Environment.ProcessId}");

// LinqToDB initialization
LinqToDBForEFTools.Initialize();
// LinqToDB initialization
LinqToDBForEFTools.Initialize();

// Start the bot.
while (_restartBot)
{
_shutdownToken = new();
var bot = new Bot(_shutdownToken);
// Start the bot.
while (_restartBot)
{
_shutdownToken = new();
var bot = new Bot(_shutdownToken);

// Run the bot
_restartBot = bot.RunAsync().ConfigureAwait(false).GetAwaiter().GetResult();
// Run the bot
_restartBot = bot.RunAsync().ConfigureAwait(false).GetAwaiter().GetResult();

// Clean-up
bot.Dispose();
_shutdownToken.Dispose();
}
// Clean-up
bot.Dispose();
_shutdownToken.Dispose();
}
}
}
3 changes: 2 additions & 1 deletion AkkoCog.DangerousCommands/AkkoCog.DangerousCommands.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit c91952e

Please sign in to comment.