Minor cleanup

This commit is contained in:
Toastie 2024-12-27 00:38:35 +13:00
parent 6ec63eb7a7
commit 4f265f44e2
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4
4 changed files with 6 additions and 23 deletions

View file

@ -4,7 +4,6 @@ using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using DSharpPlus.Commands;
@ -15,9 +14,6 @@ using DSharpPlus.Exceptions;
using DSharpPlus.Interactivity;
using DSharpPlus.Interactivity.Extensions;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Schema;
using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs;
namespace SupportChild.Commands;
@ -261,7 +257,7 @@ public class AdminCommands
{
//NullValueHandling = NullValueHandling.Include,
MissingMemberHandling = MissingMemberHandling.Error,
Error = delegate (object sender, ErrorEventArgs args)
Error = delegate (object sender, Newtonsoft.Json.Serialization.ErrorEventArgs args)
{
// I noticed the main exception mainly has information for developers, not administrators,
// so I switched to using the inner message if available.

View file

@ -2,7 +2,6 @@
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
@ -582,19 +581,13 @@ public static class Interviewer
DiscordChannel channel,
DiscordMessage answerMessage = null)
{
// The error message type should not alter anything about the interview
// The error message type should not alter anything about the interview.
if (nextQuestion.type != QuestionType.ERROR)
{
previousQuestion.answer = answer;
if (answerMessage == null)
{
// The answer was provided using a button or selector
previousQuestion.answerID = 0;
}
else
{
previousQuestion.answerID = answerMessage.Id;
}
// There is no message ID if the question is not a text input.
previousQuestion.answerID = answerMessage == null ? 0 : answerMessage.Id;
}
// Create next question, or finish the interview.
@ -686,7 +679,7 @@ public static class Interviewer
private static async Task DeletePreviousMessages(InterviewQuestion interviewRoot, DiscordChannel channel)
{
List<ulong> previousMessages = new List<ulong> { };
List<ulong> previousMessages = [];
interviewRoot.GetMessageIDs(ref previousMessages);
foreach (ulong previousMessageID in previousMessages)

View file

@ -12,12 +12,7 @@ using DSharpPlus.Commands;
using Microsoft.Extensions.Logging;
using SupportChild.Commands;
using CommandLine;
using DSharpPlus.Commands.ContextChecks;
using DSharpPlus.Commands.EventArgs;
using DSharpPlus.Commands.Exceptions;
using DSharpPlus.Commands.Processors.SlashCommands;
using DSharpPlus.Commands.Processors.TextCommands.Parsing;
using DSharpPlus.Entities;
using DSharpPlus.Exceptions;
using Microsoft.Extensions.DependencyInjection;

View file

@ -42,7 +42,6 @@
<PackageReference Include="JsonExtensions" Version="1.2.0" />
<PackageReference Include="MySqlConnector" Version="2.3.7" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Newtonsoft.Json.Schema" Version="4.0.1" />
<PackageReference Include="Polly" Version="8.4.0" />
<PackageReference Include="RazorBlade" Version="0.6.0" />
<PackageReference Include="Superpower" Version="3.0.0" />