public string GetSummary() { StringBuilder sb = new StringBuilder(512); lock (this) { foreach (Operation op in _operations) { if (op != null) { sb.Append(DiscordText.BigText(op.Id)); sb.Append(' '); sb.Append(op.OperationName); sb.AppendLine(op.Date.ToString(" (dddd)")); } } } return(sb.ToString()); }
private async Task BigTextCommand(MessageCreateEventArgs e, ParsedCommand cmd) { if (!CheckIsAdminUser(e, "BIGTEXT")) { return; } await SafeDeleteMessage(e); for (int k = 1; k < cmd.CommandParts.Length; k++) { DiscordMessage message = await e.Channel.SendMessageAsync(DiscordText.BigText(cmd.CommandParts[k])); if (!cmd.IsPermanent) { _messageDeleter.AddMessage(message, 30000); } } }
private async Task SwtorAvailablePoll_ServersAvailable(ServersAvailableEventArgs e) { using (await _asyncLock.LockAsync()) { if (_swtorAvailablePoll != null) { await EndTwitterPoll(); } } if (e.Expired) { log.Info("Twitter: Poll timed out"); await SendError(e.Channel, "I have stopped monitoring twitter because it has taken too long for the tweet to happen."); } else { log.Info("Twitter: Servers Available"); await e.Channel.SendMessageAsync($"{DiscordText.BigText("servers\navailable")}\nAccording to twitter it looks like the servers might be back up and running. Can't say for sure though, you meat-bags can be very imprecise in your tweets."); } }
private async Task OperationClosed(OperationDeletedEventArgs e) { DiscordChannel channel = null; await _repository.SaveAsync(_ops); try { channel = await _client.GetChannelAsync(_opBotChannelId); DiscordMessage message = await channel.GetMessageAsync(e.MessageId); await message.ModifyAsync($"{DiscordText.NoEntry} {DiscordText.BigText("closed")} {message.Content}"); await message.UnpinAsync(); } catch (NotFoundException) { // do nothing } catch (UnauthorizedException) { await channel.SendMessageAsync("Unable to perform unpin. I need the 'Manage Messages' permission to do so."); } }
private async Task SendOperationErrorMessage(MessageCreateEventArgs e, int operationId) { string text = (operationId == 0) ? "There are no active operations" : $"Operation {DiscordText.BigText(operationId)} does not exist"; await SendError(e, text); }
private async Task VersionCommand(MessageCreateEventArgs e) { string text = "Version: " + DiscordText.BigText(OpBotUtils.GetVersionText()); await e.Channel.SendMessageAsync(text); }