Пример #1
0
        private static async Task HandleCustomCommand(string command, SocketCommandContext context, string mentionedUsers, IResult result)
        {
            string response = HassBotCommands.Instance.Lookup(command);

            if (string.Empty != response)
            {
                await Helper.CreateEmbed(
                    context, null, null,
                    string.Format("{0} {1}", mentionedUsers, response));
            }
            else
            {
                if (result.IsSuccess)
                {
                    return;
                }

                // command not found, look it up and see if there are any results.
                string lookupResult = Sitemap.Lookup(command);
                if (string.Empty != lookupResult)
                {
                    await Helper.CreateEmbed(
                        context, null, null,
                        string.Format("{0} {1}", mentionedUsers, lookupResult));
                }
            }
        }
Пример #2
0
        private static async Task HandleCustomCommand(string command, SocketUserMessage message, string mentionedUsers, IResult result)
        {
            CommandDTO cmd = CommandManager.TheCommandManager.GetCommandByName(command);

            if (cmd != null && cmd.CommandData != string.Empty)
            {
                cmd.CommandCount += 1;
                CommandManager.TheCommandManager.UpdateCommand(cmd);
                await message.Channel.SendMessageAsync(mentionedUsers + cmd.CommandData);
            }
            else
            {
                if (result.IsSuccess)
                {
                    return;
                }

                // command not found, look it up and see if there are any results.
                string lookupResult = Sitemap.Lookup(command);
                if (string.Empty != lookupResult)
                {
                    await message.Channel.SendMessageAsync(mentionedUsers + lookupResult);
                }
            }
        }
Пример #3
0
        private static async Task HandleCustomCommand(string command, SocketUserMessage message, string mentionedUsers, IResult result)
        {
            string response = HassBotCommands.Instance.Lookup(command);

            if (string.Empty != response)
            {
                await message.Channel.SendMessageAsync(mentionedUsers + response);
            }
            else
            {
                if (result.IsSuccess)
                {
                    return;
                }

                // command not found, look it up and see if there are any results.
                string lookupResult = Sitemap.Lookup(command);
                if (string.Empty != lookupResult)
                {
                    await message.Channel.SendMessageAsync(mentionedUsers + lookupResult);
                }
            }
        }