Beispiel #1
0
        private async Task RunAsync()
        {
            try
            {
                while (true)
                {
                    await Task.Delay(_postEvery);

                    int index    = _random.Next(0, _messages.Count());
                    var selected = _messages.ElementAtOrDefault(index);

                    if (selected == null)
                    {
                        await _log.SendMessageAsync("I couldn't find any messages to swindle <:ShibeSad:231546068960018433>");

                        return;
                    }

                    var mediaIds = await GetMediaIdsAsync(selected);

                    var status = await _twitter.Statuses.UpdateAsync(selected.Resolve(), possibly_sensitive : true, media_ids : mediaIds);

                    await _log.SendMessageAsync("", embed : TwitterHelper.GetPostedEmbed(selected, status.Id));

                    _ = _manager.LogAsync(status.Id, selected, _messages);
                    _messages.Clear();
                }
            }
            catch (Exception ex)
            {
                await PrettyConsole.LogAsync(LogSeverity.Error, "SwindleService", ex.ToString());
            }
        }
Beispiel #2
0
        public async Task ForceAsync(ulong messageId)
        {
            var logGuild = Context.Client.GetGuild(ulong.Parse(_config["log_guild_id"]));
            var log      = logGuild.GetTextChannel(ulong.Parse(_config["log_channel_id"]));
            var msg      = (await Context.Channel.GetMessageAsync(messageId)) as IUserMessage;

            var response = await _twitter.Statuses.UpdateAsync(msg.Resolve(), possibly_sensitive : true);

            await log.SendMessageAsync("", embed : TwitterHelper.GetPostedEmbed(msg, response.Id));
        }