Beispiel #1
0
        private async Task SendFameMessageAsync(IMessage msg)
        {
            ITextChannel chan = await this.GetOrCreateFameChannelAsync(msg);

            if (chan == null)
            {
                return;
            }

            IGuildUser guildUser = await chan.Guild.GetCurrentUserAsync();

            if (guildUser.GetPermissions(chan).Has(ChannelPermission.ManageWebhooks | ChannelPermission.SendMessages | ChannelPermission.AddReactions))
            {
                IWebhookSenderService webhook = this.ServiceManager.GetService <IWebhookSenderService>("Webhook");
                ulong msgId = await webhook.RepostMessageAsync(chan, msg);

                IUserMessage postedMsg;
                if (msgId == 0)
                {
                    postedMsg = await this.MessageSender.RepostMessageAsync(chan, msg);
                }
                else
                {
                    postedMsg = (IUserMessage)await chan.GetMessageAsync(msgId);
                }

                if (postedMsg != null)
                {
                    await postedMsg.AddReactionAsync(Star2Emote);
                }
            }
        }
Beispiel #2
0
        public BundleNotifierService(IConfiguration config, IWebhookSenderService sender, IScraper scraper)
        {
            _config  = config;
            _sender  = sender;
            _scraper = scraper;

            _timer           = new System.Timers.Timer(_config.GetValue <int>("ScanningInterval"));
            _timer.AutoReset = false;
            _timer.Elapsed  += ScanningLoop;
        }