Skip to content

How to read message in a channel from a server that not your own but you're invited. #5199

Closed Locked Answered by Androz2091
anvu03 asked this question in Q&A
Discussion options

You must be logged in to vote

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');

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@anvu03
Comment options

@Androz2091
Comment options

Answer selected by iCrawl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants