这是我的代码,但它不起作用:用户加入时没有消息。我该如何解决这个问题?
public async Task Client_Userjoined()
{
var name = Context.Message.Author.Id;
ulong id = 447147292617736203;
var chnl = Client.GetChannel(id) as IMessageChannel;
await chnl.SendMessageAsync($"Welcome!<@n{name}> ");
}
答案 0 :(得分:0)
以下是[1.0]
中的操作方法这是在依赖关系图中但在“handlecommand”
之下client.UserJoined += AnnounceJoinedUser; //Check if userjoined
这是在依赖关系图
下 public async Task AnnounceJoinedUser(SocketGuildUser user) //welcomes New Players
{
var channel = client.GetChannel(%TextChannelID%) as SocketTextChannel; //gets channel to send message in
await channel.SendMessageAsync("Welcome " + user.Mention + " to the server!"); //Welcomes the new user
}