aboutsummaryrefslogtreecommitdiff
path: root/bot/src/commands
diff options
context:
space:
mode:
authorAndrew Lee <andrew@alee14.me>2025-03-08 00:11:03 -0500
committerAndrew Lee <andrew@alee14.me>2025-03-08 00:11:03 -0500
commit52f8826e526f0c0aadb86c3e29975aef4dc1ab85 (patch)
tree910308d13df0e139dd18eb10fcbb92c014d9caef /bot/src/commands
parentc921e5cf8862def58029bd1801074c51113f86ae (diff)
downloadAleeBot-52f8826e526f0c0aadb86c3e29975aef4dc1ab85.tar.gz
AleeBot-52f8826e526f0c0aadb86c3e29975aef4dc1ab85.tar.bz2
AleeBot-52f8826e526f0c0aadb86c3e29975aef4dc1ab85.zip
Bulk delete message event; Guild suggestions; sinfo + uinfo
Diffstat (limited to 'bot/src/commands')
-rw-r--r--bot/src/commands/quote.js2
-rw-r--r--bot/src/commands/serverinfo.js15
-rw-r--r--bot/src/commands/settings.js2
-rw-r--r--bot/src/commands/suggest.js46
-rw-r--r--bot/src/commands/userinfo.js14
5 files changed, 63 insertions, 16 deletions
diff --git a/bot/src/commands/quote.js b/bot/src/commands/quote.js
index 3ae1de3..5e5ae5b 100644
--- a/bot/src/commands/quote.js
+++ b/bot/src/commands/quote.js
@@ -110,6 +110,8 @@ export default {
if (!quoteID) {
const quoteList = await quoteDB.findAll({ attributes: ['id'] });
const random = crypto.getRandomValues(new Uint32Array(1));
+
+ if (quoteList.length === 0) return await interaction.reply({ content: 'No quotes are currently in the database. You can add one by doing `/quote add`.', flags: MessageFlags.Ephemeral });
quoteID = quoteList[random[0] % quoteList.length].id;
}
diff --git a/bot/src/commands/serverinfo.js b/bot/src/commands/serverinfo.js
index 01b39e8..480087d 100644
--- a/bot/src/commands/serverinfo.js
+++ b/bot/src/commands/serverinfo.js
@@ -6,25 +6,26 @@ export default {
.setName('serverinfo')
.setDescription('Information about this server.'),
async execute(interaction) {
- // const listedChannels = [];
+ // let listedChannels = [];
let guildOwner = await interaction.guild.fetchOwner();
let memberCountNoBots = await interaction.guild.members.fetch().then((members) => members.filter(member => !member.user.bot).size);
+ // interaction.guild.channels.cache.each(channel => {
+ // listedChannels.push(channel);
+ // });
+
const serverEmbed = new EmbedBuilder()
.setAuthor({ name: `${interaction.guild.name}`, iconURL: interaction.guild.iconURL() })
.setDescription('Server Information')
.setThumbnail(interaction.guild.iconURL())
.addFields(
- { name: 'Main Information', value: `**Server Name:** ${interaction.guild.name}\n**Server ID:** ${interaction.guild.id}\n**Server Owner:** ${guildOwner.user.tag}`},
+ { name: 'Main Information', value: `**Server Name:** ${interaction.guild.name}\n**Server ID:** ${interaction.guild.id}\n**Server Owner:** ${guildOwner.user.username}`},
{ name: 'Join Dates', value: `**Created At:** ${interaction.guild.createdAt.toUTCString()}\n**AleeBot Joined:** ${interaction.guild.joinedAt.toUTCString()}`},
+ { name: 'Total Channels (without threads)', value: `${interaction.guild.channels.channelCountWithoutThreads}` },
+ // { name: 'Channels', value: listedChannels.join(' ') },
{ name: 'Total Members (with bots)', value: `${interaction.guild.memberCount}` },
{ name: 'Total Members (without bots)', value: `${memberCountNoBots}` }
)
- /*message.guild.channels.cacheType.forEach(channel => {
- listedChannels.push(channel)
- })*/
- //.addField('Channels', `${listedChannels.join('\n')}`)
- //.addField('Total Channels', message.guild.channelCountMode)
.setColor(abEmbedColour);
return await interaction.reply({ embeds: [serverEmbed] });
}
diff --git a/bot/src/commands/settings.js b/bot/src/commands/settings.js
index 5fdf0cd..88e108d 100644
--- a/bot/src/commands/settings.js
+++ b/bot/src/commands/settings.js
@@ -115,8 +115,8 @@ export default {
const logSetting = await guildSettings.findOne({ where: { guildID: interaction.guild.id } });
guildEmbed.spliceFields(0, 1, { name: 'Logging', value: logSetting?.logChannelID ? `<#${logSetting.logChannelID}>` : 'N/A', inline: true });
-
await interaction.editReply({ embeds: [guildEmbed], components: [row] });
+
await interaction.deleteReply();
}
diff --git a/bot/src/commands/suggest.js b/bot/src/commands/suggest.js
index e4bed85..7bb91e2 100644
--- a/bot/src/commands/suggest.js
+++ b/bot/src/commands/suggest.js
@@ -8,6 +8,7 @@ import {
EmbedBuilder
} from 'discord.js';
import { abEmbedColour, featureSuggestChannel } from '../storage/consts.js';
+import { guildSettings } from '../models/guild-settings.js';
export default {
data: new SlashCommandBuilder()
@@ -50,7 +51,7 @@ export default {
new EmbedBuilder()
.setTitle('AleeBot Feature Suggestion')
.setDescription(`This is an AleeBot feature suggested from ${modalInteraction.user.username}.`)
- .addFields({ name: 'Suggestion Contents', value: feature })
+ .addFields({ name: 'Suggestion Content', value: feature })
.setColor(abEmbedColour)
.setFooter({ text: `Sending from ${modalInteraction.guild.name}`, iconURL: modalInteraction.guild.iconURL() })
]});
@@ -62,5 +63,48 @@ export default {
});
}
+
+ if (interaction.options.getSubcommand() === 'guild') {
+ const guildSetting = await guildSettings.findOne({ where: { guildID: interaction.guild.id } });
+ if (!guildSetting || !guildSetting.suggestionsChannelID) return await interaction.reply({ content: 'This server did not configure to have suggestions enabled.' });
+
+ const modal = new ModalBuilder()
+ .setCustomId(`suggest-${interaction.user.id}`)
+ .setTitle(`Suggestion for ${interaction.guild.name}`);
+
+ const featureText = new TextInputBuilder()
+ .setCustomId('feature')
+ .setLabel('Suggestion')
+ .setMaxLength(200)
+ .setPlaceholder('Feature')
+ .setStyle(TextInputStyle.Paragraph);
+
+ const firstActionRow = new ActionRowBuilder().addComponents(featureText);
+
+ modal.addComponents(firstActionRow);
+
+ await interaction.showModal(modal);
+
+ const filter = (interaction) => interaction.customId === `suggest-${interaction.user.id}`;
+
+ interaction.awaitModalSubmit({ filter, time: 1000 * 1200 })
+ .then(async (modalInteraction) => {
+ const feature = modalInteraction.fields.getTextInputValue('feature');
+
+ modalInteraction.client.channels.cache.get(guildSetting.suggestionsChannelID).send({ embeds: [
+ new EmbedBuilder()
+ .setTitle('Suggestion')
+ .setDescription(`This is a suggestion from ${interaction.user.username}.`)
+ .addFields({ name: 'Suggestion Content', value: feature })
+ .setColor(abEmbedColour)
+ ]});
+
+ return await modalInteraction.reply({content: 'Your suggestion has been sent.', flags: MessageFlags.Ephemeral});
+ })
+ .catch((err) => {
+ console.error(err);
+ });
+
+ }
}
};
diff --git a/bot/src/commands/userinfo.js b/bot/src/commands/userinfo.js
index c079661..0cf7332 100644
--- a/bot/src/commands/userinfo.js
+++ b/bot/src/commands/userinfo.js
@@ -10,16 +10,16 @@ export default {
.setName('username')
.setDescription('The user to get the information of')),
async execute(interaction) {
- const username = interaction.options.getUser('username') || interaction.user;
- const member = interaction.guild.members.cache.get(username.id);
+ const user = interaction.options.getUser('username') || interaction.user;
+ const member = interaction.guild.members.cache.get(user.id);
const userEmbed = new EmbedBuilder()
- .setAuthor({ name: username.tag, iconURL: username.avatarURL() })
+ .setAuthor({ name: user.username, iconURL: user.avatarURL() })
.setDescription('User Information')
- .setThumbnail(username.avatarURL())
+ .setThumbnail(user.avatarURL())
.addFields(
- { name: 'Names', value: `**Display Name:** ${member.displayName}\n**Username:** ${username.username}`},
- { name: 'Identity', value: `**User ID:** ${username.id}` },
- { name: 'Create and Join Times', value: `**Created At:** ${username.createdAt.toUTCString()}\n**Joined Guild At:** ${member.joinedAt.toUTCString()}`}
+ { name: 'Names', value: `**Display Name:** ${member.displayName}\n**Username:** ${user.username}`},
+ { name: 'Identity', value: `**User ID:** ${user.id}` },
+ { name: 'Create and Join Times', value: `**Created At:** ${user.createdAt.toUTCString()}\n**Joined Guild At:** ${member.joinedAt.toUTCString()}`}
)
.setColor(abEmbedColour);
return await interaction.reply({ embeds: [userEmbed] });