mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-01-31 00:19:00 +03:00
Apply official naming guidelines to Octobot (#306)
1. The root namespace was changed from `Octobot` to `TeamOctolings.Octobot`: > DO prefix namespace names with a company name to prevent namespaces from different companies from having the same name. 2. `Octobot.cs` was renamed to `Program.cs`: > DO NOT use the same name for a namespace and a type in that namespace. 3. `IOption`, `Option` were renamed to `IGuildOption` and `GuildOption` respectively: > DO NOT introduce generic type names such as Element, Node, Log, and Message. 4. `Utility` was moved out of the `Services` namespace. It didn't belong there anyway 5. `Program` static fields were moved to `Utility` 6. Localisation files were moved back to the project source files. Looks like this fixed `Message.Designer.cs` code generation --------- Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
19fadead91
commit
793afd0e06
61 changed files with 447 additions and 462 deletions
10
Octobot.sln
10
Octobot.sln
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Octobot", "Octobot.csproj", "{9CA7A44F-167C-46D4-923D-88CE71044144}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TeamOctolings.Octobot", "TeamOctolings.Octobot\TeamOctolings.Octobot.csproj", "{A1679BA2-3A36-4D98-80C0-EEE771398FBD}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -8,9 +8,9 @@ Global
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{9CA7A44F-167C-46D4-923D-88CE71044144}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{A1679BA2-3A36-4D98-80C0-EEE771398FBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{9CA7A44F-167C-46D4-923D-88CE71044144}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{A1679BA2-3A36-4D98-80C0-EEE771398FBD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{9CA7A44F-167C-46D4-923D-88CE71044144}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{A1679BA2-3A36-4D98-80C0-EEE771398FBD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{9CA7A44F-167C-46D4-923D-88CE71044144}.Release|Any CPU.Build.0 = Release|Any CPU
|
{A1679BA2-3A36-4D98-80C0-EEE771398FBD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Octobot.Attributes;
|
namespace TeamOctolings.Octobot.Attributes;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Any property marked with <see cref="StaticCallersOnlyAttribute"/> should only be accessed by static methods.
|
/// Any property marked with <see cref="StaticCallersOnlyAttribute"/> should only be accessed by static methods.
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Octobot;
|
namespace TeamOctolings.Octobot;
|
||||||
|
|
||||||
public static class BuildInfo
|
public static class BuildInfo
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|
||||||
namespace Octobot;
|
namespace TeamOctolings.Octobot;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contains all colors used in embeds.
|
/// Contains all colors used in embeds.
|
|
@ -1,9 +1,6 @@
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Octobot.Data;
|
|
||||||
using Octobot.Extensions;
|
|
||||||
using Octobot.Services;
|
|
||||||
using Remora.Commands.Attributes;
|
using Remora.Commands.Attributes;
|
||||||
using Remora.Commands.Groups;
|
using Remora.Commands.Groups;
|
||||||
using Remora.Discord.API.Abstractions.Objects;
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
|
@ -18,8 +15,11 @@ using Remora.Discord.Extensions.Embeds;
|
||||||
using Remora.Discord.Extensions.Formatting;
|
using Remora.Discord.Extensions.Formatting;
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
using TeamOctolings.Octobot.Data;
|
||||||
|
using TeamOctolings.Octobot.Extensions;
|
||||||
|
using TeamOctolings.Octobot.Services;
|
||||||
|
|
||||||
namespace Octobot.Commands;
|
namespace TeamOctolings.Octobot.Commands;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles the command to show information about this bot: /about.
|
/// Handles the command to show information about this bot: /about.
|
|
@ -2,11 +2,6 @@ using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Octobot.Data;
|
|
||||||
using Octobot.Extensions;
|
|
||||||
using Octobot.Parsers;
|
|
||||||
using Octobot.Services;
|
|
||||||
using Octobot.Services.Update;
|
|
||||||
using Remora.Commands.Attributes;
|
using Remora.Commands.Attributes;
|
||||||
using Remora.Commands.Groups;
|
using Remora.Commands.Groups;
|
||||||
using Remora.Discord.API.Abstractions.Objects;
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
|
@ -19,8 +14,13 @@ using Remora.Discord.Extensions.Embeds;
|
||||||
using Remora.Discord.Extensions.Formatting;
|
using Remora.Discord.Extensions.Formatting;
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
using TeamOctolings.Octobot.Data;
|
||||||
|
using TeamOctolings.Octobot.Extensions;
|
||||||
|
using TeamOctolings.Octobot.Parsers;
|
||||||
|
using TeamOctolings.Octobot.Services;
|
||||||
|
using TeamOctolings.Octobot.Services.Update;
|
||||||
|
|
||||||
namespace Octobot.Commands;
|
namespace TeamOctolings.Octobot.Commands;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles commands related to ban management: /ban and /unban.
|
/// Handles commands related to ban management: /ban and /unban.
|
|
@ -1,9 +1,6 @@
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Octobot.Data;
|
|
||||||
using Octobot.Extensions;
|
|
||||||
using Octobot.Services;
|
|
||||||
using Remora.Commands.Attributes;
|
using Remora.Commands.Attributes;
|
||||||
using Remora.Commands.Groups;
|
using Remora.Commands.Groups;
|
||||||
using Remora.Discord.API.Abstractions.Objects;
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
|
@ -16,8 +13,11 @@ using Remora.Discord.Extensions.Embeds;
|
||||||
using Remora.Discord.Extensions.Formatting;
|
using Remora.Discord.Extensions.Formatting;
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
using TeamOctolings.Octobot.Data;
|
||||||
|
using TeamOctolings.Octobot.Extensions;
|
||||||
|
using TeamOctolings.Octobot.Services;
|
||||||
|
|
||||||
namespace Octobot.Commands;
|
namespace TeamOctolings.Octobot.Commands;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles the command to clear messages in a channel: /clear.
|
/// Handles the command to clear messages in a channel: /clear.
|
|
@ -1,6 +1,5 @@
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Octobot.Extensions;
|
|
||||||
using Remora.Discord.API.Abstractions.Objects;
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
using Remora.Discord.API.Abstractions.Rest;
|
using Remora.Discord.API.Abstractions.Rest;
|
||||||
using Remora.Discord.API.Objects;
|
using Remora.Discord.API.Objects;
|
||||||
|
@ -11,8 +10,9 @@ using Remora.Discord.Commands.Services;
|
||||||
using Remora.Discord.Extensions.Embeds;
|
using Remora.Discord.Extensions.Embeds;
|
||||||
using Remora.Discord.Extensions.Formatting;
|
using Remora.Discord.Extensions.Formatting;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
using TeamOctolings.Octobot.Extensions;
|
||||||
|
|
||||||
namespace Octobot.Commands.Events;
|
namespace TeamOctolings.Octobot.Commands.Events;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles error logging for slash command groups.
|
/// Handles error logging for slash command groups.
|
|
@ -1,11 +1,11 @@
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Octobot.Extensions;
|
|
||||||
using Remora.Discord.Commands.Contexts;
|
using Remora.Discord.Commands.Contexts;
|
||||||
using Remora.Discord.Commands.Services;
|
using Remora.Discord.Commands.Services;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
using TeamOctolings.Octobot.Extensions;
|
||||||
|
|
||||||
namespace Octobot.Commands.Events;
|
namespace TeamOctolings.Octobot.Commands.Events;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles error logging for slash commands that couldn't be successfully prepared.
|
/// Handles error logging for slash commands that couldn't be successfully prepared.
|
|
@ -1,9 +1,6 @@
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Octobot.Data;
|
|
||||||
using Octobot.Extensions;
|
|
||||||
using Octobot.Services;
|
|
||||||
using Remora.Commands.Attributes;
|
using Remora.Commands.Attributes;
|
||||||
using Remora.Commands.Groups;
|
using Remora.Commands.Groups;
|
||||||
using Remora.Discord.API.Abstractions.Objects;
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
|
@ -15,8 +12,11 @@ using Remora.Discord.Commands.Feedback.Services;
|
||||||
using Remora.Discord.Extensions.Embeds;
|
using Remora.Discord.Extensions.Embeds;
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
using TeamOctolings.Octobot.Data;
|
||||||
|
using TeamOctolings.Octobot.Extensions;
|
||||||
|
using TeamOctolings.Octobot.Services;
|
||||||
|
|
||||||
namespace Octobot.Commands;
|
namespace TeamOctolings.Octobot.Commands;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles the command to kick members of a guild: /kick.
|
/// Handles the command to kick members of a guild: /kick.
|
|
@ -2,11 +2,6 @@ using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Octobot.Data;
|
|
||||||
using Octobot.Extensions;
|
|
||||||
using Octobot.Parsers;
|
|
||||||
using Octobot.Services;
|
|
||||||
using Octobot.Services.Update;
|
|
||||||
using Remora.Commands.Attributes;
|
using Remora.Commands.Attributes;
|
||||||
using Remora.Commands.Groups;
|
using Remora.Commands.Groups;
|
||||||
using Remora.Discord.API.Abstractions.Objects;
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
|
@ -19,8 +14,13 @@ using Remora.Discord.Extensions.Embeds;
|
||||||
using Remora.Discord.Extensions.Formatting;
|
using Remora.Discord.Extensions.Formatting;
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
using TeamOctolings.Octobot.Data;
|
||||||
|
using TeamOctolings.Octobot.Extensions;
|
||||||
|
using TeamOctolings.Octobot.Parsers;
|
||||||
|
using TeamOctolings.Octobot.Services;
|
||||||
|
using TeamOctolings.Octobot.Services.Update;
|
||||||
|
|
||||||
namespace Octobot.Commands;
|
namespace TeamOctolings.Octobot.Commands;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles commands related to mute management: /mute and /unmute.
|
/// Handles commands related to mute management: /mute and /unmute.
|
|
@ -1,8 +1,5 @@
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Octobot.Data;
|
|
||||||
using Octobot.Extensions;
|
|
||||||
using Octobot.Services;
|
|
||||||
using Remora.Commands.Attributes;
|
using Remora.Commands.Attributes;
|
||||||
using Remora.Commands.Groups;
|
using Remora.Commands.Groups;
|
||||||
using Remora.Discord.API.Abstractions.Objects;
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
|
@ -15,8 +12,11 @@ using Remora.Discord.Extensions.Embeds;
|
||||||
using Remora.Discord.Gateway;
|
using Remora.Discord.Gateway;
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
using TeamOctolings.Octobot.Data;
|
||||||
|
using TeamOctolings.Octobot.Extensions;
|
||||||
|
using TeamOctolings.Octobot.Services;
|
||||||
|
|
||||||
namespace Octobot.Commands;
|
namespace TeamOctolings.Octobot.Commands;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles the command to get the time taken for the gateway to respond to the last heartbeat: /ping
|
/// Handles the command to get the time taken for the gateway to respond to the last heartbeat: /ping
|
|
@ -2,9 +2,6 @@ using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Octobot.Data;
|
|
||||||
using Octobot.Extensions;
|
|
||||||
using Octobot.Services;
|
|
||||||
using Remora.Commands.Attributes;
|
using Remora.Commands.Attributes;
|
||||||
using Remora.Commands.Groups;
|
using Remora.Commands.Groups;
|
||||||
using Remora.Discord.API.Abstractions.Objects;
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
|
@ -17,9 +14,12 @@ using Remora.Discord.Extensions.Embeds;
|
||||||
using Remora.Discord.Extensions.Formatting;
|
using Remora.Discord.Extensions.Formatting;
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
using Octobot.Parsers;
|
using TeamOctolings.Octobot.Data;
|
||||||
|
using TeamOctolings.Octobot.Extensions;
|
||||||
|
using TeamOctolings.Octobot.Parsers;
|
||||||
|
using TeamOctolings.Octobot.Services;
|
||||||
|
|
||||||
namespace Octobot.Commands;
|
namespace TeamOctolings.Octobot.Commands;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles commands to manage reminders: /remind, /listremind, /delremind
|
/// Handles commands to manage reminders: /remind, /listremind, /delremind
|
|
@ -3,10 +3,6 @@ using System.ComponentModel.DataAnnotations;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json.Nodes;
|
using System.Text.Json.Nodes;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Octobot.Data;
|
|
||||||
using Octobot.Data.Options;
|
|
||||||
using Octobot.Extensions;
|
|
||||||
using Octobot.Services;
|
|
||||||
using Remora.Commands.Attributes;
|
using Remora.Commands.Attributes;
|
||||||
using Remora.Commands.Groups;
|
using Remora.Commands.Groups;
|
||||||
using Remora.Discord.API.Abstractions.Objects;
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
|
@ -19,8 +15,12 @@ using Remora.Discord.Extensions.Embeds;
|
||||||
using Remora.Discord.Extensions.Formatting;
|
using Remora.Discord.Extensions.Formatting;
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
using TeamOctolings.Octobot.Data;
|
||||||
|
using TeamOctolings.Octobot.Data.Options;
|
||||||
|
using TeamOctolings.Octobot.Extensions;
|
||||||
|
using TeamOctolings.Octobot.Services;
|
||||||
|
|
||||||
namespace Octobot.Commands;
|
namespace TeamOctolings.Octobot.Commands;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles the commands to list and modify per-guild settings: /settings and /settings list.
|
/// Handles the commands to list and modify per-guild settings: /settings and /settings list.
|
||||||
|
@ -29,13 +29,13 @@ namespace Octobot.Commands;
|
||||||
public class SettingsCommandGroup : CommandGroup
|
public class SettingsCommandGroup : CommandGroup
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents all options as an array of objects implementing <see cref="IOption" />.
|
/// Represents all options as an array of objects implementing <see cref="IGuildOption" />.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// WARNING: If you update this array in any way, you must also update <see cref="AllOptionsEnum" /> and make sure
|
/// WARNING: If you update this array in any way, you must also update <see cref="AllOptionsEnum" /> and make sure
|
||||||
/// that the orders match.
|
/// that the orders match.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
private static readonly IOption[] AllOptions =
|
private static readonly IGuildOption[] AllOptions =
|
||||||
[
|
[
|
||||||
GuildSettings.Language,
|
GuildSettings.Language,
|
||||||
GuildSettings.WelcomeMessage,
|
GuildSettings.WelcomeMessage,
|
||||||
|
@ -199,7 +199,7 @@ public class SettingsCommandGroup : CommandGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Result> EditSettingAsync(
|
private async Task<Result> EditSettingAsync(
|
||||||
IOption option, string value, GuildData data, Snowflake channelId, IUser executor, IUser bot,
|
IGuildOption option, string value, GuildData data, Snowflake channelId, IUser executor, IUser bot,
|
||||||
CancellationToken ct = default)
|
CancellationToken ct = default)
|
||||||
{
|
{
|
||||||
var setResult = option.Set(data.Settings, value);
|
var setResult = option.Set(data.Settings, value);
|
||||||
|
@ -270,7 +270,7 @@ public class SettingsCommandGroup : CommandGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Result> ResetSingleSettingAsync(JsonNode cfg, IUser bot,
|
private async Task<Result> ResetSingleSettingAsync(JsonNode cfg, IUser bot,
|
||||||
IOption option, CancellationToken ct = default)
|
IGuildOption option, CancellationToken ct = default)
|
||||||
{
|
{
|
||||||
var resetResult = option.Reset(cfg);
|
var resetResult = option.Reset(cfg);
|
||||||
if (!resetResult.IsSuccess)
|
if (!resetResult.IsSuccess)
|
|
@ -2,10 +2,6 @@ using System.ComponentModel;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Octobot.Data;
|
|
||||||
using Octobot.Extensions;
|
|
||||||
using Octobot.Parsers;
|
|
||||||
using Octobot.Services;
|
|
||||||
using Remora.Commands.Attributes;
|
using Remora.Commands.Attributes;
|
||||||
using Remora.Commands.Groups;
|
using Remora.Commands.Groups;
|
||||||
using Remora.Discord.API.Abstractions.Objects;
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
|
@ -17,8 +13,12 @@ using Remora.Discord.Extensions.Embeds;
|
||||||
using Remora.Discord.Extensions.Formatting;
|
using Remora.Discord.Extensions.Formatting;
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
using TeamOctolings.Octobot.Data;
|
||||||
|
using TeamOctolings.Octobot.Extensions;
|
||||||
|
using TeamOctolings.Octobot.Parsers;
|
||||||
|
using TeamOctolings.Octobot.Services;
|
||||||
|
|
||||||
namespace Octobot.Commands;
|
namespace TeamOctolings.Octobot.Commands;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles tool commands: /userinfo, /guildinfo, /random, /timestamp, /8ball.
|
/// Handles tool commands: /userinfo, /guildinfo, /random, /timestamp, /8ball.
|
|
@ -1,7 +1,7 @@
|
||||||
using System.Text.Json.Nodes;
|
using System.Text.Json.Nodes;
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
|
|
||||||
namespace Octobot.Data;
|
namespace TeamOctolings.Octobot.Data;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stores information about a guild. This information is not accessible via the Discord API.
|
/// Stores information about a guild. This information is not accessible via the Discord API.
|
|
@ -1,8 +1,8 @@
|
||||||
using Octobot.Data.Options;
|
|
||||||
using Octobot.Responders;
|
|
||||||
using Remora.Discord.API.Abstractions.Objects;
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
|
using TeamOctolings.Octobot.Data.Options;
|
||||||
|
using TeamOctolings.Octobot.Responders;
|
||||||
|
|
||||||
namespace Octobot.Data;
|
namespace TeamOctolings.Octobot.Data;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contains all per-guild settings that can be set by a member
|
/// Contains all per-guild settings that can be set by a member
|
||||||
|
@ -22,7 +22,7 @@ public static class GuildSettings
|
||||||
/// </list>
|
/// </list>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <seealso cref="GuildMemberJoinedResponder" />
|
/// <seealso cref="GuildMemberJoinedResponder" />
|
||||||
public static readonly Option<string> WelcomeMessage = new("WelcomeMessage", "default");
|
public static readonly GuildOption<string> WelcomeMessage = new("WelcomeMessage", "default");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Controls what message should be sent in <see cref="PublicFeedbackChannel" /> when a member leaves the guild.
|
/// Controls what message should be sent in <see cref="PublicFeedbackChannel" /> when a member leaves the guild.
|
||||||
|
@ -34,7 +34,7 @@ public static class GuildSettings
|
||||||
/// </list>
|
/// </list>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <seealso cref="GuildMemberLeftResponder" />
|
/// <seealso cref="GuildMemberLeftResponder" />
|
||||||
public static readonly Option<string> LeaveMessage = new("LeaveMessage", "default");
|
public static readonly GuildOption<string> LeaveMessage = new("LeaveMessage", "default");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Controls whether or not the <see cref="Messages.Ready" /> message should be sent
|
/// Controls whether or not the <see cref="Messages.Ready" /> message should be sent
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Octobot.Data;
|
namespace TeamOctolings.Octobot.Data;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stores information about a member
|
/// Stores information about a member
|
|
@ -1,7 +1,7 @@
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Octobot.Commands;
|
using TeamOctolings.Octobot.Commands;
|
||||||
|
|
||||||
namespace Octobot.Data.Options;
|
namespace TeamOctolings.Octobot.Data.Options;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents all options as enums.
|
/// Represents all options as enums.
|
|
@ -1,9 +1,9 @@
|
||||||
using System.Text.Json.Nodes;
|
using System.Text.Json.Nodes;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
|
||||||
namespace Octobot.Data.Options;
|
namespace TeamOctolings.Octobot.Data.Options;
|
||||||
|
|
||||||
public sealed class BoolOption : Option<bool>
|
public sealed class BoolOption : GuildOption<bool>
|
||||||
{
|
{
|
||||||
public BoolOption(string name, bool defaultValue) : base(name, defaultValue) { }
|
public BoolOption(string name, bool defaultValue) : base(name, defaultValue) { }
|
||||||
|
|
|
@ -2,18 +2,18 @@ using System.Text.Json.Nodes;
|
||||||
using Remora.Discord.Extensions.Formatting;
|
using Remora.Discord.Extensions.Formatting;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
|
||||||
namespace Octobot.Data.Options;
|
namespace TeamOctolings.Octobot.Data.Options;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents an per-guild option.
|
/// Represents a per-guild option.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">The type of the option.</typeparam>
|
/// <typeparam name="T">The type of the option.</typeparam>
|
||||||
public class Option<T> : IOption
|
public class GuildOption<T> : IGuildOption
|
||||||
where T : notnull
|
where T : notnull
|
||||||
{
|
{
|
||||||
protected readonly T DefaultValue;
|
protected readonly T DefaultValue;
|
||||||
|
|
||||||
public Option(string name, T defaultValue)
|
public GuildOption(string name, T defaultValue)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
DefaultValue = defaultValue;
|
DefaultValue = defaultValue;
|
|
@ -1,9 +1,9 @@
|
||||||
using System.Text.Json.Nodes;
|
using System.Text.Json.Nodes;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
|
||||||
namespace Octobot.Data.Options;
|
namespace TeamOctolings.Octobot.Data.Options;
|
||||||
|
|
||||||
public interface IOption
|
public interface IGuildOption
|
||||||
{
|
{
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
string Display(JsonNode settings);
|
string Display(JsonNode settings);
|
|
@ -3,10 +3,10 @@ using System.Text.Json.Nodes;
|
||||||
using Remora.Discord.Extensions.Formatting;
|
using Remora.Discord.Extensions.Formatting;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
|
||||||
namespace Octobot.Data.Options;
|
namespace TeamOctolings.Octobot.Data.Options;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public sealed class LanguageOption : Option<CultureInfo>
|
public sealed class LanguageOption : GuildOption<CultureInfo>
|
||||||
{
|
{
|
||||||
private static readonly Dictionary<string, CultureInfo> CultureInfoCache = new()
|
private static readonly Dictionary<string, CultureInfo> CultureInfoCache = new()
|
||||||
{
|
{
|
|
@ -1,13 +1,13 @@
|
||||||
using System.Text.Json.Nodes;
|
using System.Text.Json.Nodes;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Octobot.Extensions;
|
|
||||||
using Remora.Discord.Extensions.Formatting;
|
using Remora.Discord.Extensions.Formatting;
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
using TeamOctolings.Octobot.Extensions;
|
||||||
|
|
||||||
namespace Octobot.Data.Options;
|
namespace TeamOctolings.Octobot.Data.Options;
|
||||||
|
|
||||||
public sealed partial class SnowflakeOption : Option<Snowflake>
|
public sealed partial class SnowflakeOption : GuildOption<Snowflake>
|
||||||
{
|
{
|
||||||
public SnowflakeOption(string name) : base(name, 0UL.ToSnowflake()) { }
|
public SnowflakeOption(string name) : base(name, 0UL.ToSnowflake()) { }
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
using System.Text.Json.Nodes;
|
using System.Text.Json.Nodes;
|
||||||
using Octobot.Parsers;
|
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
using TeamOctolings.Octobot.Parsers;
|
||||||
|
|
||||||
namespace Octobot.Data.Options;
|
namespace TeamOctolings.Octobot.Data.Options;
|
||||||
|
|
||||||
public sealed class TimeSpanOption : Option<TimeSpan>
|
public sealed class TimeSpanOption : GuildOption<TimeSpan>
|
||||||
{
|
{
|
||||||
public TimeSpanOption(string name, TimeSpan defaultValue) : base(name, defaultValue) { }
|
public TimeSpanOption(string name, TimeSpan defaultValue) : base(name, defaultValue) { }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Octobot.Data;
|
namespace TeamOctolings.Octobot.Data;
|
||||||
|
|
||||||
public struct Reminder
|
public struct Reminder
|
||||||
{
|
{
|
|
@ -1,7 +1,7 @@
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using Remora.Discord.API.Abstractions.Objects;
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
|
|
||||||
namespace Octobot.Data;
|
namespace TeamOctolings.Octobot.Data;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stores information about scheduled events. This information is not provided by the Discord API.
|
/// Stores information about scheduled events. This information is not provided by the Discord API.
|
|
@ -5,7 +5,7 @@ using Remora.Discord.API.Objects;
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
|
||||||
namespace Octobot.Extensions;
|
namespace TeamOctolings.Octobot.Extensions;
|
||||||
|
|
||||||
public static class ChannelApiExtensions
|
public static class ChannelApiExtensions
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
|
||||||
namespace Octobot.Extensions;
|
namespace TeamOctolings.Octobot.Extensions;
|
||||||
|
|
||||||
public static class CollectionExtensions
|
public static class CollectionExtensions
|
||||||
{
|
{
|
|
@ -2,7 +2,7 @@
|
||||||
using Remora.Discord.Commands.Extensions;
|
using Remora.Discord.Commands.Extensions;
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
|
|
||||||
namespace Octobot.Extensions;
|
namespace TeamOctolings.Octobot.Extensions;
|
||||||
|
|
||||||
public static class CommandContextExtensions
|
public static class CommandContextExtensions
|
||||||
{
|
{
|
|
@ -1,7 +1,7 @@
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using DiffPlex.DiffBuilder.Model;
|
using DiffPlex.DiffBuilder.Model;
|
||||||
|
|
||||||
namespace Octobot.Extensions;
|
namespace TeamOctolings.Octobot.Extensions;
|
||||||
|
|
||||||
public static class DiffPaneModelExtensions
|
public static class DiffPaneModelExtensions
|
||||||
{
|
{
|
|
@ -4,7 +4,7 @@ using Remora.Discord.API.Objects;
|
||||||
using Remora.Discord.Extensions.Embeds;
|
using Remora.Discord.Extensions.Embeds;
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
|
|
||||||
namespace Octobot.Extensions;
|
namespace TeamOctolings.Octobot.Extensions;
|
||||||
|
|
||||||
public static class EmbedBuilderExtensions
|
public static class EmbedBuilderExtensions
|
||||||
{
|
{
|
|
@ -3,7 +3,7 @@ using Remora.Discord.Commands.Feedback.Messages;
|
||||||
using Remora.Discord.Commands.Feedback.Services;
|
using Remora.Discord.Commands.Feedback.Services;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
|
||||||
namespace Octobot.Extensions;
|
namespace TeamOctolings.Octobot.Extensions;
|
||||||
|
|
||||||
public static class FeedbackServiceExtensions
|
public static class FeedbackServiceExtensions
|
||||||
{
|
{
|
|
@ -2,7 +2,7 @@
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
|
||||||
namespace Octobot.Extensions;
|
namespace TeamOctolings.Octobot.Extensions;
|
||||||
|
|
||||||
public static class GuildScheduledEventExtensions
|
public static class GuildScheduledEventExtensions
|
||||||
{
|
{
|
|
@ -1,7 +1,7 @@
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
|
||||||
namespace Octobot.Extensions;
|
namespace TeamOctolings.Octobot.Extensions;
|
||||||
|
|
||||||
public static class LoggerExtensions
|
public static class LoggerExtensions
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Octobot.Extensions;
|
namespace TeamOctolings.Octobot.Extensions;
|
||||||
|
|
||||||
public static class MarkdownExtensions
|
public static class MarkdownExtensions
|
||||||
{
|
{
|
|
@ -2,7 +2,7 @@
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
|
||||||
namespace Octobot.Extensions;
|
namespace TeamOctolings.Octobot.Extensions;
|
||||||
|
|
||||||
public static class ResultExtensions
|
public static class ResultExtensions
|
||||||
{
|
{
|
||||||
|
@ -23,18 +23,23 @@ public static class ResultExtensions
|
||||||
|
|
||||||
private static void LogResultStackTrace(Result result)
|
private static void LogResultStackTrace(Result result)
|
||||||
{
|
{
|
||||||
if (Octobot.StaticLogger is null || result.IsSuccess)
|
if (result.IsSuccess)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Octobot.StaticLogger.LogError("{ErrorType}: {ErrorMessage}{NewLine}{StackTrace}",
|
if (Utility.StaticLogger is null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
Utility.StaticLogger.LogError("{ErrorType}: {ErrorMessage}{NewLine}{StackTrace}",
|
||||||
result.Error.GetType().FullName, result.Error.Message, Environment.NewLine, ConstructStackTrace());
|
result.Error.GetType().FullName, result.Error.Message, Environment.NewLine, ConstructStackTrace());
|
||||||
|
|
||||||
var inner = result.Inner;
|
var inner = result.Inner;
|
||||||
while (inner is { IsSuccess: false })
|
while (inner is { IsSuccess: false })
|
||||||
{
|
{
|
||||||
Octobot.StaticLogger.LogError("Caused by: {ResultType}: {ResultMessage}",
|
Utility.StaticLogger.LogError("Caused by: {ResultType}: {ResultMessage}",
|
||||||
inner.Error.GetType().FullName, inner.Error.Message);
|
inner.Error.GetType().FullName, inner.Error.Message);
|
||||||
|
|
||||||
inner = inner.Inner;
|
inner = inner.Inner;
|
|
@ -1,6 +1,6 @@
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
|
|
||||||
namespace Octobot.Extensions;
|
namespace TeamOctolings.Octobot.Extensions;
|
||||||
|
|
||||||
public static class SnowflakeExtensions
|
public static class SnowflakeExtensions
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Octobot.Extensions;
|
namespace TeamOctolings.Octobot.Extensions;
|
||||||
|
|
||||||
public static class StringBuilderExtensions
|
public static class StringBuilderExtensions
|
||||||
{
|
{
|
|
@ -1,7 +1,7 @@
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using Remora.Discord.Extensions.Formatting;
|
using Remora.Discord.Extensions.Formatting;
|
||||||
|
|
||||||
namespace Octobot.Extensions;
|
namespace TeamOctolings.Octobot.Extensions;
|
||||||
|
|
||||||
public static class StringExtensions
|
public static class StringExtensions
|
||||||
{
|
{
|
|
@ -1,7 +1,7 @@
|
||||||
using Remora.Discord.API;
|
using Remora.Discord.API;
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
|
|
||||||
namespace Octobot.Extensions;
|
namespace TeamOctolings.Octobot.Extensions;
|
||||||
|
|
||||||
public static class UInt64Extensions
|
public static class UInt64Extensions
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using Remora.Discord.API.Abstractions.Objects;
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
|
|
||||||
namespace Octobot.Extensions;
|
namespace TeamOctolings.Octobot.Extensions;
|
||||||
|
|
||||||
public static class UserExtensions
|
public static class UserExtensions
|
||||||
{
|
{
|
|
@ -7,7 +7,10 @@
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace Octobot {
|
namespace TeamOctolings.Octobot {
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||||
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
@ -25,7 +28,7 @@ namespace Octobot {
|
||||||
internal static System.Resources.ResourceManager ResourceManager {
|
internal static System.Resources.ResourceManager ResourceManager {
|
||||||
get {
|
get {
|
||||||
if (object.Equals(null, resourceMan)) {
|
if (object.Equals(null, resourceMan)) {
|
||||||
System.Resources.ResourceManager temp = new System.Resources.ResourceManager("Octobot.locale.Messages", typeof(Messages).Assembly);
|
System.Resources.ResourceManager temp = new System.Resources.ResourceManager("TeamOctolings.Octobot.Messages", typeof(Messages).Assembly);
|
||||||
resourceMan = temp;
|
resourceMan = temp;
|
||||||
}
|
}
|
||||||
return resourceMan;
|
return resourceMan;
|
||||||
|
@ -120,9 +123,9 @@ namespace Octobot {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string SettingsLang {
|
internal static string SettingsLanguage {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("SettingsLang", resourceCulture);
|
return ResourceManager.GetString("SettingsLanguage", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,18 +207,6 @@ namespace Octobot {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string InvalidRole {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("InvalidRole", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static string InvalidChannel {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("InvalidChannel", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static string DurationRequiredForTimeOuts {
|
internal static string DurationRequiredForTimeOuts {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("DurationRequiredForTimeOuts", resourceCulture);
|
return ResourceManager.GetString("DurationRequiredForTimeOuts", resourceCulture);
|
||||||
|
@ -282,6 +273,12 @@ namespace Octobot {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static string MissingUser {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("MissingUser", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal static string UserCannotBanMembers {
|
internal static string UserCannotBanMembers {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("UserCannotBanMembers", resourceCulture);
|
return ResourceManager.GetString("UserCannotBanMembers", resourceCulture);
|
||||||
|
@ -300,9 +297,15 @@ namespace Octobot {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string UserCannotModerateMembers {
|
internal static string UserCannotMuteMembers {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("UserCannotModerateMembers", resourceCulture);
|
return ResourceManager.GetString("UserCannotMuteMembers", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static string UserCannotUnmuteMembers {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("UserCannotUnmuteMembers", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -702,6 +705,12 @@ namespace Octobot {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static string SettingsRenameHoistedUsers {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("SettingsRenameHoistedUsers", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal static string Page {
|
internal static string Page {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("Page", resourceCulture);
|
return ResourceManager.GetString("Page", resourceCulture);
|
||||||
|
@ -798,21 +807,15 @@ namespace Octobot {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string InformationAbout {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("InformationAbout", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static string UserInfoDisplayName {
|
internal static string UserInfoDisplayName {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("UserInfoDisplayName", resourceCulture);
|
return ResourceManager.GetString("UserInfoDisplayName", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string UserInfoDiscordUserSince {
|
internal static string InformationAbout {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("UserInfoDiscordUserSince", resourceCulture);
|
return ResourceManager.GetString("InformationAbout", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -822,6 +825,12 @@ namespace Octobot {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static string UserInfoDiscordUserSince {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("UserInfoDiscordUserSince", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal static string UserInfoBanned {
|
internal static string UserInfoBanned {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("UserInfoBanned", resourceCulture);
|
return ResourceManager.GetString("UserInfoBanned", resourceCulture);
|
||||||
|
@ -882,157 +891,122 @@ namespace Octobot {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string RandomTitle
|
internal static string RandomTitle {
|
||||||
{
|
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("RandomTitle", resourceCulture);
|
return ResourceManager.GetString("RandomTitle", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string RandomMinMaxSame
|
internal static string RandomMinMaxSame {
|
||||||
{
|
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("RandomMinMaxSame", resourceCulture);
|
return ResourceManager.GetString("RandomMinMaxSame", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string RandomMax
|
internal static string RandomMin {
|
||||||
{
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("RandomMax", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static string RandomMin
|
|
||||||
{
|
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("RandomMin", resourceCulture);
|
return ResourceManager.GetString("RandomMin", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string Default
|
internal static string RandomMax {
|
||||||
{
|
get {
|
||||||
|
return ResourceManager.GetString("RandomMax", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static string Default {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("Default", resourceCulture);
|
return ResourceManager.GetString("Default", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string TimestampTitle
|
internal static string TimestampTitle {
|
||||||
{
|
get {
|
||||||
get
|
|
||||||
{
|
|
||||||
return ResourceManager.GetString("TimestampTitle", resourceCulture);
|
return ResourceManager.GetString("TimestampTitle", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string TimestampOffset
|
internal static string TimestampOffset {
|
||||||
{
|
get {
|
||||||
get
|
|
||||||
{
|
|
||||||
return ResourceManager.GetString("TimestampOffset", resourceCulture);
|
return ResourceManager.GetString("TimestampOffset", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string GuildInfoDescription
|
internal static string GuildInfoDescription {
|
||||||
{
|
get {
|
||||||
get
|
|
||||||
{
|
|
||||||
return ResourceManager.GetString("GuildInfoDescription", resourceCulture);
|
return ResourceManager.GetString("GuildInfoDescription", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string GuildInfoCreatedAt
|
internal static string GuildInfoCreatedAt {
|
||||||
{
|
get {
|
||||||
get
|
|
||||||
{
|
|
||||||
return ResourceManager.GetString("GuildInfoCreatedAt", resourceCulture);
|
return ResourceManager.GetString("GuildInfoCreatedAt", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string GuildInfoOwner
|
internal static string GuildInfoOwner {
|
||||||
{
|
get {
|
||||||
get
|
|
||||||
{
|
|
||||||
return ResourceManager.GetString("GuildInfoOwner", resourceCulture);
|
return ResourceManager.GetString("GuildInfoOwner", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string GuildInfoServerBoost
|
internal static string GuildInfoServerBoost {
|
||||||
{
|
get {
|
||||||
get
|
|
||||||
{
|
|
||||||
return ResourceManager.GetString("GuildInfoServerBoost", resourceCulture);
|
return ResourceManager.GetString("GuildInfoServerBoost", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string GuildInfoBoostTier
|
internal static string GuildInfoBoostTier {
|
||||||
{
|
get {
|
||||||
get
|
|
||||||
{
|
|
||||||
return ResourceManager.GetString("GuildInfoBoostTier", resourceCulture);
|
return ResourceManager.GetString("GuildInfoBoostTier", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string GuildInfoBoostCount
|
internal static string GuildInfoBoostCount {
|
||||||
{
|
get {
|
||||||
get
|
|
||||||
{
|
|
||||||
return ResourceManager.GetString("GuildInfoBoostCount", resourceCulture);
|
return ResourceManager.GetString("GuildInfoBoostCount", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string NoMessagesToClear
|
internal static string NoMessagesToClear {
|
||||||
{
|
get {
|
||||||
get
|
|
||||||
{
|
|
||||||
return ResourceManager.GetString("NoMessagesToClear", resourceCulture);
|
return ResourceManager.GetString("NoMessagesToClear", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string MessagesClearedFiltered
|
internal static string MessagesClearedFiltered {
|
||||||
{
|
get {
|
||||||
get
|
|
||||||
{
|
|
||||||
return ResourceManager.GetString("MessagesClearedFiltered", resourceCulture);
|
return ResourceManager.GetString("MessagesClearedFiltered", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string DataLoadFailedTitle
|
internal static string DataLoadFailedTitle {
|
||||||
{
|
get {
|
||||||
get
|
|
||||||
{
|
|
||||||
return ResourceManager.GetString("DataLoadFailedTitle", resourceCulture);
|
return ResourceManager.GetString("DataLoadFailedTitle", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string DataLoadFailedDescription
|
internal static string DataLoadFailedDescription {
|
||||||
{
|
get {
|
||||||
get
|
|
||||||
{
|
|
||||||
return ResourceManager.GetString("DataLoadFailedDescription", resourceCulture);
|
return ResourceManager.GetString("DataLoadFailedDescription", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string CommandExecutionFailed
|
internal static string CommandExecutionFailed {
|
||||||
{
|
get {
|
||||||
get
|
|
||||||
{
|
|
||||||
return ResourceManager.GetString("CommandExecutionFailed", resourceCulture);
|
return ResourceManager.GetString("CommandExecutionFailed", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string ContactDevelopers
|
internal static string ContactDevelopers {
|
||||||
{
|
get {
|
||||||
get
|
|
||||||
{
|
|
||||||
return ResourceManager.GetString("ContactDevelopers", resourceCulture);
|
return ResourceManager.GetString("ContactDevelopers", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string ButtonReportIssue
|
internal static string ButtonReportIssue {
|
||||||
{
|
get {
|
||||||
get
|
|
||||||
{
|
|
||||||
return ResourceManager.GetString("ButtonReportIssue", resourceCulture);
|
return ResourceManager.GetString("ButtonReportIssue", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1216,5 +1190,11 @@ namespace Octobot {
|
||||||
return ResourceManager.GetString("ButtonOpenWiki", resourceCulture);
|
return ResourceManager.GetString("ButtonOpenWiki", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static string SettingsModeratorRole {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("SettingsModeratorRole", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@ using JetBrains.Annotations;
|
||||||
using Remora.Commands.Parsers;
|
using Remora.Commands.Parsers;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
|
||||||
namespace Octobot.Parsers;
|
namespace TeamOctolings.Octobot.Parsers;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parses <see cref="TimeSpan"/>s.
|
/// Parses <see cref="TimeSpan"/>s.
|
|
@ -2,13 +2,8 @@ using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Octobot.Attributes;
|
|
||||||
using Octobot.Commands.Events;
|
|
||||||
using Octobot.Services;
|
|
||||||
using Octobot.Services.Update;
|
|
||||||
using Remora.Discord.API.Abstractions.Gateway.Commands;
|
using Remora.Discord.API.Abstractions.Gateway.Commands;
|
||||||
using Remora.Discord.API.Abstractions.Objects;
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
using Remora.Discord.API.Objects;
|
|
||||||
using Remora.Discord.Caching.Extensions;
|
using Remora.Discord.Caching.Extensions;
|
||||||
using Remora.Discord.Caching.Services;
|
using Remora.Discord.Caching.Services;
|
||||||
using Remora.Discord.Commands.Extensions;
|
using Remora.Discord.Commands.Extensions;
|
||||||
|
@ -16,24 +11,20 @@ using Remora.Discord.Commands.Services;
|
||||||
using Remora.Discord.Extensions.Extensions;
|
using Remora.Discord.Extensions.Extensions;
|
||||||
using Remora.Discord.Gateway;
|
using Remora.Discord.Gateway;
|
||||||
using Remora.Discord.Hosting.Extensions;
|
using Remora.Discord.Hosting.Extensions;
|
||||||
using Remora.Rest.Core;
|
|
||||||
using Serilog.Extensions.Logging;
|
using Serilog.Extensions.Logging;
|
||||||
|
using TeamOctolings.Octobot.Commands.Events;
|
||||||
|
using TeamOctolings.Octobot.Services;
|
||||||
|
using TeamOctolings.Octobot.Services.Update;
|
||||||
|
|
||||||
namespace Octobot;
|
namespace TeamOctolings.Octobot;
|
||||||
|
|
||||||
public sealed class Octobot
|
public sealed class Program
|
||||||
{
|
{
|
||||||
public static readonly AllowedMentions NoMentions = new(
|
|
||||||
Array.Empty<MentionType>(), Array.Empty<Snowflake>(), Array.Empty<Snowflake>());
|
|
||||||
|
|
||||||
[StaticCallersOnly]
|
|
||||||
public static ILogger<Octobot>? StaticLogger { get; private set; }
|
|
||||||
|
|
||||||
public static async Task Main(string[] args)
|
public static async Task Main(string[] args)
|
||||||
{
|
{
|
||||||
var host = CreateHostBuilder(args).UseConsoleLifetime().Build();
|
var host = CreateHostBuilder(args).UseConsoleLifetime().Build();
|
||||||
var services = host.Services;
|
var services = host.Services;
|
||||||
StaticLogger = services.GetRequiredService<ILogger<Octobot>>();
|
Utility.StaticLogger = services.GetRequiredService<ILogger<Program>>();
|
||||||
|
|
||||||
var slashService = services.GetRequiredService<SlashService>();
|
var slashService = services.GetRequiredService<SlashService>();
|
||||||
// Providing a guild ID to this call will result in command duplicates!
|
// Providing a guild ID to this call will result in command duplicates!
|
||||||
|
@ -82,8 +73,8 @@ public sealed class Octobot
|
||||||
// Init
|
// Init
|
||||||
.AddDiscordCaching()
|
.AddDiscordCaching()
|
||||||
.AddDiscordCommands(true, false)
|
.AddDiscordCommands(true, false)
|
||||||
.AddRespondersFromAssembly(typeof(Octobot).Assembly)
|
.AddRespondersFromAssembly(typeof(Program).Assembly)
|
||||||
.AddCommandGroupsFromAssembly(typeof(Octobot).Assembly)
|
.AddCommandGroupsFromAssembly(typeof(Program).Assembly)
|
||||||
// Slash command event handlers
|
// Slash command event handlers
|
||||||
.AddPreparationErrorEvent<LoggingPreparationErrorEvent>()
|
.AddPreparationErrorEvent<LoggingPreparationErrorEvent>()
|
||||||
.AddPostExecutionEvent<ErrorLoggingPostExecutionEvent>()
|
.AddPostExecutionEvent<ErrorLoggingPostExecutionEvent>()
|
|
@ -1,8 +1,5 @@
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Octobot.Data;
|
|
||||||
using Octobot.Extensions;
|
|
||||||
using Octobot.Services;
|
|
||||||
using Remora.Discord.API.Abstractions.Gateway.Events;
|
using Remora.Discord.API.Abstractions.Gateway.Events;
|
||||||
using Remora.Discord.API.Abstractions.Objects;
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
using Remora.Discord.API.Abstractions.Rest;
|
using Remora.Discord.API.Abstractions.Rest;
|
||||||
|
@ -11,8 +8,11 @@ using Remora.Discord.API.Objects;
|
||||||
using Remora.Discord.Extensions.Embeds;
|
using Remora.Discord.Extensions.Embeds;
|
||||||
using Remora.Discord.Gateway.Responders;
|
using Remora.Discord.Gateway.Responders;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
using TeamOctolings.Octobot.Data;
|
||||||
|
using TeamOctolings.Octobot.Extensions;
|
||||||
|
using TeamOctolings.Octobot.Services;
|
||||||
|
|
||||||
namespace Octobot.Responders;
|
namespace TeamOctolings.Octobot.Responders;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles sending a <see cref="Ready" /> message to a guild that has just initialized if that guild
|
/// Handles sending a <see cref="Ready" /> message to a guild that has just initialized if that guild
|
|
@ -1,16 +1,16 @@
|
||||||
using System.Text.Json.Nodes;
|
using System.Text.Json.Nodes;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Octobot.Data;
|
|
||||||
using Octobot.Extensions;
|
|
||||||
using Octobot.Services;
|
|
||||||
using Remora.Discord.API.Abstractions.Gateway.Events;
|
using Remora.Discord.API.Abstractions.Gateway.Events;
|
||||||
using Remora.Discord.API.Abstractions.Rest;
|
using Remora.Discord.API.Abstractions.Rest;
|
||||||
using Remora.Discord.Extensions.Embeds;
|
using Remora.Discord.Extensions.Embeds;
|
||||||
using Remora.Discord.Gateway.Responders;
|
using Remora.Discord.Gateway.Responders;
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
using TeamOctolings.Octobot.Data;
|
||||||
|
using TeamOctolings.Octobot.Extensions;
|
||||||
|
using TeamOctolings.Octobot.Services;
|
||||||
|
|
||||||
namespace Octobot.Responders;
|
namespace TeamOctolings.Octobot.Responders;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles sending a guild's <see cref="GuildSettings.WelcomeMessage" /> if one is set.
|
/// Handles sending a guild's <see cref="GuildSettings.WelcomeMessage" /> if one is set.
|
||||||
|
@ -77,7 +77,7 @@ public class GuildMemberJoinedResponder : IResponder<IGuildMemberAdd>
|
||||||
|
|
||||||
return await _channelApi.CreateMessageWithEmbedResultAsync(
|
return await _channelApi.CreateMessageWithEmbedResultAsync(
|
||||||
GuildSettings.WelcomeMessagesChannel.Get(cfg), embedResult: embed,
|
GuildSettings.WelcomeMessagesChannel.Get(cfg), embedResult: embed,
|
||||||
allowedMentions: Octobot.NoMentions, ct: ct);
|
allowedMentions: Utility.NoMentions, ct: ct);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Result> TryReturnRolesAsync(
|
private async Task<Result> TryReturnRolesAsync(
|
|
@ -1,14 +1,14 @@
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Octobot.Data;
|
|
||||||
using Octobot.Extensions;
|
|
||||||
using Octobot.Services;
|
|
||||||
using Remora.Discord.API.Abstractions.Gateway.Events;
|
using Remora.Discord.API.Abstractions.Gateway.Events;
|
||||||
using Remora.Discord.API.Abstractions.Rest;
|
using Remora.Discord.API.Abstractions.Rest;
|
||||||
using Remora.Discord.Extensions.Embeds;
|
using Remora.Discord.Extensions.Embeds;
|
||||||
using Remora.Discord.Gateway.Responders;
|
using Remora.Discord.Gateway.Responders;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
using TeamOctolings.Octobot.Data;
|
||||||
|
using TeamOctolings.Octobot.Extensions;
|
||||||
|
using TeamOctolings.Octobot.Services;
|
||||||
|
|
||||||
namespace Octobot.Responders;
|
namespace TeamOctolings.Octobot.Responders;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles sending a guild's <see cref="GuildSettings.LeaveMessage" /> if one is set.
|
/// Handles sending a guild's <see cref="GuildSettings.LeaveMessage" /> if one is set.
|
||||||
|
@ -67,6 +67,6 @@ public class GuildMemberLeftResponder : IResponder<IGuildMemberRemove>
|
||||||
|
|
||||||
return await _channelApi.CreateMessageWithEmbedResultAsync(
|
return await _channelApi.CreateMessageWithEmbedResultAsync(
|
||||||
GuildSettings.WelcomeMessagesChannel.Get(cfg), embedResult: embed,
|
GuildSettings.WelcomeMessagesChannel.Get(cfg), embedResult: embed,
|
||||||
allowedMentions: Octobot.NoMentions, ct: ct);
|
allowedMentions: Utility.NoMentions, ct: ct);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,12 +1,12 @@
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Octobot.Data;
|
|
||||||
using Octobot.Services;
|
|
||||||
using Remora.Discord.API.Abstractions.Gateway.Events;
|
using Remora.Discord.API.Abstractions.Gateway.Events;
|
||||||
using Remora.Discord.Gateway.Responders;
|
using Remora.Discord.Gateway.Responders;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
using TeamOctolings.Octobot.Data;
|
||||||
|
using TeamOctolings.Octobot.Services;
|
||||||
|
|
||||||
namespace Octobot.Responders;
|
namespace TeamOctolings.Octobot.Responders;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles removing guild ID from <see cref="GuildData" /> if the guild becomes unavailable.
|
/// Handles removing guild ID from <see cref="GuildData" /> if the guild becomes unavailable.
|
|
@ -1,8 +1,5 @@
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Octobot.Data;
|
|
||||||
using Octobot.Extensions;
|
|
||||||
using Octobot.Services;
|
|
||||||
using Remora.Discord.API.Abstractions.Gateway.Events;
|
using Remora.Discord.API.Abstractions.Gateway.Events;
|
||||||
using Remora.Discord.API.Abstractions.Objects;
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
using Remora.Discord.API.Abstractions.Rest;
|
using Remora.Discord.API.Abstractions.Rest;
|
||||||
|
@ -10,8 +7,11 @@ using Remora.Discord.Extensions.Embeds;
|
||||||
using Remora.Discord.Extensions.Formatting;
|
using Remora.Discord.Extensions.Formatting;
|
||||||
using Remora.Discord.Gateway.Responders;
|
using Remora.Discord.Gateway.Responders;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
using TeamOctolings.Octobot.Data;
|
||||||
|
using TeamOctolings.Octobot.Extensions;
|
||||||
|
using TeamOctolings.Octobot.Services;
|
||||||
|
|
||||||
namespace Octobot.Responders;
|
namespace TeamOctolings.Octobot.Responders;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles logging the contents of a deleted message and the user who deleted the message
|
/// Handles logging the contents of a deleted message and the user who deleted the message
|
||||||
|
@ -102,6 +102,6 @@ public class MessageDeletedResponder : IResponder<IMessageDelete>
|
||||||
|
|
||||||
return await _channelApi.CreateMessageWithEmbedResultAsync(
|
return await _channelApi.CreateMessageWithEmbedResultAsync(
|
||||||
GuildSettings.PrivateFeedbackChannel.Get(cfg), embedResult: embed,
|
GuildSettings.PrivateFeedbackChannel.Get(cfg), embedResult: embed,
|
||||||
allowedMentions: Octobot.NoMentions, ct: ct);
|
allowedMentions: Utility.NoMentions, ct: ct);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,6 @@
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using DiffPlex.DiffBuilder;
|
using DiffPlex.DiffBuilder;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Octobot.Data;
|
|
||||||
using Octobot.Extensions;
|
|
||||||
using Octobot.Services;
|
|
||||||
using Remora.Discord.API.Abstractions.Gateway.Events;
|
using Remora.Discord.API.Abstractions.Gateway.Events;
|
||||||
using Remora.Discord.API.Abstractions.Objects;
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
using Remora.Discord.API.Abstractions.Rest;
|
using Remora.Discord.API.Abstractions.Rest;
|
||||||
|
@ -12,8 +9,11 @@ using Remora.Discord.Caching.Services;
|
||||||
using Remora.Discord.Extensions.Embeds;
|
using Remora.Discord.Extensions.Embeds;
|
||||||
using Remora.Discord.Gateway.Responders;
|
using Remora.Discord.Gateway.Responders;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
using TeamOctolings.Octobot.Data;
|
||||||
|
using TeamOctolings.Octobot.Extensions;
|
||||||
|
using TeamOctolings.Octobot.Services;
|
||||||
|
|
||||||
namespace Octobot.Responders;
|
namespace TeamOctolings.Octobot.Responders;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles logging the difference between an edited message's old and new content
|
/// Handles logging the difference between an edited message's old and new content
|
||||||
|
@ -104,6 +104,6 @@ public class MessageEditedResponder : IResponder<IMessageUpdate>
|
||||||
|
|
||||||
return await _channelApi.CreateMessageWithEmbedResultAsync(
|
return await _channelApi.CreateMessageWithEmbedResultAsync(
|
||||||
GuildSettings.PrivateFeedbackChannel.Get(cfg), embedResult: embed,
|
GuildSettings.PrivateFeedbackChannel.Get(cfg), embedResult: embed,
|
||||||
allowedMentions: Octobot.NoMentions, ct: ct);
|
allowedMentions: Utility.NoMentions, ct: ct);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,7 +5,7 @@ using Remora.Discord.Gateway.Responders;
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
|
||||||
namespace Octobot.Responders;
|
namespace TeamOctolings.Octobot.Responders;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles sending replies to easter egg messages.
|
/// Handles sending replies to easter egg messages.
|
|
@ -1,11 +1,11 @@
|
||||||
using Octobot.Data;
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
using Octobot.Extensions;
|
|
||||||
using Remora.Discord.API.Abstractions.Objects;
|
|
||||||
using Remora.Discord.API.Abstractions.Rest;
|
using Remora.Discord.API.Abstractions.Rest;
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
using TeamOctolings.Octobot.Data;
|
||||||
|
using TeamOctolings.Octobot.Extensions;
|
||||||
|
|
||||||
namespace Octobot.Services;
|
namespace TeamOctolings.Octobot.Services;
|
||||||
|
|
||||||
public sealed class AccessControlService
|
public sealed class AccessControlService
|
||||||
{
|
{
|
|
@ -3,10 +3,10 @@ using System.Text.Json;
|
||||||
using System.Text.Json.Nodes;
|
using System.Text.Json.Nodes;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Octobot.Data;
|
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
|
using TeamOctolings.Octobot.Data;
|
||||||
|
|
||||||
namespace Octobot.Services;
|
namespace TeamOctolings.Octobot.Services;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles saving, loading, initializing and providing <see cref="GuildData" />.
|
/// Handles saving, loading, initializing and providing <see cref="GuildData" />.
|
|
@ -2,16 +2,16 @@ using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Octobot.Data;
|
|
||||||
using Octobot.Extensions;
|
|
||||||
using Remora.Discord.API.Abstractions.Objects;
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
using Remora.Discord.API.Abstractions.Rest;
|
using Remora.Discord.API.Abstractions.Rest;
|
||||||
using Remora.Discord.Extensions.Embeds;
|
using Remora.Discord.Extensions.Embeds;
|
||||||
using Remora.Discord.Extensions.Formatting;
|
using Remora.Discord.Extensions.Formatting;
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
using TeamOctolings.Octobot.Data;
|
||||||
|
using TeamOctolings.Octobot.Extensions;
|
||||||
|
|
||||||
namespace Octobot.Services.Update;
|
namespace TeamOctolings.Octobot.Services.Update;
|
||||||
|
|
||||||
public sealed partial class MemberUpdateService : BackgroundService
|
public sealed partial class MemberUpdateService : BackgroundService
|
||||||
{
|
{
|
|
@ -1,8 +1,6 @@
|
||||||
using System.Text.Json.Nodes;
|
using System.Text.Json.Nodes;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Octobot.Data;
|
|
||||||
using Octobot.Extensions;
|
|
||||||
using Remora.Discord.API.Abstractions.Objects;
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
using Remora.Discord.API.Abstractions.Rest;
|
using Remora.Discord.API.Abstractions.Rest;
|
||||||
using Remora.Discord.API.Objects;
|
using Remora.Discord.API.Objects;
|
||||||
|
@ -10,8 +8,10 @@ using Remora.Discord.Extensions.Embeds;
|
||||||
using Remora.Discord.Extensions.Formatting;
|
using Remora.Discord.Extensions.Formatting;
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
using TeamOctolings.Octobot.Data;
|
||||||
|
using TeamOctolings.Octobot.Extensions;
|
||||||
|
|
||||||
namespace Octobot.Services.Update;
|
namespace TeamOctolings.Octobot.Services.Update;
|
||||||
|
|
||||||
public sealed class ScheduledEventUpdateService : BackgroundService
|
public sealed class ScheduledEventUpdateService : BackgroundService
|
||||||
{
|
{
|
|
@ -4,7 +4,7 @@ using Remora.Discord.API.Gateway.Commands;
|
||||||
using Remora.Discord.API.Objects;
|
using Remora.Discord.API.Objects;
|
||||||
using Remora.Discord.Gateway;
|
using Remora.Discord.Gateway;
|
||||||
|
|
||||||
namespace Octobot.Services.Update;
|
namespace TeamOctolings.Octobot.Services.Update;
|
||||||
|
|
||||||
public sealed class SongUpdateService : BackgroundService
|
public sealed class SongUpdateService : BackgroundService
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
<Company>TeamOctolings</Company>
|
<Company>TeamOctolings</Company>
|
||||||
<NeutralLanguage>en</NeutralLanguage>
|
<NeutralLanguage>en</NeutralLanguage>
|
||||||
<Description>A general-purpose Discord bot for moderation written in C#</Description>
|
<Description>A general-purpose Discord bot for moderation written in C#</Description>
|
||||||
<ApplicationIcon>docs/octobot.ico</ApplicationIcon>
|
<ApplicationIcon>../docs/octobot.ico</ApplicationIcon>
|
||||||
<GitVersion>false</GitVersion>
|
<GitVersion>false</GitVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
@ -35,12 +35,12 @@
|
||||||
<PackageReference Include="Serilog.Extensions.Logging.File" Version="3.0.0" />
|
<PackageReference Include="Serilog.Extensions.Logging.File" Version="3.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Update="locale\Messages.resx">
|
<EmbeddedResource Update="Messages.resx">
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
<LastGenOutput>Messages.Designer.cs</LastGenOutput>
|
<LastGenOutput>Messages.Designer.cs</LastGenOutput>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AdditionalFiles Include="CodeAnalysis\BannedSymbols.txt" />
|
<AdditionalFiles Include="..\CodeAnalysis\BannedSymbols.txt" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -1,16 +1,19 @@
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json.Nodes;
|
using System.Text.Json.Nodes;
|
||||||
using Octobot.Data;
|
using Microsoft.Extensions.Logging;
|
||||||
using Octobot.Extensions;
|
|
||||||
using Remora.Discord.API.Abstractions.Objects;
|
using Remora.Discord.API.Abstractions.Objects;
|
||||||
using Remora.Discord.API.Abstractions.Rest;
|
using Remora.Discord.API.Abstractions.Rest;
|
||||||
|
using Remora.Discord.API.Objects;
|
||||||
using Remora.Discord.Extensions.Embeds;
|
using Remora.Discord.Extensions.Embeds;
|
||||||
using Remora.Discord.Extensions.Formatting;
|
using Remora.Discord.Extensions.Formatting;
|
||||||
using Remora.Rest.Core;
|
using Remora.Rest.Core;
|
||||||
using Remora.Results;
|
using Remora.Results;
|
||||||
|
using TeamOctolings.Octobot.Attributes;
|
||||||
|
using TeamOctolings.Octobot.Data;
|
||||||
|
using TeamOctolings.Octobot.Extensions;
|
||||||
|
|
||||||
namespace Octobot.Services;
|
namespace TeamOctolings.Octobot;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides utility methods that cannot be transformed to extension methods because they require usage
|
/// Provides utility methods that cannot be transformed to extension methods because they require usage
|
||||||
|
@ -18,6 +21,9 @@ namespace Octobot.Services;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class Utility
|
public sealed class Utility
|
||||||
{
|
{
|
||||||
|
public static readonly AllowedMentions NoMentions = new(
|
||||||
|
Array.Empty<MentionType>(), Array.Empty<Snowflake>(), Array.Empty<Snowflake>());
|
||||||
|
|
||||||
private readonly IDiscordRestChannelAPI _channelApi;
|
private readonly IDiscordRestChannelAPI _channelApi;
|
||||||
private readonly IDiscordRestGuildScheduledEventAPI _eventApi;
|
private readonly IDiscordRestGuildScheduledEventAPI _eventApi;
|
||||||
private readonly IDiscordRestGuildAPI _guildApi;
|
private readonly IDiscordRestGuildAPI _guildApi;
|
||||||
|
@ -30,6 +36,9 @@ public sealed class Utility
|
||||||
_guildApi = guildApi;
|
_guildApi = guildApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[StaticCallersOnly]
|
||||||
|
public static ILogger<Program>? StaticLogger { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the string mentioning the <see cref="GuildSettings.EventNotificationRole" /> and event subscribers related to
|
/// Gets the string mentioning the <see cref="GuildSettings.EventNotificationRole" /> and event subscribers related to
|
||||||
/// a scheduled
|
/// a scheduled
|
Loading…
Reference in a new issue