Esempio n. 1
0
        public async Task GetSchedule(Interaction interaction, ISupportManagerApi api)
        {
            var schedule = await api.GetTeamSchedule(await interaction.ReadTeam("For which *team* do you want to view the schedule?"));

            var reply = schedule.Any()
                ? string.Join("\n\n", schedule.Select(FormatRegistration))
                : "Nothing scheduled";
            await interaction.Write(reply);
        }
Esempio n. 2
0
        public async Task Delete(ISupportManagerApi api, Interaction interaction)
        {
            var teamId = await interaction.ReadTeam("For which *team* do you want to delete an entry?");

            var forwards = await api.GetTeamSchedule(teamId);

            var id = await interaction.ReadOption("Which entry do you want to delete?",
                                                  forwards.OrderBy(fwd => fwd.When), fwd => $"{fwd.When.ToHumanReadable()} {fwd.User.DisplayName}",
                                                  fwd => fwd.Id);

            var selected = forwards.Single(x => x.Id == id);

            await api.DeleteForward(id);

            await interaction.Write(
                $"Deleted schedule entry *{selected.When.ToHumanReadable()}* {selected.User.DisplayName}.");
        }