mirror of
https://github.com/veganhacktivists/arabot.git
synced 2025-05-18 09:24:13 +02:00
feat: update deps and breaking changes
This commit is contained in:
parent
fc8c12b346
commit
2fbb6c9265
24
package.json
24
package.json
@ -34,30 +34,30 @@
|
||||
"pnpm": ">=9"
|
||||
},
|
||||
"dependencies": {
|
||||
"@prisma/client": "^5.18.0",
|
||||
"@sapphire/discord.js-utilities": "^7.3.0",
|
||||
"@sapphire/framework": "^5.2.1",
|
||||
"@prisma/client": "^5.22.0",
|
||||
"@sapphire/discord.js-utilities": "^7.3.2",
|
||||
"@sapphire/framework": "^5.3.2",
|
||||
"@sapphire/plugin-logger": "^4.0.2",
|
||||
"@sapphire/plugin-scheduled-tasks": "^10.0.1",
|
||||
"@sapphire/plugin-scheduled-tasks": "^10.0.2",
|
||||
"@sapphire/plugin-subcommands": "^6.0.3",
|
||||
"@sapphire/stopwatch": "^1.5.2",
|
||||
"@sapphire/time-utilities": "^1.7.12",
|
||||
"@sapphire/stopwatch": "^1.5.4",
|
||||
"@sapphire/time-utilities": "^1.7.14",
|
||||
"@sapphire/ts-config": "^5.0.1",
|
||||
"@sapphire/utilities": "^3.17.0",
|
||||
"bullmq": "^5.12.10",
|
||||
"discord.js": "^14.15.3",
|
||||
"ioredis": "^5.4.1",
|
||||
"@sapphire/utilities": "^3.18.1",
|
||||
"bullmq": "^5.34.10",
|
||||
"discord.js": "^14.17.3",
|
||||
"ioredis": "^5.4.2",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "~5.4.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.16.1",
|
||||
"@types/node": "^20.17.13",
|
||||
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
||||
"@typescript-eslint/parser": "^6.21.0",
|
||||
"eslint": "8.56.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"prettier": "3.2.4",
|
||||
"prisma": "^5.18.0"
|
||||
"prisma": "^5.22.0"
|
||||
},
|
||||
"packageManager": "pnpm@9.12.2+sha512.22721b3a11f81661ae1ec68ce1a7b879425a1ca5b991c975b074ac220b187ce56c708fe5db69f4c962c989452eee76c82877f4ee80f474cebd61ee13461b6228"
|
||||
}
|
||||
|
618
pnpm-lock.yaml
generated
618
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
import { Args, Command, RegisterBehavior } from '@sapphire/framework';
|
||||
import type { Message } from 'discord.js';
|
||||
import { Message, MessageFlagsBitField } from 'discord.js';
|
||||
import { ChannelType, TextChannel } from 'discord.js';
|
||||
|
||||
export class AnonymousCommand extends Command {
|
||||
@ -67,8 +67,8 @@ export class AnonymousCommand extends Command {
|
||||
if (guild === null) {
|
||||
await interaction.reply({
|
||||
content: 'Error fetching guild!',
|
||||
ephemeral: true,
|
||||
fetchReply: true,
|
||||
flags: MessageFlagsBitField.Flags.Ephemeral,
|
||||
withResponse: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
@ -77,8 +77,17 @@ export class AnonymousCommand extends Command {
|
||||
if (interaction.channel === null) {
|
||||
await interaction.reply({
|
||||
content: 'Error getting the channel!',
|
||||
ephemeral: true,
|
||||
fetchReply: true,
|
||||
flags: MessageFlagsBitField.Flags.Ephemeral,
|
||||
withResponse: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!interaction.channel.isSendable()) {
|
||||
await interaction.reply({
|
||||
content: `I do not have sufficient permissions to send a message in ${interaction.channel}!`,
|
||||
flags: MessageFlagsBitField.Flags.Ephemeral,
|
||||
withResponse: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
@ -86,8 +95,8 @@ export class AnonymousCommand extends Command {
|
||||
await interaction.channel.send(message);
|
||||
await interaction.reply({
|
||||
content: 'Sent the message',
|
||||
ephemeral: true,
|
||||
fetchReply: true,
|
||||
flags: MessageFlagsBitField.Flags.Ephemeral,
|
||||
withResponse: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
@ -95,8 +104,8 @@ export class AnonymousCommand extends Command {
|
||||
if (channel.type !== ChannelType.GuildText) {
|
||||
await interaction.reply({
|
||||
content: 'Could not send, unsupported text channel!',
|
||||
ephemeral: true,
|
||||
fetchReply: true,
|
||||
flags: MessageFlagsBitField.Flags.Ephemeral,
|
||||
withResponse: true,
|
||||
});
|
||||
}
|
||||
|
||||
@ -105,8 +114,8 @@ export class AnonymousCommand extends Command {
|
||||
|
||||
await interaction.reply({
|
||||
content: 'Sent the message',
|
||||
ephemeral: true,
|
||||
fetchReply: true,
|
||||
flags: MessageFlagsBitField.Flags.Ephemeral,
|
||||
withResponse: true,
|
||||
});
|
||||
}
|
||||
|
||||
@ -121,7 +130,7 @@ export class AnonymousCommand extends Command {
|
||||
return;
|
||||
}
|
||||
|
||||
if (channel.isTextBased()) {
|
||||
if (channel.isSendable()) {
|
||||
await channel.send(text);
|
||||
} else {
|
||||
await message.react('❌');
|
||||
|
@ -30,9 +30,9 @@ import {
|
||||
TextChannel,
|
||||
GuildMember,
|
||||
Snowflake,
|
||||
MessageFlagsBitField,
|
||||
} from 'discord.js';
|
||||
import type { Message } from 'discord.js';
|
||||
import { isMessageInstance } from '@sapphire/discord.js-utilities';
|
||||
import {
|
||||
addSusNoteDB,
|
||||
findNotes,
|
||||
@ -407,16 +407,21 @@ export class SusCommand extends Subcommand {
|
||||
const message = await interaction.reply({
|
||||
embeds: [noteEmbed],
|
||||
components: [buttons],
|
||||
ephemeral: true,
|
||||
fetchReply: true,
|
||||
flags: MessageFlagsBitField.Flags.Ephemeral,
|
||||
withResponse: true,
|
||||
});
|
||||
|
||||
// Checks if the message is not an APIMessage
|
||||
if (!isMessageInstance(message)) {
|
||||
if (message.resource === null) {
|
||||
await interaction.editReply('Failed to retrieve the message :(');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!channel.isSendable()) {
|
||||
await interaction.editReply('Cannot send messages in this channel!');
|
||||
return;
|
||||
}
|
||||
|
||||
// Listen for the button presses
|
||||
const collector = channel.createMessageComponentCollector({
|
||||
max: 1, // Maximum of 1 button press
|
||||
@ -519,8 +524,8 @@ export class SusCommand extends Subcommand {
|
||||
if (guild === null || channel === null) {
|
||||
await interaction.reply({
|
||||
content: 'Error fetching guild or channel!',
|
||||
ephemeral: true,
|
||||
fetchReply: true,
|
||||
flags: MessageFlagsBitField.Flags.Ephemeral,
|
||||
withResponse: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
@ -531,8 +536,8 @@ export class SusCommand extends Subcommand {
|
||||
if (member === undefined) {
|
||||
await interaction.reply({
|
||||
content: 'Error fetching user!',
|
||||
ephemeral: true,
|
||||
fetchReply: true,
|
||||
flags: MessageFlagsBitField.Flags.Ephemeral,
|
||||
withResponse: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
@ -545,8 +550,8 @@ export class SusCommand extends Subcommand {
|
||||
if (notes.length === 0) {
|
||||
await interaction.reply({
|
||||
content: `${user} had no notes!`,
|
||||
ephemeral: true,
|
||||
fetchReply: true,
|
||||
flags: MessageFlagsBitField.Flags.Ephemeral,
|
||||
withResponse: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
@ -596,16 +601,21 @@ export class SusCommand extends Subcommand {
|
||||
const message = await interaction.reply({
|
||||
embeds: [noteEmbed],
|
||||
components: [buttons],
|
||||
ephemeral: true,
|
||||
fetchReply: true,
|
||||
flags: MessageFlagsBitField.Flags.Ephemeral,
|
||||
withResponse: true,
|
||||
});
|
||||
|
||||
// Checks if the message is not an APIMessage
|
||||
if (!isMessageInstance(message)) {
|
||||
if (message.resource === null) {
|
||||
await interaction.editReply('Failed to retrieve the message :(');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!channel.isSendable()) {
|
||||
await interaction.editReply('Cannot send messages in this channel!');
|
||||
return;
|
||||
}
|
||||
|
||||
// Listen for the button presses
|
||||
const collector = channel.createMessageComponentCollector({
|
||||
max: 1, // Maximum of 1 button press
|
||||
|
@ -17,9 +17,8 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { isMessageInstance } from '@sapphire/discord.js-utilities';
|
||||
import { Command } from '@sapphire/framework';
|
||||
import type { Message } from 'discord.js';
|
||||
import { Message, MessageFlagsBitField } from 'discord.js';
|
||||
|
||||
export class PingCommand extends Command {
|
||||
public constructor(context: Command.LoaderContext, options: Command.Options) {
|
||||
@ -41,12 +40,13 @@ export class PingCommand extends Command {
|
||||
public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
|
||||
const msg = await interaction.reply({
|
||||
content: 'Ping?',
|
||||
ephemeral: true,
|
||||
fetchReply: true,
|
||||
flags: MessageFlagsBitField.Flags.Ephemeral,
|
||||
withResponse: true,
|
||||
});
|
||||
|
||||
if (isMessageInstance(msg)) {
|
||||
const diff = msg.createdTimestamp - interaction.createdTimestamp;
|
||||
if (msg.resource !== null && msg.resource.message !== null) {
|
||||
const diff =
|
||||
msg.resource.message.createdTimestamp - interaction.createdTimestamp;
|
||||
const ping = Math.round(this.container.client.ws.ping);
|
||||
return interaction.editReply(
|
||||
`Pong 🏓! (Round trip took: ${diff}ms. Heartbeat: ${ping}ms.)`,
|
||||
@ -57,6 +57,11 @@ export class PingCommand extends Command {
|
||||
}
|
||||
|
||||
public async messageRun(message: Message) {
|
||||
if (!message.channel.isSendable()) {
|
||||
// TODO manage logging/errors properly
|
||||
return;
|
||||
}
|
||||
|
||||
const msg = await message.channel.send('Ping?');
|
||||
|
||||
const diff = msg.createdTimestamp - message.createdTimestamp;
|
||||
|
@ -49,6 +49,11 @@ export class XpListener extends Listener {
|
||||
// If no counts exist on the database, then create the first count from the bot
|
||||
if (lastCount === null) {
|
||||
if (this.container.client.id === null) {
|
||||
if (!message.channel.isSendable()) {
|
||||
// TODO manage logging/errors properly
|
||||
return;
|
||||
}
|
||||
|
||||
message.channel.send(
|
||||
'An unexpected error occurred trying to set up the counting channel, please contact a developer!',
|
||||
);
|
||||
@ -63,6 +68,11 @@ export class XpListener extends Listener {
|
||||
|
||||
lastCount = await getLastCount();
|
||||
if (lastCount === null) {
|
||||
if (!message.channel.isSendable()) {
|
||||
// TODO manage logging/errors properly
|
||||
return;
|
||||
}
|
||||
|
||||
message.channel.send(
|
||||
'An unexpected error occurred, please contact a developer!',
|
||||
);
|
||||
|
@ -83,6 +83,11 @@ export class Suggestions extends Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mailbox.isSendable()) {
|
||||
// TODO manage logging/errors properly
|
||||
return;
|
||||
}
|
||||
|
||||
const sent = await mailbox.send({
|
||||
embeds: [suggestion],
|
||||
content: message.author.toString(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user