Updated editorconfig to (mostly?) require braces around if/else statements, and applied the new formatting rules

This commit is contained in:
Kwoth
2022-02-02 01:44:45 +01:00
parent b22cd5a81e
commit ffa2c3f119
202 changed files with 2108 additions and 920 deletions

View File

@@ -13,13 +13,14 @@ public partial class Gambling
public PlantPickCommands(ILogCommandService logService, GamblingConfigService gss)
: base(gss)
=> this._logService = logService;
=> _logService = logService;
[Cmd]
[RequireContext(ContextType.Guild)]
public async partial Task Pick(string pass = null)
{
if (!string.IsNullOrWhiteSpace(pass) && !pass.IsAlphaNumeric()) return;
if (!string.IsNullOrWhiteSpace(pass) && !pass.IsAlphaNumeric())
return;
var picked = await _service.PickAsync(ctx.Guild.Id, (ITextChannel)ctx.Channel, ctx.User.Id, pass);
@@ -45,7 +46,8 @@ public partial class Gambling
if (amount < 1)
return;
if (!string.IsNullOrWhiteSpace(pass) && !pass.IsAlphaNumeric()) return;
if (!string.IsNullOrWhiteSpace(pass) && !pass.IsAlphaNumeric())
return;
if (((SocketGuild)ctx.Guild).CurrentUser.GuildPermissions.ManageMessages)
{
@@ -59,7 +61,8 @@ public partial class Gambling
ctx.User.ToString(),
amount,
pass);
if (!success) await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
if (!success)
await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
}
[Cmd]

View File

@@ -71,7 +71,10 @@ public class PlantPickService : INService
using var uow = _db.GetDbContext();
var guildConfig = uow.GuildConfigsForId(gid, set => set.Include(gc => gc.GenerateCurrencyChannelIds));
var toAdd = new GCChannelId { ChannelId = cid };
var toAdd = new GCChannelId
{
ChannelId = cid
};
if (!guildConfig.GenerateCurrencyChannelIds.Contains(toAdd))
{
guildConfig.GenerateCurrencyChannelIds.Add(toAdd);
@@ -81,7 +84,8 @@ public class PlantPickService : INService
else
{
var toDelete = guildConfig.GenerateCurrencyChannelIds.FirstOrDefault(x => x.Equals(toAdd));
if (toDelete is not null) uow.Remove(toDelete);
if (toDelete is not null)
uow.Remove(toDelete);
_generationChannels.TryRemove(cid);
enabled = false;
}
@@ -172,7 +176,7 @@ public class PlantPickService : INService
if (!_generationChannels.Contains(channel.Id))
return Task.CompletedTask;
_= Task.Run(async () =>
_ = Task.Run(async () =>
{
try
{
@@ -277,7 +281,7 @@ public class PlantPickService : INService
try
{
// delete all of the plant messages which have just been picked
_= ch.DeleteMessagesAsync(ids);
_ = ch.DeleteMessagesAsync(ids);
}
catch { }