TeamOctolings / Octobot

A general-purpose Discord bot for moderation written in C#

Home Page:https://teamoctolings.github.io/Octobot/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exception when specifying invalid setting value for /editsettings

Octol1ttle opened this issue · comments

Description

Trying to use the /editsetting slash command and providing a setting which doesn't exist will throw an exception instead of forwarding the error to the user

Reproduction Steps

Try using /editsetting and provide gibberish as the setting argument

Expected behavior

The user will receive a feedback message telling them that the option they are trying to edit does not exist

Actual behavior

An exception is thrown and a response is never sent

Known Workarounds

No response

Configuration

Среда выполнения:
OS Name: arch
OS Version:
OS Platform: Linux
RID: arch-x64
Base Path: /usr/share/dotnet/sdk/7.0.110/

Host:
Version: 7.0.10
Architecture: x64
Commit: a6dbb800a4

Other information

Exception:

fail: Boyfriend.Commands.Events.ErrorLoggingPostExecutionEvent[0]
      Error in slash command execution for /settings.
      System.InvalidOperationException: Sequence contains no matching element
         at System.Linq.ThrowHelper.ThrowNoMatchException()
         at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
         at Boyfriend.Commands.SettingsCommandGroup.EditSettingAsync(String setting, String value, GuildData data, Snowflake channelId, IUser user, IUser currentUser, CancellationToken ct) in C:\Users\Octol1ttle\IdeaProjects\Boyfriend\src\Commands\SettingsCommandGroup.cs:line 192
         at Boyfriend.Commands.SettingsCommandGroup.ExecuteSettingsAsync(String setting, String value) in C:\Users\Octol1ttle\IdeaProjects\Boyfriend\src\Commands\SettingsCommandGroup.cs:line 185
         at Remora.Commands.Services.CommandService.TryExecuteAsync(PreparedCommand preparedCommand, IServiceProvider services, CancellationToken ct)

(line numbers may be off because this was received from the production instance running in Release configuration)