Merge remote-tracking branch 'origin/main'

# Conflicts:
#	package-lock.json
#	package.json
This commit is contained in:
Anthony Berg 2024-02-03 22:14:50 +00:00
commit 1fa87b8a4a
6 changed files with 57 additions and 39 deletions

View File

@ -34,30 +34,30 @@
"pnpm": ">=8" "pnpm": ">=8"
}, },
"dependencies": { "dependencies": {
"@prisma/client": "^5.7.1", "@prisma/client": "^5.8.1",
"@sapphire/discord.js-utilities": "^7.1.5", "@sapphire/discord.js-utilities": "^7.1.6",
"@sapphire/framework": "^5.0.5", "@sapphire/framework": "^5.0.7",
"@sapphire/plugin-logger": "^4.0.1", "@sapphire/plugin-logger": "^4.0.2",
"@sapphire/plugin-scheduled-tasks": "^10.0.0", "@sapphire/plugin-scheduled-tasks": "^10.0.1",
"@sapphire/plugin-subcommands": "^6.0.2", "@sapphire/plugin-subcommands": "^6.0.3",
"@sapphire/stopwatch": "^1.5.1", "@sapphire/stopwatch": "^1.5.2",
"@sapphire/time-utilities": "^1.7.11", "@sapphire/time-utilities": "^1.7.12",
"@sapphire/ts-config": "^5.0.0", "@sapphire/ts-config": "^5.0.0",
"@sapphire/utilities": "^3.15.1", "@sapphire/utilities": "^3.15.3",
"@types/node": "^20.10.6", "@types/node": "^20.11.7",
"bullmq": "^5.1.1", "bullmq": "^5.1.5",
"discord.js": "^14.14.1", "discord.js": "^14.14.1",
"ioredis": "^5.3.2", "ioredis": "^5.3.2",
"redis": "^4.6.12", "redis": "^4.6.12",
"ts-node": "^10.9.1", "ts-node": "^10.9.2",
"typescript": "^5.3.3" "typescript": "^5.3.3"
}, },
"devDependencies": { "devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.17.0", "@typescript-eslint/eslint-plugin": "^6.19.1",
"@typescript-eslint/parser": "^6.17.0", "@typescript-eslint/parser": "^6.19.1",
"eslint": "8.56.0", "eslint": "8.56.0",
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^9.1.0",
"prettier": "3.2.4", "prettier": "3.2.4",
"prisma": "^5.7.1" "prisma": "^5.8.1"
} }
} }

View File

