1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-05-23 14:01:37 +03:00
This commit is contained in:
mctaylors 2022-10-22 15:25:32 +03:00
commit 6b36e2c310
10 changed files with 475 additions and 34 deletions

View file

@ -26,8 +26,8 @@ public sealed class MuteCommand : ICommand {
var rolesRemoved = Boyfriend.GetRemovedRoles(cmd.Context.Guild.Id);
if (rolesRemoved.ContainsKey(toMute.Id)) {
foreach (var roleId in rolesRemoved[toMute.Id]) await toMute.AddRoleAsync(roleId);
if (rolesRemoved.TryGetValue(toMute.Id, out var mutedRemovedRoles)) {
foreach (var roleId in mutedRemovedRoles) await toMute.AddRoleAsync(roleId);
rolesRemoved.Remove(toMute.Id);
cmd.ConfigWriteScheduled = true;
cmd.Reply(Messages.RolesReturned, ":warning: ");

View file

@ -110,10 +110,9 @@ public sealed class SettingsCommand : ICommand {
};
if (value is "reset" or "default") {
if (selectedSetting is "WelcomeMessage")
config[selectedSetting] = Messages.DefaultWelcomeMessage;
else
config[selectedSetting] = Boyfriend.DefaultConfig[selectedSetting];
config[selectedSetting] = selectedSetting is "WelcomeMessage"
? Messages.DefaultWelcomeMessage
: Boyfriend.DefaultConfig[selectedSetting];
} else {
if (value == config[selectedSetting]) {
cmd.Reply(string.Format(Messages.SettingsNothingChanged, localizedSelectedSetting, formattedValue),

View file

@ -23,8 +23,8 @@ public sealed class UnmuteCommand : ICommand {
if (role != null && toUnmute.Roles.Contains(role)) {
var rolesRemoved = Boyfriend.GetRemovedRoles(cmd.Context.Guild.Id);
if (rolesRemoved.ContainsKey(toUnmute.Id)) {
await toUnmute.AddRolesAsync(rolesRemoved[toUnmute.Id]);
if (rolesRemoved.TryGetValue(toUnmute.Id, out var unmutedRemovedRoles)) {
await toUnmute.AddRolesAsync(unmutedRemovedRoles);
rolesRemoved.Remove(toUnmute.Id);
cmd.ConfigWriteScheduled = true;
}