diff --git a/app/bot.js b/app/bot.js index dae6566..7fac887 100644 --- a/app/bot.js +++ b/app/bot.js @@ -1,11 +1,34 @@ -const { Client, GatewayIntentBits } = require("discord.js"); +const loadSlashCommands = require('./slash_commands.js'); +loadSlashCommands(); -const client = new Client({ intents: [GatewayIntentBits.Guilds] }); +const { Client, GatewayIntentBits, ActivityType, Events } = require("discord.js"); -client.once("ready", () => { +const client = new Client({ intents: Object.values(GatewayIntentBits) }); + +client.once("clientReady", () => { console.log(`Bot connecté en tant que ${client.user.tag}`); + client.user.setActivity("LazyBot à votre service !", { type: ActivityType.Custom }); }); + +client.on(Events.InteractionCreate, async interaction => { + if (!interaction.isChatInputCommand()) return; + + if (interaction.commandName === 'ping') { + await interaction.reply('Pong!'); + } +}); + + +client.on(Events.MessageCreate, message => { + if (message.author.bot) return; + const config = global.guildConfigs?.[message.guild.id]; + if (config?.autoMessage) { + message.channel.send(config.autoMessage); + } +}); + + client.login(process.env.BOT_TOKEN); module.exports = client; diff --git a/app/public/guild.html b/app/public/guild.html new file mode 100644 index 0000000..d262847 --- /dev/null +++ b/app/public/guild.html @@ -0,0 +1,49 @@ + + +
+