예제 #1
0
        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());
        }
예제 #2
0
        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);
                }
            }
        }
예제 #3
0
 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.");
     }
 }
예제 #4
0
        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.");
            }
        }
예제 #5
0
        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);
        }
예제 #6
0
 private async Task VersionCommand(MessageCreateEventArgs e)
 {
     string text = "Version: " + DiscordText.BigText(OpBotUtils.GetVersionText());
     await e.Channel.SendMessageAsync(text);
 }