Beispiel #1
0
        public DiscLogger(ulong discordChannelId, TimeSpan cacheSendDelay)
        {
            DiscordChannelId = discordChannelId;
            Channel          = DClient.GetChannelAsync(discordChannelId).ConfigureAwait(false).GetAwaiter().GetResult();

            TimeSpan defaultDelay = TimeSpan.FromMilliseconds(200);

            if (cacheSendDelay < defaultDelay)
            {
                CacheSendDelay = defaultDelay;
            }
            else
            {
                CacheSendDelay = cacheSendDelay;
            }

            _token = new CancellationTokenSource();
            _task  = new Task(LogTick, _token.Token, TaskCreationOptions.LongRunning);
            _queue = new ConcurrentQueue <string>();

            _task.Start();
        }
Beispiel #2
0
 public static async Task <bool> SendEmbedMessage(this DiscordChannel channel, string message, string title = null)
 {
     return(await DClient.SendEmbedMessageAsync(channel, message, title).ConfigureAwait(false));
 }