Example #1
0
        private async Task SendResponseToStudent(ITurnContext context, string studentId, string teacherId, string command)
        {
            var client = new DirectLineClient(Configuration[Constants.DirectLineSecretIndex]);

            var activity = new Activity
            {
                Type = Constants.ActivityTypes.MyProactive,
                From = new ChannelAccount("MAI-AI-Teachers-Bot"),
                Text = $"{command} {studentId}"
            };

            await client.SendActivityAsync(activity);

            string text    = null;
            var    student = await DatabaseProvider.GetStudent(studentId);

            switch (command)
            {
            case Constants.AcceptStudentCommand:
                text = "подтвержден";
                student.UpdateLastVisit(true);
                await DatabaseProvider.UpdateStudent(student);

                break;

            case Constants.DeclineStudentCommand:
                text = "отклонен";
                break;
            }

            await context.SendActivity($"{student.Name} ({student.Group}) {text}.");
        }
Example #2
0
        private async Task NotifyStudent(ITurnContext context, string studentId, string teacherId)
        {
            var client = new DirectLineClient(Configuration[Constants.DirectLineSecretIndex]);

            var activity = new Activity
            {
                Type = Constants.ActivityTypes.MyProactive,
                From = new ChannelAccount("MAI-AI-Teachers-Bot"),
                Text = $"{Constants.NotifyStudentCommand} {teacherId} {studentId} \"{DateTime.Now}\""
            };

            await client.SendActivityAsync(activity);
        }
Example #3
0
        private async Task NotifyTeacher(ITurnContext context, string studentId, string teacherId)
        {
            var teacher = await DatabaseProvider.GetStudent(teacherId);

            var client = new DirectLineClient(Configuration[Constants.DirectLineSecretIndex]);

            var activity = new Activity
            {
                Type = Constants.ActivityTypes.MyProactive,
                From = new ChannelAccount("MAI-AI-Students-Bot"),
                Text = $"{Constants.NotifyTeacherCommand} {teacherId} {studentId}"
            };

            await client.SendActivityAsync(activity);
        }