mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-01-31 09:09:00 +03:00
Merge some sequential 'if' statements (#284)
i thought there would be a lot of statements that could be merged, but these are only ones I could find, apparently Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
a80debf1b1
commit
e0232f6008
2 changed files with 7 additions and 23 deletions
|
@ -74,12 +74,8 @@ public class GuildLoadedResponder : IResponder<IGuildCreate>
|
||||||
_logger.LogInformation("Loaded guild \"{Name}\" ({ID}) owned by {Owner} ({OwnerID}) with {MemberCount} members",
|
_logger.LogInformation("Loaded guild \"{Name}\" ({ID}) owned by {Owner} ({OwnerID}) with {MemberCount} members",
|
||||||
guild.Name, guild.ID, owner.GetTag(), owner.ID, guild.MemberCount);
|
guild.Name, guild.ID, owner.GetTag(), owner.ID, guild.MemberCount);
|
||||||
|
|
||||||
if (!GuildSettings.ReceiveStartupMessages.Get(cfg))
|
if (GuildSettings.PrivateFeedbackChannel.Get(cfg).Empty()
|
||||||
{
|
|| !GuildSettings.ReceiveStartupMessages.Get(cfg))
|
||||||
return Result.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GuildSettings.PrivateFeedbackChannel.Get(cfg).Empty())
|
|
||||||
{
|
{
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,28 +46,16 @@ public class MessageEditedResponder : IResponder<IMessageUpdate>
|
||||||
return new ArgumentNullError(nameof(gatewayEvent.ChannelID));
|
return new ArgumentNullError(nameof(gatewayEvent.ChannelID));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gatewayEvent.GuildID.IsDefined(out var guildId))
|
if (!gatewayEvent.GuildID.IsDefined(out var guildId)
|
||||||
{
|
|| !gatewayEvent.Author.IsDefined(out var author)
|
||||||
return Result.Success;
|
|| !gatewayEvent.EditedTimestamp.IsDefined(out var timestamp)
|
||||||
}
|
|| !gatewayEvent.Content.IsDefined(out var newContent))
|
||||||
|
|
||||||
if (gatewayEvent.Author.IsDefined(out var author) && author.IsBot.OrDefault(false))
|
|
||||||
{
|
|
||||||
return Result.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gatewayEvent.EditedTimestamp.IsDefined(out var timestamp))
|
|
||||||
{
|
|
||||||
return Result.Success; // The message wasn't actually edited
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gatewayEvent.Content.IsDefined(out var newContent))
|
|
||||||
{
|
{
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
var cfg = await _guildData.GetSettings(guildId, ct);
|
var cfg = await _guildData.GetSettings(guildId, ct);
|
||||||
if (GuildSettings.PrivateFeedbackChannel.Get(cfg).Empty())
|
if (author.IsBot.OrDefault(false) || GuildSettings.PrivateFeedbackChannel.Get(cfg).Empty())
|
||||||
{
|
{
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue