diff options
Diffstat (limited to 'bot/src/commands')
| -rw-r--r-- | bot/src/commands/about.js | 14 | ||||
| -rw-r--r-- | bot/src/commands/ask.js | 33 | ||||
| -rw-r--r-- | bot/src/commands/avatar.js | 22 | ||||
| -rw-r--r-- | bot/src/commands/info.js | 21 | ||||
| -rw-r--r-- | bot/src/commands/ping.js | 1 | ||||
| -rw-r--r-- | bot/src/commands/uptime.js | 25 |
6 files changed, 109 insertions, 7 deletions
diff --git a/bot/src/commands/about.js b/bot/src/commands/about.js index 9983857..c75391a 100644 --- a/bot/src/commands/about.js +++ b/bot/src/commands/about.js @@ -5,21 +5,21 @@ import { SlashCommandBuilder, ButtonStyle } from 'discord.js'; -import { readFileSync } from "node:fs"; +import { readFileSync } from 'node:fs'; const { version } = JSON.parse(readFileSync('./package.json', 'utf-8')); export default { data: new SlashCommandBuilder() .setName('about') - .setDescription('Information about this bot'), + .setDescription('Information about this bot.'), async execute(interaction) { const aboutEmbed = new EmbedBuilder() .setAuthor({ name: `AleeBot ${version}`, iconURL: interaction.client.user.avatarURL() }) .addFields( { name: 'About AleeBot', value: 'AleeBot is an all-in-one bot that\'s made from the Discord.JS API!' }, - { name: 'License', value: 'GNU General Public License v3.0' } - //{ name: 'Contributors', value: '' } + { name: 'License', value: 'GNU General Public License v3.0' }, + { name: 'Contributors', value: '- <@297201585090723841> (Uptime command from 2.x)' } ) .setFooter({ text: '© Copyright 2017-2025 Andrew Lee Projects' }) .setColor('#1fd619'); @@ -29,17 +29,17 @@ export default { new ButtonBuilder() .setStyle(ButtonStyle.Link) .setLabel('Source Code') - .setURL('https://github.com/alee14-projects/AleeBot'), + .setURL('https://github.com/Alee14/AleeBot'), new ButtonBuilder() .setStyle(ButtonStyle.Link) .setLabel('Invite AleeBot') - .setURL('https://discord.com/oauth2/authorize?client_id=282547024547545109&permissions=68185158&scope=bot'), + .setURL('https://discord.com/oauth2/authorize?client_id=282547024547545109'), new ButtonBuilder() .setStyle(ButtonStyle.Link) .setLabel('Join Andrew Lee Projects') .setURL('https://discord.gg/EFhRDqG') ); - return await interaction.reply({embeds: [aboutEmbed], components: [Buttons]}); + return await interaction.reply({ embeds: [aboutEmbed], components: [Buttons] }); } }; diff --git a/bot/src/commands/ask.js b/bot/src/commands/ask.js new file mode 100644 index 0000000..fec0846 --- /dev/null +++ b/bot/src/commands/ask.js @@ -0,0 +1,33 @@ +import { SlashCommandBuilder } from 'discord.js'; + +export default { + data: new SlashCommandBuilder() + .setName('ask') + .setDescription('Ask AleeBot a question.') + .addStringOption(option => + option + .setName('question') + .setDescription('The question you will be asking AleeBot.') + .setRequired(true)), + async execute(interaction) { + const question = interaction.options.getString('question'); + + const answers = [ + 'Yes.', + 'Nope. Just kidding :P', + 'Definitely!', + 'No.', + 'Yep. Just kidding :P', + 'I doubt it.', + 'Maybe?', + 'Perhaps...', + 'I don\'t know?', + 'Can you ask me later? My CPU is overloading.', + 'Hmm let me think :thinking:', + ]; + + return await interaction.reply( + `<@${interaction.user.id}> asked:\n**${question}**\nMy answer:\n**${answers[Math.floor(Math.random() * answers.length)]}**` + ); + } +}; diff --git a/bot/src/commands/avatar.js b/bot/src/commands/avatar.js new file mode 100644 index 0000000..2c3cdeb --- /dev/null +++ b/bot/src/commands/avatar.js @@ -0,0 +1,22 @@ +import { SlashCommandBuilder } from 'discord.js'; + +export default { + data: new SlashCommandBuilder() + .setName('avatar') + .setDescription('Gives the profile picture of the user.') + .addUserOption(option => + option + .setName('username') + .setDescription('The user to get the avatar of.') + .setRequired(false)), + + async execute(interaction) { + const username = interaction.options.getUser('username'); + + if(!username) { + await interaction.reply(interaction.user.avatarURL({ dynamic: true, format: 'png', size: 1024 })); + } else { + await interaction.reply(username.avatarURL({ dynamic: true, format: 'png', size: 1024 })); + } + } +}; diff --git a/bot/src/commands/info.js b/bot/src/commands/info.js new file mode 100644 index 0000000..e9de440 --- /dev/null +++ b/bot/src/commands/info.js @@ -0,0 +1,21 @@ +import { SlashCommandBuilder, EmbedBuilder, version } from 'discord.js'; +import { hostname, platform, release } from 'os'; + +export default { + data: new SlashCommandBuilder() + .setName('info') + .setDescription('Shows information about the host.'), + async execute(interaction) { + const embed = new EmbedBuilder() + .setTitle('Information on AleeBot\'s Host') + .addFields( + { name: 'OS Hostname: ', value: hostname(), inline: true }, + { name: 'NodeJS Version: ', value: process.versions.node, inline: true }, + { name: 'Discord.JS Version: ', value: version, inline: true }, + { name: 'OS Platform: ', value: platform(), inline: true }, + { name: 'OS Version: ', value: release(), inline: true } + ) + .setColor('#1fd619'); + return await interaction.reply({ embeds: [embed] }); + } +}; diff --git a/bot/src/commands/ping.js b/bot/src/commands/ping.js index 996c705..1bb4ccb 100644 --- a/bot/src/commands/ping.js +++ b/bot/src/commands/ping.js @@ -1,4 +1,5 @@ import { SlashCommandBuilder } from 'discord.js'; + export default { data: new SlashCommandBuilder() .setName('ping') diff --git a/bot/src/commands/uptime.js b/bot/src/commands/uptime.js new file mode 100644 index 0000000..f24adad --- /dev/null +++ b/bot/src/commands/uptime.js @@ -0,0 +1,25 @@ +import { SlashCommandBuilder } from 'discord.js'; + +export default { + data: new SlashCommandBuilder() + .setName('uptime') + .setDescription('Shows how long the bot is up for.'), + async execute(interaction) { + let uptime = parseInt(interaction.client.uptime); + uptime = Math.floor(uptime / 1000); + let uptimeMinutes = Math.floor(uptime / 60); + const minutes = uptime % 60; + let hours = 0; + let days = 0; + while (uptimeMinutes >= 60) { + hours++; + uptimeMinutes = uptimeMinutes - 60; + } + while (hours >= 24) { + days++; + hours = hours - 24; + } + const uptimeSeconds = minutes % 60; + return await interaction.reply(`:clock3: AleeBot has been up for ${days} days, ${hours} hours, ${uptimeMinutes} minutes, and ${uptimeSeconds} seconds.`); + } +}; |
