示例#1
0
        public async Task ScheduleTimerResyncAsync()
        {
            var response = await RaidEventsService.ResyncTimer();

            await ReplyAsync(response);
        }
示例#2
0
        public async Task ConfigureServerAsync()
        {
            ulong configChannelId;
            ulong reminderChannelId;

            // config channel
            await ReplyAndDeleteAsync($"Tag the channel you want **configuration** messages sent to (for example, {MentionUtils.MentionChannel(Context.Channel.Id)}).", false, null, TimeSpan.FromMinutes(1));

            var response = await NextMessageAsync(true, true, TimeSpan.FromSeconds(30));

            if (response != null)
            {
                if (response.MentionedChannels.FirstOrDefault() != null)
                {
                    configChannelId = MentionUtils.ParseChannel(response.Content);
                }
                else
                {
                    await ReplyAsync("You didn't correctly tag a channel. Follow the instructions, dingus.");

                    return;
                }
            }
            else
            {
                await ReplyAsync("I didn't get a response in time. Try again.");

                return;
            }


            // reminder channel
            await ReplyAndDeleteAsync($"Tag the channel you want **reminders & the schedule** sent to (for example, {MentionUtils.MentionChannel(Context.Channel.Id)}).", false, null, TimeSpan.FromMinutes(1));

            response = await NextMessageAsync(true, true, TimeSpan.FromSeconds(30));

            if (response != null)
            {
                if (response.MentionedChannels.FirstOrDefault() != null)
                {
                    reminderChannelId = MentionUtils.ParseChannel(response.Content);
                }
                else
                {
                    await ReplyAsync("You didn't correctly tag a channel. Follow the instructions, dingus.");

                    return;
                }
            }
            else
            {
                await ReplyAsync("I didn't get a response in time. Try again.");

                return;
            }

            // build our new server object
            var newServer = new DbDiscordServer()
            {
                ConfigChannelId   = configChannelId.ToString(),
                ReminderChannelId = reminderChannelId.ToString(),
                ServerId          = Context.Guild.Id.ToString(),
                ServerName        = Context.Guild.Name,
                RemindersEnabled  = true
            };

            // add this server's data to the database
            await DatabaseServers.AddServerInfo(newServer);

            // initialize this server
            RaidEventsService.SetServerDiscordObjects(newServer);

            // update the ServerList with the new server
            DbDiscordServers.ServerList.Add(newServer);

            // set up google api authentication
            await AuthAsync();
        }