我正在为我的Discord服务器创建一个bot。
我的服务器中有一个新的用户通道。当新用户加入时,我想向这个频道发送欢迎消息。但是,我不知道如何才能访问新用户的渠道。
@bot.event
async def on_member_join(member):
# What i should do here?
您可以使用discord。乌提尔斯。获取
或公会。获取频道
。然后您可以通过频道发送消息。send()
。
@bot.event
async def on_member_join(member):
channel = discord.utils.get(member.guild.text_channels, name="the name of the channel the bot will send message to")
await channel.send('A new member joined.')
或
@bot.event
async def on_member_join(member):
channel = member.guild.get_channel(channel id)
await channel.send('A new member joined.')
是否可以通过机器人自动向频道发送
我试图使用Discord JDA API发送消息,但是每当我发送一条消息时,它就会无限地发送。 JDA版本:4.2.1_255 我尝试过什么: 使用GuildMessageReceivedEvent而不是MessageReceivedEvent来研究此问题 伪代码: SendPrivate ateMessage():
我有一个警告脚本,你基本上警告duh,它工作,但每次它发送一个不需要的消息 这是我的剧本 我很确定这是一个错误,但我只是想确定我在这里问过它,任何帮助都是感激的
因此,我用于让bot问候新用户的代码停止工作,我不知道为什么或如何使用这是im用于欢迎活动本身的代码```module.exports=(client)=>{const channelId='757493821251649608'//welcome channel const targetChannelId='757521186929246219'//rules and info }``` 这就是
当a不等于b时,我想通过bot发送自动discord消息。我有其他命令在工作,但它们都需要用户通过discord输入
我在使用discord机器人添加此发送消息时遇到了一个奇怪的错误。我在学习Scratch教程 结果:- `(节点:8480)未经处理的PromisejectionWarning:DiscordAPIError:在C:\Users\Deepanshu\node\u modules\discord处缺少访问权限。js\src\client\rest\RequestHandlers\Sequential