[英]How can i send a welcome message with DiscordPy to the standard notification channel?
i want to write a welcome message to the standard welcome-channel on the discord-server, but i don't know how to address it.我想向不和谐服务器上的标准欢迎频道写一条欢迎消息,但我不知道如何解决它。
Normally i would write:通常我会写:
await client.get_channel(Channel_ID).send(f"...")'
But if I implement a specific channel ID, I cannot use the bot on another server.但是如果我实现了一个特定的频道 ID,我就不能在另一台服务器上使用该机器人。 In the server settings I set a "default notification channel".
在服务器设置中,我设置了“默认通知渠道”。 How can I have the messages automatically posted to this channel, no matter on which server the bot is located?
无论机器人位于哪个服务器上,我如何才能将消息自动发布到此频道?
Thanks for you help!谢谢你的帮助!
Using guild.system_channel
使用
guild.system_channel
guild = ctx.message.guild
await guild.system_channel.send("Message")
Mind that guild.system_channel can be None as some servers may not have a default channel where they receive welcome/boost messages请注意 guild.system_channel 可以为 None ,因为某些服务器可能没有默认通道来接收欢迎/增强消息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.