n8n-nodes-discord-dnd
Version:
n8n node to create triggers for Discord events
102 lines • 4.33 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.getclientOptions = void 0;
const discord_js_1 = require("discord.js");
function getclientOptions(triggerType) {
let intents = [];
let partials = [];
switch (triggerType) {
case "message":
intents = [
discord_js_1.GatewayIntentBits.Guilds,
discord_js_1.GatewayIntentBits.GuildMessages,
discord_js_1.GatewayIntentBits.MessageContent,
discord_js_1.GatewayIntentBits.GuildMessageReactions,
discord_js_1.GatewayIntentBits.GuildMembers,
discord_js_1.GatewayIntentBits.DirectMessages,
discord_js_1.GatewayIntentBits.DirectMessageReactions,
discord_js_1.GatewayIntentBits.DirectMessageTyping,
discord_js_1.GatewayIntentBits.GuildMessageTyping,
];
partials = [
discord_js_1.Partials.User,
discord_js_1.Partials.Channel,
discord_js_1.Partials.Message,
discord_js_1.Partials.Reaction,
discord_js_1.Partials.GuildMember,
];
break;
case "guild":
intents = [discord_js_1.GatewayIntentBits.Guilds, discord_js_1.GatewayIntentBits.GuildMembers];
partials = [discord_js_1.Partials.GuildMember];
break;
case "moderation":
intents = [
discord_js_1.GatewayIntentBits.Guilds,
discord_js_1.GatewayIntentBits.GuildModeration,
discord_js_1.GatewayIntentBits.GuildMembers,
];
partials = [discord_js_1.Partials.GuildMember];
break;
case "emojiSticker":
intents = [discord_js_1.GatewayIntentBits.Guilds, discord_js_1.GatewayIntentBits.GuildExpressions];
partials = [];
break;
case "integrationWebhook":
intents = [
discord_js_1.GatewayIntentBits.Guilds,
discord_js_1.GatewayIntentBits.GuildIntegrations,
discord_js_1.GatewayIntentBits.GuildWebhooks,
];
partials = [];
break;
case "invite":
intents = [discord_js_1.GatewayIntentBits.Guilds, discord_js_1.GatewayIntentBits.GuildInvites];
partials = [];
break;
case "voice":
intents = [discord_js_1.GatewayIntentBits.Guilds, discord_js_1.GatewayIntentBits.GuildVoiceStates];
partials = [];
break;
case "presence":
intents = [discord_js_1.GatewayIntentBits.Guilds, discord_js_1.GatewayIntentBits.GuildPresences];
partials = [discord_js_1.Partials.GuildMember];
break;
case "scheduledEvent":
intents = [
discord_js_1.GatewayIntentBits.Guilds,
discord_js_1.GatewayIntentBits.GuildScheduledEvents,
];
partials = [discord_js_1.Partials.GuildScheduledEvent];
break;
case "interaction":
intents = [discord_js_1.GatewayIntentBits.Guilds, discord_js_1.GatewayIntentBits.GuildIntegrations];
partials = [];
break;
case "botStatus":
intents = [];
partials = [];
break;
case "user":
intents = [discord_js_1.GatewayIntentBits.Guilds, discord_js_1.GatewayIntentBits.GuildMembers];
partials = [discord_js_1.Partials.User, discord_js_1.Partials.GuildMember];
break;
case "autoModeration":
intents = [discord_js_1.GatewayIntentBits.Guilds, discord_js_1.GatewayIntentBits.GuildModeration];
partials = [];
break;
case "poll":
intents = [
discord_js_1.GatewayIntentBits.Guilds,
discord_js_1.GatewayIntentBits.GuildMessages,
discord_js_1.GatewayIntentBits.GuildMessagePolls,
];
partials = [discord_js_1.Partials.Message];
break;
default:
throw new Error(`Unsupported type: ${triggerType}`);
}
return { intents, partials };
}
exports.getclientOptions = getclientOptions;
//# sourceMappingURL=DiscordIntentMapping.js.map
;