当我尝试运行discord bot时,它说“消息未定义”

时间:2019-06-09 05:19:44

标签: discord.js

当我尝试运行bot时,它在字符串message.author.kick()中说“消息未定义”

public static void Main(string[] args)
{
    string banner;
    PrintBanner(banner = "This is whats supposed to be printed.");
}
public static void PrintBanner(string text)
{
    // The text variable contains "This is whats supposed to be printed." now.
    // You can perform whatever operations you want with it within this scope,
    // but it won't alter the text the banner variable contains.
}

应该踢出邮件发件人

1 个答案:

答案 0 :(得分:1)

message在任何地方都没有定义。您可以使用msg =>开始作用域,因此msg是消息对象的已定义变量。

message.author.kick();更改为msg.author.kick();