Skip to content

Commit

Permalink
Merge pull request #188 from YilianSource/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
yiliansource authored Oct 10, 2019
2 parents 88d1efc + cc4accb commit c498356
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 32 deletions.
30 changes: 0 additions & 30 deletions BrackeysBot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ private async Task OnReady ()

_ = PeriodicCheckMute(new TimeSpan(TimeSpan.TicksPerHour * 1), CancellationToken.None);
_ = PeriodicCheckBan(new TimeSpan(TimeSpan.TicksPerHour * 1), CancellationToken.None);
_ = PeriodicCheckVideoSuggestions(new TimeSpan(TimeSpan.TicksPerHour * 4), CancellationToken.None);
}

private async Task OnUserJoinedServer(SocketGuildUser arg)
Expand Down Expand Up @@ -291,35 +290,6 @@ public async Task PeriodicCheckBan(TimeSpan interval, CancellationToken cancella
}
}

public async Task PeriodicCheckVideoSuggestions(TimeSpan interval, CancellationToken cancellationToken)
{
if (!Data.Settings.Has("server-id"))
{
Log.WriteLine("Can't initialize the video settings handler: The setting 'server-id' has not been assigned.");
return;
}

ulong guildId = ulong.Parse(Data.Settings["server-id"]);
IGuild mainGuild = _client.GetGuild(guildId);

_videoSuggestionsHandler = new VideoSuggestionsHandler(mainGuild);
await _videoSuggestionsHandler.InitializeAsync();

while (true)
{
bool valid = _videoSuggestionsHandler.IsChannelStateValid();
if (!valid)
{
await _videoSuggestionsHandler.UpdateChannelStateToValid();
}

string FormatValid(bool v) => $"'{(v ? "Valid" : "Invalid")}'";

Log.WriteLine($"Checked VideoSuggestions state and transitioned from state {FormatValid(valid)} to state {FormatValid(_videoSuggestionsHandler.IsChannelStateValid())}.");
await Task.Delay(interval, cancellationToken);
}
}

/// <summary>
/// Registers the handle for a leaderboard navigation event.
/// </summary>
Expand Down
3 changes: 1 addition & 2 deletions Commands/Moderation/ClearCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ public async Task Clear(int amount, [Optional] IGuildUser user)
int clearedMessages = user == null ? amount : count;

IMessage messageToDel = await ReplyAsync($":white_check_mark: Successfully cleared {clearedMessages} messages{((user != null) ? $" sent by {user.GetDisplayName()}" : string.Empty)}.");
_ = messageToDel.TimedDeletion(3000);

await _auditLog.AddEntry($"{(Context.User as IGuildUser).GetDisplayName()} cleared {clearedMessages} messages{((user != null) ? $" sent by {user.GetDisplayName()}" : string.Empty)} in <#{Context.Channel.Id}>.");
await messageToDel.TimedDeletion(3000);
}
}
}
1 change: 1 addition & 0 deletions Modules/CommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ private async Task HandleCommand(SocketMessage s, DiscordSocketClient client)

int argPos = 0;
if (!msg.HasStringPrefix(CommandPrefix, ref argPos)) return;
if (msg.Content.Length - argPos <= 0) return;

IGuildUser author = s.Author as IGuildUser;
CommandContext context = new CommandContext(client, msg);
Expand Down

0 comments on commit c498356

Please sign in to comment.