client.UserJoined += AnnounceJoinedUser; //Hook into the UserJoined event of the client.
这是在依赖关系图下:
public async Task AnnounceJoinedUser(SocketGuildUser user) //Welcomes the new user
{
var channel = client.GetChannel(/*/TextChannelID/*/) as SocketTextChannel; // Gets the channel to send the message in
await channel.SendMessageAsync($"Welcome {user.mention} to {channel.Guild.Name}"); //Welcomes the new user
}
1 回答
您提供的信息很少,但是这里是如何在所有版本中执行此操作(到目前为止):
这是在依赖关系图中,但在“handlecommand”,CommandHandleAsync或HandleCommandAsync下面:
这是在依赖关系图下: