查找网络挂钩

时间:2020-11-06 12:55:44

标签: discord.js

我有以下代码:

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?

0 个答案:

没有答案