diff options
| author | Andrew Lee <andrew@alee14.me> | 2025-03-02 22:27:57 -0500 |
|---|---|---|
| committer | Andrew Lee <andrew@alee14.me> | 2025-03-02 22:27:57 -0500 |
| commit | cf1382d88c5e3298923c8cb243b7bc5751e68b53 (patch) | |
| tree | a38351317594ed660fc80c784cdf7dbc71f5656b /bot/src/commands | |
| parent | 1c253d25cb1d35aa987d76e07806999c562712d6 (diff) | |
| download | AleeBot-cf1382d88c5e3298923c8cb243b7bc5751e68b53.tar.gz AleeBot-cf1382d88c5e3298923c8cb243b7bc5751e68b53.tar.bz2 AleeBot-cf1382d88c5e3298923c8cb243b7bc5751e68b53.zip | |
Ported more commands; Made embed colour a const; Cleanup
Diffstat (limited to 'bot/src/commands')
| -rw-r--r-- | bot/src/commands/about.js | 4 | ||||
| -rw-r--r-- | bot/src/commands/avatar.js | 21 | ||||
| -rw-r--r-- | bot/src/commands/info.js | 3 | ||||
| -rw-r--r-- | bot/src/commands/settings.js | 10 | ||||
| -rw-r--r-- | bot/src/commands/userinfo.js | 21 |
5 files changed, 52 insertions, 7 deletions
diff --git a/bot/src/commands/about.js b/bot/src/commands/about.js index c75391a..8d3efab 100644 --- a/bot/src/commands/about.js +++ b/bot/src/commands/about.js @@ -6,6 +6,7 @@ import { ButtonStyle } from 'discord.js'; import { readFileSync } from 'node:fs'; +import { abEmbedColour } from '../storage/consts.js'; const { version } = JSON.parse(readFileSync('./package.json', 'utf-8')); @@ -18,11 +19,12 @@ export default { .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: 'Servers', value: `${interaction.client.guilds.cache.size}` }, { 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'); + .setColor(abEmbedColour); let Buttons = new ActionRowBuilder() .addComponents( diff --git a/bot/src/commands/avatar.js b/bot/src/commands/avatar.js index 2c3cdeb..3d98608 100644 --- a/bot/src/commands/avatar.js +++ b/bot/src/commands/avatar.js @@ -7,16 +7,27 @@ export default { .addUserOption(option => option .setName('username') - .setDescription('The user to get the avatar of.') - .setRequired(false)), + .setDescription('The user to get the avatar of.')) + .addBooleanOption(option => + option + .setName('server') + .setDescription('Gets the member\'s server profile picture.')), async execute(interaction) { const username = interaction.options.getUser('username'); + const server = interaction.options.getBoolean('server'); + + if (username && server) { + const member = interaction.guild.members.cache.get(username.id); + return await interaction.reply(member.avatarURL({ dynamic: true, format: 'png', size: 1024 })); + } else if (server) { + return await interaction.reply(interaction.member.avatarURL({ dynamic: true, format: 'png', size: 1024 })); + } - if(!username) { - await interaction.reply(interaction.user.avatarURL({ dynamic: true, format: 'png', size: 1024 })); + if (!username) { + return await interaction.reply(interaction.user.avatarURL({ dynamic: true, format: 'png', size: 1024 })); } else { - await interaction.reply(username.avatarURL({ dynamic: true, format: 'png', size: 1024 })); + return 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 index e9de440..64d8f7a 100644 --- a/bot/src/commands/info.js +++ b/bot/src/commands/info.js @@ -1,5 +1,6 @@ import { SlashCommandBuilder, EmbedBuilder, version } from 'discord.js'; import { hostname, platform, release } from 'os'; +import { abEmbedColour } from '../storage/consts.js'; export default { data: new SlashCommandBuilder() @@ -15,7 +16,7 @@ export default { { name: 'OS Platform: ', value: platform(), inline: true }, { name: 'OS Version: ', value: release(), inline: true } ) - .setColor('#1fd619'); + .setColor(abEmbedColour); return await interaction.reply({ embeds: [embed] }); } }; diff --git a/bot/src/commands/settings.js b/bot/src/commands/settings.js new file mode 100644 index 0000000..a04d1c2 --- /dev/null +++ b/bot/src/commands/settings.js @@ -0,0 +1,10 @@ +import { SlashCommandBuilder } from 'discord.js'; + +export default { + data: new SlashCommandBuilder() + .setName('settings') + .setDescription('User settings for AleeBot.'), + async execute(interaction) { + return await interaction.reply(`**PONG!** :ping_pong: ${Math.round(interaction.client.ws.ping)} ms`); + } +}; diff --git a/bot/src/commands/userinfo.js b/bot/src/commands/userinfo.js new file mode 100644 index 0000000..01b7577 --- /dev/null +++ b/bot/src/commands/userinfo.js @@ -0,0 +1,21 @@ +import { SlashCommandBuilder, EmbedBuilder } from 'discord.js'; +import { abEmbedColour } from '../storage/consts.js'; + +export default { + data: new SlashCommandBuilder() + .setName('userinfo') + .setDescription('Information about a user.'), + async execute(interaction) { + const userEmbed = new EmbedBuilder() + .setAuthor({ name: interaction.user.tag, iconURL: interaction.user.avatarURL() }) + .setDescription('User Information') + .setThumbnail(interaction.user.avatarURL()) + .addFields( + { name: 'Names', value: `**Display Name:** ${interaction.member.displayName}\n**Username:** ${interaction.user.username}`}, + { name: 'Identity', value: `**User ID:** ${interaction.user.id}` }, + { name: 'Create and Join Times', value: `**Created At:** ${interaction.member.user.createdAt.toUTCString()}\n**Joined Guild At:** ${interaction.member.joinedAt.toUTCString()}`} + ) + .setColor(abEmbedColour); + return await interaction.reply({embeds: [userEmbed]}); + } +}; |
