How to read message in a channel from a server that not your own but you're invited. #5199
-
Hello, Is there a way to read messages or listen to new messages from a channel that in a server that not your own but you're a member in that channel? Thank you. |
Beta Was this translation helpful? Give feedback.
Answered by
Androz2091
Jan 9, 2021
Replies: 1 comment 2 replies
-
Hello, Yes, the bot can listen to messages on all channels it has access to, even if you're not the owner of the server (if that is your question). So you only need to add it to the server and use the following code: const Discord = require('discord.js');
const client = new Discord.Client();
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('message', msg => {
console.log(`New message received from #${msg.channel.name}!`);
});
client.login('token'); |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
iCrawl
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
Yes, the bot can listen to messages on all channels it has access to, even if you're not the owner of the server (if that is your question). So you only need to add it to the server and use the following code: