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"
},
"dependencies": {
"@prisma/client": "^5.7.1",
"@sapphire/discord.js-utilities": "^7.1.5",
"@sapphire/framework": "^5.0.5",
"@sapphire/plugin-logger": "^4.0.1",
"@sapphire/plugin-scheduled-tasks": "^10.0.0",
"@sapphire/plugin-subcommands": "^6.0.2",
"@sapphire/stopwatch": "^1.5.1",
"@sapphire/time-utilities": "^1.7.11",
"@prisma/client": "^5.8.1",
"@sapphire/discord.js-utilities": "^7.1.6",
"@sapphire/framework": "^5.0.7",
"@sapphire/plugin-logger": "^4.0.2",
"@sapphire/plugin-scheduled-tasks": "^10.0.1",
"@sapphire/plugin-subcommands": "^6.0.3",
"@sapphire/stopwatch": "^1.5.2",
"@sapphire/time-utilities": "^1.7.12",
"@sapphire/ts-config": "^5.0.0",
"@sapphire/utilities": "^3.15.1",
"@types/node": "^20.10.6",
"bullmq": "^5.1.1",
"@sapphire/utilities": "^3.15.3",
"@types/node": "^20.11.7",
"bullmq": "^5.1.5",
"discord.js": "^14.14.1",
"ioredis": "^5.3.2",
"redis": "^4.6.12",
"ts-node": "^10.9.1",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.17.0",
"@typescript-eslint/parser": "^6.17.0",
"@typescript-eslint/eslint-plugin": "^6.19.1",
"@typescript-eslint/parser": "^6.19.1",
"eslint": "8.56.0",
"eslint-config-prettier": "^9.1.0",
"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(
`${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.",
);
return;

View File

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

View File

@ -17,8 +17,8 @@
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 { ChannelType } from 'discord.js';
export class VerifyTimeout extends ScheduledTask {
public constructor(
@ -30,17 +30,24 @@ export class VerifyTimeout extends ScheduledTask {
public async run(payload: { channelId: string; userId: string }) {
// Get the guild where the user is in
let channel = this.container.client.channels.cache.get(
payload.channelId,
) as VoiceChannel | undefined;
if (channel === undefined) {
channel = (await this.container.client.channels.fetch(
payload.channelId,
)) as VoiceChannel | undefined;
let channel = this.container.client.channels.cache.get(payload.channelId);
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!');
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)) {

View File

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

View File

@ -31,7 +31,7 @@
// "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. */,
"paths": {
"#utils/*": ["./utils/*"]
"#utils/*": ["./utils/*"],
} /* 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. */
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
@ -79,7 +79,7 @@
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
/* 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. */
// "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. */
@ -103,5 +103,5 @@
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
// "skipLibCheck": true /* Skip type checking all .d.ts files. */
},
"include": ["src"]
"include": ["src"],
}