How to send a message to a different server | Discord Bot

跟風遠走 提交于 2019-12-13 03:02:48

问题


I am very curious because I have seen other bots do this, the food bot command would be: "!Order" and then it would send another embed to a different server and a specific channel. How do I code that?


回答1:


You can get a guild and then get a channel from the guild.

client.guilds.get(<guild id>).channels.get(<channel id>).send(<message>)

Notice this requires the bot to be in both guilds



来源:https://stackoverflow.com/questions/51112006/how-to-send-a-message-to-a-different-server-discord-bot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!