Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
717 views
in Technique[技术] by (71.8m points)

Discord.js Send message to certain guild in a certain channel

I wan't to make my Shards send a message to my test guild when they send a death, reconnecting, disconnected and ready event.

I know I can do it by defining a specific guild using its ID and a channel ID in that guild, but how can this be achieved?

I have no idea and I need your help.

question from:https://stackoverflow.com/questions/65851633/discord-js-send-message-to-certain-guild-in-a-certain-channel

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Something like this should do the job

client.shard.broadcastEval(`this.channels.cache.get("${channelId}")?.send("${message}")`)

https://discord.js.org/#/docs/main/stable/class/ShardClientUtil?scrollTo=broadcastEval


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...