0
  public class CommandHandler
    {
        private DiscordSocketClient _client;

        private CommandService _service;
        public CommandHandler(DiscordSocketClient client)
        {
            _client = client;

            _service = new CommandService();



            _service.AddModulesAsync(Assembly.GetEntryAssembly());

            _client.MessageReceived += HandleCommandAsync;
        }
        private async Task HandleCommandAsync(SocketMessage s)
        {
            var msg = s as SocketUserMessage;
            if (msg == null) return;

            var context = new SocketCommandContext(_client, msg);

            int argPos = 0;
            if (msg.HasCharPrefix('!', ref argPos))
            {
                var result = await _service.ExecuteAsync(context, argPos);

                if (!result.IsSuccess && result.Error != CommandError.UnknownCommand)
                {
                    await context.Channel.SendMessageAsync(result.ErrorReason);
                }

            }
        }

    }
}

не знаю как решить данную проблему ибо в с# я 0 объясните простым языком как решить данную проблему

2
  • ну видимо передать правильное количество параметров... 17 янв 2020 в 11:52
  • Откуда ты взял этот код? Возможно дело в версии библиотеки
    – Grundy
    17 янв 2020 в 13:46

0

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Посмотрите другие вопросы с метками или задайте свой вопрос.