initial commit'

This commit is contained in:
Nemo
2021-11-09 09:34:55 +01:00
parent 6f0c524a0b
commit e685700791
15 changed files with 2569 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
config.json
.env
node_modules
.eslintrc.json
+10
View File
@@ -1,2 +1,12 @@
# Billy
## Suggested Features to add
- a command that says nice things to the user
- a command that challenges the user writing
## Features to update
- Wordwar
- Poll
- Help
+51
View File
@@ -0,0 +1,51 @@
const { SlashCommandBuilder } = require('@discordjs/builders');
const responses = [
"Pas régulièrement.",
"Dans cette économie actuelle ?!",
"On s'en fout, non ?",
"C'est pas faux.",
"Il dit qu'il voit pas le rapport.",
"J'ai pas regardé dans le tiroir ...",
"M'enfin ?!",
"Est ce bien nécessaire ?",
"Ce serait affligeant.",
"Je ne crois pas non.",
"Qu'est ce que t'insinues ?",
"Je demanderais à ma maman.",
"Elle a dit non !",
"Dans une certaine mesure.",
"Avec l'accord du pédiatre !",
"Seulement si tu te laves les mains.",
"Vous pouvez répéter la question ?",
"Bon sang, mais c'est bien sûr !",
"Mais vous êtes fous !",
"Mais evidemment !",
"Bizarrement, oui.",
"Essaye plus tard",
"Essaye encore",
"Une chance sur deux",
"Pas d'avis",
"Repose ta question",
"D'après moi oui ",
"C'est certain",
"Très probable",
"Sans aucun doute",
"Tu peux compter dessus",
"C'est non",
"Peu probable",
"Faut pas rêver",
"N'y compte pas",
"Impossible",
];
module.exports = {
data: new SlashCommandBuilder()
.setName('8ball')
.setDescription('Replies with the right answer. Sometime.'),
async execute(interaction) {
const i = Math.floor(Math.random() * responses.length);
const reply = responses[i];
await interaction.reply(reply);
},
};
+10
View File
@@ -0,0 +1,10 @@
const { SlashCommandBuilder } = require('@discordjs/builders');
module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with Pong!'),
async execute(interaction) {
await interaction.reply('Pong!');
},
};
+19
View File
@@ -0,0 +1,19 @@
const { SlashCommandBuilder, codeBlock } = require('@discordjs/builders');
module.exports = {
data: new SlashCommandBuilder()
.setName('poll')
.setDescription('Sondage')
.addStringOption(option =>
option.setName('question')
.setDescription('La question que vous souhaitez poser aux autres utilisateurs')
.setRequired(true)
),
async execute(interaction) {
const question = interaction.options.get('question').value;
const textReply = "";
console.log(question);
await interaction.reply('Sondage');
},
};
+10
View File
@@ -0,0 +1,10 @@
const { SlashCommandBuilder } = require('@discordjs/builders');
module.exports = {
data: new SlashCommandBuilder()
.setName('randomducul')
.setDescription('Un truc random. Du cul.'),
async execute(interaction) {
await interaction.reply('Pong!');
},
};
+10
View File
@@ -0,0 +1,10 @@
const { SlashCommandBuilder } = require('@discordjs/builders');
module.exports = {
data: new SlashCommandBuilder()
.setName('server')
.setDescription('Replies with Server info!'),
async execute(interaction) {
await interaction.reply(`Server name: ${interaction.guild.name}\nTotal members: ${interaction.guild.memberCount}`);
},
};
+10
View File
@@ -0,0 +1,10 @@
const { SlashCommandBuilder } = require('@discordjs/builders');
module.exports = {
data: new SlashCommandBuilder()
.setName('user')
.setDescription('Replies with User info!'),
async execute(interaction) {
await interaction.reply(`Your tag: ${interaction.user.tag}\nYour id: ${interaction.user.id}`);
},
};
+18
View File
@@ -0,0 +1,18 @@
const fs = require('fs');
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { clientId, guildId, token } = require('./config.json');
const commands = []
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
commands.push(command.data.toJSON());
}
const rest = new REST({ version: '9' }).setToken(token);
rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: commands })
.then(() => console.log('Successfully registered application commands.'))
.catch(console.error);
+7
View File
@@ -0,0 +1,7 @@
module.exports = {
name: 'ready',
once: true,
execute(client) {
console.log(`Ready! Logged in as ${client.user.tag}`);
},
};
+18
View File
@@ -0,0 +1,18 @@
const { WelcomeChannel } = require("discord.js");
const { userMention } = require("@discordjs/builders");
module.exports = {
name: 'guildMemberAdd',
async execute(member, guild) {
await guild.fetchWelcomeScreen()
.then(() => {
const channel = this.welcomeChannels;
channel.forEach(element => {
const nickname = memberNicknameMention(member.id);
await interaction.reply('Bienvenue ' + nickname + ' ! Mets toi à l\'aise, il y a des bières dans le frigo.');
})
})
.catch(console.error);
},
};
+17
View File
@@ -0,0 +1,17 @@
module.exports = {
name: 'interactionCreate',
async execute(interaction) {
if (!interaction.isCommand()) return;
const command = interaction.client.commands.get(interaction.commandName);
if (!command) return;
try {
await command.execute(interaction);
} catch (error) {
console.error(error);
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
} console.log(`${interaction.user.tag} in #${interaction.channel.name} triggered an interaction.`);
},
};
+33
View File
@@ -0,0 +1,33 @@
// Require the necessary discord.js classes
const fs = require('fs');
const { Client, Collection, Intents } = require('discord.js');
const { token } = require('./config.json');
// Create a new client instance
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
// Allow client to keep track of commands so other commands can use them
client.commands = new Collection();
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
// Set a new item in the Collection
// With the key as the command name and the value as the exported module
client.commands.set(command.data.name, command);
}
//keep track of different event handlers in an array, same as commands
const eventFiles = fs.readdirSync('./events').filter(file => file.endsWith('.js'));
for (const file of eventFiles) {
const event = require(`./events/${file}`);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
} else {
client.on(event.name, (...args) => event.execute(...args));
}
}
// Login to Discord with your client's token
client.login(token);
+2328
View File
File diff suppressed because it is too large Load Diff
+24
View File
@@ -0,0 +1,24 @@
{
"name": "billy",
"version": "2.0.0",
"description": "Billy the bot, the most terrible of all the bots",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://git.nemo.click/nemo/Billy.git"
},
"author": "Nemo",
"license": "GPL-3.0-or-later",
"dependencies": {
"@discordjs/builders": "^0.8.2",
"@discordjs/rest": "^0.1.0-canary.0",
"discord-api-types": "^0.24.0",
"discord.js": "^13.3.1"
},
"devDependencies": {
"eslint": "^8.2.0"
}
}