[英]Can I print the console log of my discord bot into a specific channel in discord.js?
我正在制作一個 discord 機器人,如果員工鍵入“,ping<@mentionusername>”,它將向特定用戶發送 dm。 我希望我的機器人在特定頻道中記錄其 node.js 的控制台日志,以便其他工作人員也可以看到日志,而不僅僅是開發人員? 任何人都可以與我分享它的代碼嗎?
也許您可以創建自己的日志 function,或者掛鈎console.log
function。
簡單的方法:
function log(msg)
{
console.log(msg);
const channel = member.guild.channels.cache.find(ch => ch.name === 'log');
if (!channel) return;
channel.send(msg);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.