I am making a discord bot which will send a dm to a particular user if the staff types ",ping<@mentionusername>" so. i want my bot to record its console logs of node.js in a particular channel so that other staff members can also see the logs instead of just the developer? Can anyone share with me the code for it?
Maybe you can create your own log function, or hooking the console.log
function.
Simple way:
function log(msg)
{
console.log(msg);
const channel = member.guild.channels.cache.find(ch => ch.name === 'log');
if (!channel) return;
channel.send(msg);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.