【问题标题】:Method Name Expected Discord Bot方法名称预期的 Discord Bot
【发布时间】:2017-07-08 11:42:51
【问题描述】:

当我尝试运行这个极其简单的命令来获取我的不和谐机器人 [见下文] 我收到此错误:CS0149 C# Method name expected 我相信它指的是discord.connect 中的discord。如果有人知道如何解决这个问题,将不胜感激。

命令:

using Discord;
using Discord.Commands;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ImBotOdd
{
    class MyBot
    {
        DiscordClient discord;

        public MyBot()
        {
            discord = new DiscordClient(x =>
            {
                x.LogLevel = LogSeverity.Info;
                x.LogHandler = Log;
            });

            discord.ExecuteAndWait(async () =>
            {
                await discord.Connect("token", TokenType.Bot)("DONT COPY MY TOKEN");


        });
        }

        private void Log(object sender, LogMessageEventArgs e)
        {
            Console.WriteLine(e.Message);
        }
    }
}

【问题讨论】:

  • 我测试了这段代码,它工作正常。您使用的是哪个版本的 discord.net?您使用的是哪个 .NET 框架版本?

标签: c# discord


【解决方案1】:

不知道你修复了没有,好像没有添加

“使用不和谐;”

否则它应该可以工作(在 0.9 上测试)

【讨论】:

    猜你喜欢
    • 2021-11-10
    • 1970-01-01
    • 2017-05-21
    • 1970-01-01
    • 2019-07-31
    • 2018-02-15
    • 2021-03-26
    • 2018-10-11
    • 1970-01-01
    相关资源
    最近更新 更多