Exemple #1
0
        private IEnumerable <ResponseMessage> ListPingHandler(IncomingMessage message, string matchedHandle)
        {
            string[] users = _pingPlugin.ListPingedUsers();

            yield return(message.ReplyDirectlyToUser("I am currently pinging:"));

            yield return(message.ReplyDirectlyToUser(">>>" + string.Join("\n", users)));
        }
        private async IAsyncEnumerable <ResponseMessage> ListPingHandler(IncomingMessage message, IValidHandle matchedHandle)
        {
            var users = _pingPlugin.ListPingedUsers();

            if (users.Any())
            {
                yield return(await Task.FromResult(message.ReplyDirectlyToUser("I am currently pinging:")));

                yield return(message.ReplyDirectlyToUser(">>>" + string.Join("\n", users)));
            }
            else
            {
                yield return(message.ReplyDirectlyToUser("I am not currently pinging anyone."));
            }
        }