Esempio n. 1
0
        public async Task CancelAlarm(CommandContext ctx, string alarmname)
        {
            GuildHandler     handler = KoekoeController.GetGuildHandler(ctx.Client, ctx.Guild);
            List <AlarmData> alarms  = handler.GetAlarms();

            for (int i = 0; i < alarms.Count; i++)
            {
                if (alarms[i].AlarmName == alarmname && alarms[i].userId == ctx.User.Id)
                {
                    alarms.RemoveAt(i);
                    handler.SaveGuildData();
                    await ctx.RespondAsync($"Canceled alarm `{alarmname}`");

                    return;
                }
            }

            await ctx.RespondAsync($"Couldn't find alarm `{alarmname}`");
        }
Esempio n. 2
0
        public async Task ListAlarm(CommandContext ctx, DiscordChannel channel = null)
        {
            GuildHandler handler = KoekoeController.GetGuildHandler(ctx.Client, ctx.Channel.Guild, false);

            if (handler != null)
            {
                List <AlarmData> alarms     = handler.GetAlarms();
                string[]         alarmtexts = new string[alarms.Count];
                for (int i = 0; i < alarmtexts.Length; i++)
                {
                    DiscordMember member = await ctx.Guild.GetMemberAsync(alarms[i].userId);

                    alarmtexts[i] = $"{member.Username}: {alarms[i].AlarmDate.ToShortTimeString()} ({alarms[i].AlarmName})";
                }
                string alarmstext = String.Join("`\n`", alarmtexts);

                await ctx.RespondAsync($"Currently Alarms:\n{alarmstext}");

                return;
            }


            await ctx.RespondAsync($"Currently not registered to any channel, use `!kk register` while in a voice channel to add it.");
        }