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

@@ -40,13 +40,18 @@ public partial class Administration
}
var role = (IRole)roleResult.BestMatch;
if (role.Position > ((IGuildUser)ctx.User).GetRoles()
.Select(r => r.Position)
.Max()
if (role.Position
> ((IGuildUser)ctx.User).GetRoles()
.Select(r => r.Position)
.Max()
&& ctx.User.Id != ctx.Guild.OwnerId)
return null;
var emote = x.Last().ToIEmote();
return new { role, emote };
return new
{
role,
emote
};
})
.Where(x => x is not null)
.WhenAll();
@@ -59,7 +64,10 @@ public partial class Administration
try
{
await target.AddReactionAsync(x.emote,
new() { RetryMode = RetryMode.Retry502 | RetryMode.RetryRatelimit });
new()
{
RetryMode = RetryMode.Retry502 | RetryMode.RetryRatelimit
});
}
catch (HttpException ex) when (ex.HttpCode == HttpStatusCode.BadRequest)
{
@@ -79,9 +87,10 @@ public partial class Administration
ReactionRoles = all.Select(x =>
{
return new ReactionRole
{
EmoteName = x.emote.ToString(), RoleId = x.role.Id
};
{
EmoteName = x.emote.ToString(),
RoleId = x.role.Id
};
})
.ToList()
}))
@@ -144,7 +153,8 @@ public partial class Administration
{
var ch = g.GetTextChannel(rr.ChannelId);
IUserMessage msg = null;
if (ch is not null) msg = await ch.GetMessageAsync(rr.MessageId) as IUserMessage;
if (ch is not null)
msg = await ch.GetMessageAsync(rr.MessageId) as IUserMessage;
var content = msg?.Content.TrimTo(30) ?? "DELETED!";
embed.AddField($"**{rr.Index + 1}.** {ch?.Name ?? "DELETED!"}",
GetText(strs.reaction_roles_message(rr.ReactionRoles?.Count ?? 0, content)));

View File

@@ -89,7 +89,10 @@ public class RoleCommandsService : INService
var dl = await msg.GetOrDownloadAsync();
await dl.RemoveReactionAsync(reaction.Emote,
dl.Author,
new() { RetryMode = RetryMode.RetryRatelimit | RetryMode.Retry502 });
new()
{
RetryMode = RetryMode.RetryRatelimit | RetryMode.Retry502
});
Log.Warning("User {Author} is adding unrelated reactions to the reaction roles message", dl.Author);
}
});