示例#1
0
        public async Task Execute(IJobExecutionContext context)
        {
            var    iogrFetcher = new IOGRFetcher();
            string url         = await iogrFetcher.GetNewSeedPermalink();

            await Scheduler.Owner.PostAnnouncement(url);
        }
示例#2
0
        private async Task MessageReceivedAsync(SocketMessage message)
        {
            if (message.Author.Id == client.CurrentUser.Id ||
                message.Channel.Name != commandListeningChannelName ||
                !message.Content.StartsWith('!'))
            {
                return;
            }

            if (message.Author.Username == "Inno" && message.Content == "!reset")
            {
                currentScore.Reset();
                await message.Author.SendMessageAsync("Scores have been reset");

                return;
            }

            if (message.Author.Username == "Inno" && message.Content == "!sleep")
            {
                await message.Channel.SendMessageAsync("Goodnight!");

                keepAlive = false;
                return;
            }

            string[] instructionWithArguments = message.Content.ToLower().Split(' ');
            if (instructionWithArguments.Length > 0)
            {
                switch (instructionWithArguments[0])
                {
                case "!ping":
                    await message.Channel.SendMessageAsync("pong!");

                    break;

                case "!submit":
                    var time     = instructionWithArguments.ElementAtOrDefault(1);
                    var switches = instructionWithArguments.Skip(2).ToArray();
                    await DoSubmit(message.Author, time, switches);

                    await message.DeleteAsync();

                    break;

                case "!newsfeed":
                    var permalink = await iogrFetcher.GetNewSeedPermalink();

                    await message.Channel.SendMessageAsync(permalink);

                    break;

                case "!help":
                default:
                    await message.Channel.SendMessageAsync(helpText);

                    return;
                }
            }
        }