我有以下代码:
const db = require('../data/databaseManager/index.js');
const guildID = require('../structure/config.json').ServerId;
module.exports.logging = function(msg, message,client) {
if (message !== undefined) {
if (message.guild)
var loggingChannel = client.channels.cache.get(db.get(message.guild.id + '.loggingChannel'));
else
var loggingChannel = client.channels.cache.get(db.get(guildID + '.loggingChannel'));
if (loggingChannel) {
loggingChannel.send(msg).catch(() => {return});
}
} else {
var loggingChannel = client.channels.cache.get(db.get(guildID + '.loggingChannel'));
if (loggingChannel) {
loggingChannel.send(msg).catch(() => {return});
}
}
}
目前一切正常,但是我希望它通过Webhook发送。
我该如何继续查找频道上是否已经有一个Webhook,然后在没有现有Webhook的情况下创建一个Webhook?