@ -68,7 +68,7 @@ export class WelcomeButtonHandler extends InteractionHandler {
await general.send( await general.send(
`${member} Welcome to ARA! :D Please check <#${IDs.channels.information.roles}> ` + `${member} Welcome to ARA! :D Please check <#${IDs.channels.information.roles}> ` +
`and remember to follow the <#${IDs.channels.information.conduct}> and to respect ongoing discussion and debates.` + `and remember to follow the <#${IDs.channels.information.conduct}> and to respect ongoing discussions and debates.` +
"\n\nIf you would like to be verified as a vegan, join the 'Verification' voice channel.", "\n\nIf you would like to be verified as a vegan, join the 'Verification' voice channel.",
); );
return; return;

View File

@ -19,7 +19,7 @@
import { ScheduledTask } from '@sapphire/plugin-scheduled-tasks'; import { ScheduledTask } from '@sapphire/plugin-scheduled-tasks';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { TextChannel, EmbedBuilder } from 'discord.js'; import { EmbedBuilder } from 'discord.js';
import { checkBan } from '#utils/database/ban'; import { checkBan } from '#utils/database/ban';
import { checkTempBan, removeTempBan } from '#utils/database/tempBan'; import { checkTempBan, removeTempBan } from '#utils/database/tempBan';
@ -36,7 +36,9 @@ export class TempBan extends ScheduledTask {
// Get the guild where the user is in // Get the guild where the user is in
let guild = this.container.client.guilds.cache.get(payload.guildId); let guild = this.container.client.guilds.cache.get(payload.guildId);
if (guild === undefined) { if (guild === undefined) {
guild = await this.container.client.guilds.fetch(payload.guildId); guild = await this.container.client.guilds
.fetch(payload.guildId)
.catch(() => undefined);
if (guild === undefined) { if (guild === undefined) {
this.container.logger.error('Temp Unban Task: Guild not found!'); this.container.logger.error('Temp Unban Task: Guild not found!');
return; return;
@ -48,7 +50,7 @@ export class TempBan extends ScheduledTask {
let user = guild.client.users.cache.get(userId); let user = guild.client.users.cache.get(userId);
if (user === undefined) { if (user === undefined) {
user = await guild.client.users.fetch(userId); user = await guild.client.users.fetch(userId).catch(() => undefined);
if (user === undefined) { if (user === undefined) {
this.container.logger.error( this.container.logger.error(
'Temp Unban Task: Could not fetch banned user!', 'Temp Unban Task: Could not fetch banned user!',
@ -70,20 +72,27 @@ export class TempBan extends ScheduledTask {
await removeTempBan(userId); await removeTempBan(userId);
// Log unban // Log unban
let logChannel = guild.channels.cache.get(IDs.channels.logs.restricted) as let logChannel = guild.channels.cache.get(IDs.channels.logs.restricted);
| TextChannel
| undefined;
if (logChannel === undefined) { if (logChannel === undefined) {
logChannel = (await guild.channels.fetch( const logChannelFetch = await guild.channels
IDs.channels.logs.restricted, .fetch(IDs.channels.logs.restricted)
)) as TextChannel | undefined; .catch(() => null);
if (logChannel === undefined) { if (logChannelFetch === null) {
this.container.logger.error( this.container.logger.error(
`Temp Ban Listener: Could not fetch log channel. User Snowflake: ${userId}`, `Temp Ban Listener: Could not fetch log channel. User Snowflake: ${userId}`,
); );
return; return;
} }
logChannel = logChannelFetch;
}
if (!logChannel.isTextBased()) {
this.container.logger.error(
'Temp Ban Listener: Log channel is not a text based channel!',
);
return;
} }
const log = new EmbedBuilder() const log = new EmbedBuilder()

View File

@ -17,8 +17,8 @@
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import type { VoiceChannel } from 'discord.js';
import { ScheduledTask } from '@sapphire/plugin-scheduled-tasks'; import { ScheduledTask } from '@sapphire/plugin-scheduled-tasks';
import { ChannelType } from 'discord.js';
export class VerifyTimeout extends ScheduledTask { export class VerifyTimeout extends ScheduledTask {
public constructor( public constructor(
@ -30,17 +30,24 @@ export class VerifyTimeout extends ScheduledTask {
public async run(payload: { channelId: string; userId: string }) { public async run(payload: { channelId: string; userId: string }) {
// Get the guild where the user is in // Get the guild where the user is in
let channel = this.container.client.channels.cache.get( let channel = this.container.client.channels.cache.get(payload.channelId);
payload.channelId,
) as VoiceChannel | undefined;
if (channel === undefined) {
channel = (await this.container.client.channels.fetch(
payload.channelId,
)) as VoiceChannel | undefined;
if (channel === undefined) { if (channel === undefined) {
const channelFetch = await this.container.client.channels
.fetch(payload.channelId)
.catch(() => null);
if (channelFetch === null) {
this.container.logger.error('verifyTimeout: Channel not found!'); this.container.logger.error('verifyTimeout: Channel not found!');
return; return;
} }
channel = channelFetch;
}
if (channel.type !== ChannelType.GuildVoice) {
this.container.logger.error(
'verifyTimeout: Channel is not a voice channel!',
);
return;
} }
if (channel.members.size < 2 && channel.members.has(payload.userId)) { if (channel.members.size < 2 && channel.members.has(payload.userId)) {

View File

@ -32,7 +32,9 @@ export class VerifyUnblock extends ScheduledTask {
// Get the guild where the user is in // Get the guild where the user is in
let guild = this.container.client.guilds.cache.get(payload.guildId); let guild = this.container.client.guilds.cache.get(payload.guildId);
if (guild === undefined) { if (guild === undefined) {
guild = await this.container.client.guilds.fetch(payload.guildId); guild = await this.container.client.guilds
.fetch(payload.guildId)
.catch(() => undefined);
if (guild === undefined) { if (guild === undefined) {
this.container.logger.error('verifyUnblock: Guild not found!'); this.container.logger.error('verifyUnblock: Guild not found!');
return; return;
@ -42,7 +44,7 @@ export class VerifyUnblock extends ScheduledTask {
// Find GuildMember for the user // Find GuildMember for the user
let user = guild.members.cache.get(payload.userId); let user = guild.members.cache.get(payload.userId);
if (user === undefined) { if (user === undefined) {
user = await guild.members.fetch(payload.userId).catch(undefined); user = await guild.members.fetch(payload.userId).catch(() => undefined);
if (user === undefined) { if (user === undefined) {
this.container.logger.error('verifyUnblock: GuildMember not found!'); this.container.logger.error('verifyUnblock: GuildMember not found!');
return; return;

View File

@ -31,7 +31,7 @@
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
"baseUrl": "src" /* Specify the base directory to resolve non-relative module names. */, "baseUrl": "src" /* Specify the base directory to resolve non-relative module names. */,
"paths": { "paths": {
"#utils/*": ["./utils/*"] "#utils/*": ["./utils/*"],
} /* Specify a set of entries that re-map imports to additional lookup locations. */, } /* Specify a set of entries that re-map imports to additional lookup locations. */,
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
@ -79,7 +79,7 @@
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
/* Type Checking */ /* Type Checking */
"strict": true /* Enable all strict type-checking options. */ "strict": true /* Enable all strict type-checking options. */,
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
@ -103,5 +103,5 @@
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
// "skipLibCheck": true /* Skip type checking all .d.ts files. */ // "skipLibCheck": true /* Skip type checking all .d.ts files. */
}, },
"include": ["src"] "include": ["src"],
} }