-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
28 lines (23 loc) · 858 Bytes
/
index.js
File metadata and controls
28 lines (23 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const Discord = require("discord.js");
const { getConfig } = require("@confly-dev/confly-js");
const config = require("./config.json");
const client = new Discord.Client({
intents: ["Guilds", "DirectMessages", "GuildMessages", "MessageContent"],
partials: [Discord.Partials.Message, Discord.Partials.Channel],
});
client.on("ready", () => {
console.log(`Logged in as ${client.user.tag}!`);
getConfig(config.confly_token).then((conflyConfig) => {
console.log("Current confly config: ");
console.log(conflyConfig);
});
});
client.on("messageCreate", async (msg) => {
if (msg.author.bot) return;
const conflyConfig = (await getConfig(config.confly_token)).Main.config;
if (!conflyConfig.enabled) return;
if (msg.content === conflyConfig.trigger) {
msg.reply(conflyConfig.response);
}
});
client.login(config.discord_token);