Beispiel #1
0
 public async Task TimeoutUser(ChatUser User, string Reason = "", int Duration = 1)
 {
     PostTimeout postTimeout = new PostTimeout {
         User = User, Channel = Channel, ClientName = Client, Duration = Duration, Reason = Reason
     };
     string message = JsonConvert.SerializeObject(postTimeout);
     await CommonClient.PostAsync(new Uri($"{Url}chat/{CommonClient.Escape(Client)}/{CommonClient.Escape(Channel)}/timeout"), message, HttpClient);
 }
Beispiel #2
0
        public async Task TimeoutUser(HttpContext context)
        {
            var inputDoc = await context.ReadStringAsync();

            PostTimeout postTimeout = JsonConvert.DeserializeObject <PostTimeout>(inputDoc);
            var         client      = postTimeout.ClientName;
            var         user        = postTimeout.User;
            var         reason      = postTimeout.Reason;
            var         duration    = postTimeout.Duration;
            var         channel     = postTimeout.Channel;

            await chatFacade.TimeoutUser(client, user, reason, duration, channel);

            await context.RespondStringAsync(inputDoc);
        }