mirror of
https://github.com/veganhacktivists/arabot.git
synced 2025-05-19 08:44:17 +02:00
fix(verification): fix multiple eslint issues
This commit is contained in:
parent
c71b787c8b
commit
2b96d507eb
@ -17,5 +17,6 @@
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"rules": {
|
||||
"class-methods-use-this": "off"
|
||||
}
|
||||
}
|
||||
|
19
package-lock.json
generated
19
package-lock.json
generated
@ -10,6 +10,7 @@
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"@prisma/client": "^4.0.0",
|
||||
"@sapphire/discord.js-utilities": "^5.0.0",
|
||||
"@sapphire/framework": "^3.0.0",
|
||||
"@sapphire/plugin-scheduled-tasks": "^4.0.0",
|
||||
"@sapphire/plugin-subcommands": "^3.0.0",
|
||||
@ -18,7 +19,7 @@
|
||||
"@types/node": "^18.0.3",
|
||||
"bullmq": "^1.89.1",
|
||||
"discord-api-types": "^0.33.3",
|
||||
"discord.js": "^13.10.2",
|
||||
"discord.js": "^13.10.3",
|
||||
"dotenv": "^16.0.1",
|
||||
"prisma": "^4.2.1",
|
||||
"ts-node": "^10.8.2",
|
||||
@ -1114,13 +1115,13 @@
|
||||
"integrity": "sha512-dvO5M52v7m7Dy96+XUnzXNsQ/0npsYpU6dL205kAtEDueswoz3aU3bh1UMoK4cQmcGtB1YRyLKqp+DXi05lzFg=="
|
||||
},
|
||||
"node_modules/discord.js": {
|
||||
"version": "13.10.2",
|
||||
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.10.2.tgz",
|
||||
"integrity": "sha512-zPhPaUvJRCqmsqMBmQ8gJ8k/O0rcuLj8tn/mOaJEiDPkpb5aFULHarOfqND6jRuLrKXd2to/bc0mjXTOgRW1MA==",
|
||||
"version": "13.10.3",
|
||||
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.10.3.tgz",
|
||||
"integrity": "sha512-cIARuxfpQDeqA9Zw3fz4IL20xAhtMsjwJIf7/K82R3n2xROG9/fAx+7qjX8ysp9BfflYqMu2ZskyWq1EAmL5BA==",
|
||||
"dependencies": {
|
||||
"@discordjs/builders": "^0.16.0",
|
||||
"@discordjs/collection": "^0.7.0",
|
||||
"@sapphire/async-queue": "^1.3.2",
|
||||
"@sapphire/async-queue": "^1.5.0",
|
||||
"@types/node-fetch": "^2.6.2",
|
||||
"@types/ws": "^8.5.3",
|
||||
"discord-api-types": "^0.33.3",
|
||||
@ -4069,13 +4070,13 @@
|
||||
"integrity": "sha512-dvO5M52v7m7Dy96+XUnzXNsQ/0npsYpU6dL205kAtEDueswoz3aU3bh1UMoK4cQmcGtB1YRyLKqp+DXi05lzFg=="
|
||||
},
|
||||
"discord.js": {
|
||||
"version": "13.10.2",
|
||||
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.10.2.tgz",
|
||||
"integrity": "sha512-zPhPaUvJRCqmsqMBmQ8gJ8k/O0rcuLj8tn/mOaJEiDPkpb5aFULHarOfqND6jRuLrKXd2to/bc0mjXTOgRW1MA==",
|
||||
"version": "13.10.3",
|
||||
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.10.3.tgz",
|
||||
"integrity": "sha512-cIARuxfpQDeqA9Zw3fz4IL20xAhtMsjwJIf7/K82R3n2xROG9/fAx+7qjX8ysp9BfflYqMu2ZskyWq1EAmL5BA==",
|
||||
"requires": {
|
||||
"@discordjs/builders": "^0.16.0",
|
||||
"@discordjs/collection": "^0.7.0",
|
||||
"@sapphire/async-queue": "^1.3.2",
|
||||
"@sapphire/async-queue": "^1.5.0",
|
||||
"@types/node-fetch": "^2.6.2",
|
||||
"@types/ws": "^8.5.3",
|
||||
"discord-api-types": "^0.33.3",
|
||||
|
@ -27,6 +27,7 @@
|
||||
"homepage": "https://github.com/veganhacktivists/arabot#readme",
|
||||
"dependencies": {
|
||||
"@prisma/client": "^4.0.0",
|
||||
"@sapphire/discord.js-utilities": "^5.0.0",
|
||||
"@sapphire/framework": "^3.0.0",
|
||||
"@sapphire/plugin-scheduled-tasks": "^4.0.0",
|
||||
"@sapphire/plugin-subcommands": "^3.0.0",
|
||||
@ -35,7 +36,7 @@
|
||||
"@types/node": "^18.0.3",
|
||||
"bullmq": "^1.89.1",
|
||||
"discord-api-types": "^0.33.3",
|
||||
"discord.js": "^13.10.2",
|
||||
"discord.js": "^13.10.3",
|
||||
"dotenv": "^16.0.1",
|
||||
"prisma": "^4.2.1",
|
||||
"ts-node": "^10.8.2",
|
||||
|
@ -21,7 +21,7 @@ import { Command, RegisterBehavior } from '@sapphire/framework';
|
||||
import { MessageEmbed } from 'discord.js';
|
||||
import { N1984 } from '../../utils/gifs';
|
||||
|
||||
export class N1984Command extends Command {
|
||||
class N1984Command extends Command {
|
||||
public constructor(context: Command.Context, options: Command.Options) {
|
||||
super(context, {
|
||||
...options,
|
||||
@ -63,3 +63,5 @@ export class N1984Command extends Command {
|
||||
await interaction.reply({ embeds: [n1984Embed], fetchReply: true });
|
||||
}
|
||||
}
|
||||
|
||||
export default N1984Command;
|
||||
|
@ -21,7 +21,7 @@ import { Command, RegisterBehavior } from '@sapphire/framework';
|
||||
import { MessageEmbed } from 'discord.js';
|
||||
import { Happy } from '../../utils/gifs';
|
||||
|
||||
export class HappyCommand extends Command {
|
||||
class HappyCommand extends Command {
|
||||
public constructor(context: Command.Context, options: Command.Options) {
|
||||
super(context, {
|
||||
...options,
|
||||
@ -61,3 +61,5 @@ export class HappyCommand extends Command {
|
||||
await interaction.reply({ embeds: [happyEmbed], fetchReply: true });
|
||||
}
|
||||
}
|
||||
|
||||
export default HappyCommand;
|
||||
|
@ -21,13 +21,12 @@ import { Command, RegisterBehavior } from '@sapphire/framework';
|
||||
import { MessageEmbed } from 'discord.js';
|
||||
import { Hugs } from '../../utils/gifs';
|
||||
|
||||
export class HugCommand extends Command {
|
||||
class HugCommand extends Command {
|
||||
public constructor(context: Command.Context, options: Command.Options) {
|
||||
super(context, {
|
||||
...options,
|
||||
name: 'hug',
|
||||
description: 'Hug a user',
|
||||
preconditions: [['CoordinatorOnly', 'PatreonOnly']],
|
||||
});
|
||||
}
|
||||
|
||||
@ -65,3 +64,5 @@ export class HugCommand extends Command {
|
||||
await interaction.reply({ content: `<@${user.id}>`, embeds: [hugEmbed], fetchReply: true });
|
||||
}
|
||||
}
|
||||
|
||||
export default HugCommand;
|
||||
|
@ -21,13 +21,12 @@ import { Command, RegisterBehavior } from '@sapphire/framework';
|
||||
import { MessageEmbed } from 'discord.js';
|
||||
import { Kill } from '../../utils/gifs';
|
||||
|
||||
export class KillCommand extends Command {
|
||||
class KillCommand extends Command {
|
||||
public constructor(context: Command.Context, options: Command.Options) {
|
||||
super(context, {
|
||||
...options,
|
||||
name: 'kill',
|
||||
description: 'Kill a user',
|
||||
preconditions: [['CoordinatorOnly', 'PatreonOnly']],
|
||||
});
|
||||
}
|
||||
|
||||
@ -65,3 +64,5 @@ export class KillCommand extends Command {
|
||||
await interaction.reply({ content: `<@${user.id}>`, embeds: [killEmbed], fetchReply: true });
|
||||
}
|
||||
}
|
||||
|
||||
export default KillCommand;
|
||||
|
@ -21,7 +21,7 @@ import { Command, RegisterBehavior } from '@sapphire/framework';
|
||||
import { MessageEmbed } from 'discord.js';
|
||||
import { Poke } from '../../utils/gifs';
|
||||
|
||||
export class PokeCommand extends Command {
|
||||
class PokeCommand extends Command {
|
||||
public constructor(context: Command.Context, options: Command.Options) {
|
||||
super(context, {
|
||||
...options,
|
||||
@ -65,3 +65,5 @@ export class PokeCommand extends Command {
|
||||
await interaction.reply({ content: `<@${user.id}>`, embeds: [pokeEmbed], fetchReply: true });
|
||||
}
|
||||
}
|
||||
|
||||
export default PokeCommand;
|
||||
|
@ -21,7 +21,7 @@ import { Command, RegisterBehavior } from '@sapphire/framework';
|
||||
import { MessageEmbed } from 'discord.js';
|
||||
import { Sad } from '../../utils/gifs';
|
||||
|
||||
export class SadCommand extends Command {
|
||||
class SadCommand extends Command {
|
||||
public constructor(context: Command.Context, options: Command.Options) {
|
||||
super(context, {
|
||||
...options,
|
||||
@ -61,3 +61,5 @@ export class SadCommand extends Command {
|
||||
await interaction.reply({ embeds: [sadEmbed], fetchReply: true });
|
||||
}
|
||||
}
|
||||
|
||||
export default SadCommand;
|
||||
|
@ -21,7 +21,7 @@ import { Command, RegisterBehavior } from '@sapphire/framework';
|
||||
import { MessageEmbed } from 'discord.js';
|
||||
import { Shrug } from '../../utils/gifs';
|
||||
|
||||
export class ShrugCommand extends Command {
|
||||
class ShrugCommand extends Command {
|
||||
public constructor(context: Command.Context, options: Command.Options) {
|
||||
super(context, {
|
||||
...options,
|
||||
@ -61,3 +61,5 @@ export class ShrugCommand extends Command {
|
||||
await interaction.reply({ embeds: [shrugEmbed], fetchReply: true });
|
||||
}
|
||||
}
|
||||
|
||||
export default ShrugCommand;
|
||||
|
@ -21,7 +21,7 @@ import { Command, RegisterBehavior } from '@sapphire/framework';
|
||||
import type { TextChannel } from 'discord.js';
|
||||
import IDs from '../../utils/ids';
|
||||
|
||||
export class ToggleOpenCommand extends Command {
|
||||
class ToggleOpenCommand extends Command {
|
||||
public constructor(context: Command.Context, options: Command.Options) {
|
||||
super(context, {
|
||||
...options,
|
||||
@ -52,16 +52,18 @@ export class ToggleOpenCommand extends Command {
|
||||
// Checks what subcommand was run
|
||||
switch (subcommand) {
|
||||
case 'toggleopen': {
|
||||
return await this.toggleOpen(interaction);
|
||||
await this.toggleOpen(interaction);
|
||||
return;
|
||||
}
|
||||
default: {
|
||||
// If subcommand is invalid
|
||||
await interaction.reply({
|
||||
content: 'Invalid sub command!',
|
||||
ephemeral: true,
|
||||
fetchReply: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// If subcommand is invalid
|
||||
await interaction.reply({
|
||||
content: 'Invalid sub command!',
|
||||
ephemeral: true,
|
||||
fetchReply: true,
|
||||
});
|
||||
}
|
||||
|
||||
// Command run
|
||||
@ -123,3 +125,5 @@ export class ToggleOpenCommand extends Command {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default ToggleOpenCommand;
|
||||
|
@ -59,7 +59,7 @@ async function findNotes(userId: string, active: boolean) {
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
// Query to get the specific user's sus notes
|
||||
const getNote = await prisma.sus.findMany({
|
||||
const note = await prisma.sus.findMany({
|
||||
where: {
|
||||
userId,
|
||||
active,
|
||||
@ -68,7 +68,7 @@ async function findNotes(userId: string, active: boolean) {
|
||||
|
||||
// Close the database connection
|
||||
await prisma.$disconnect();
|
||||
return getNote;
|
||||
return note;
|
||||
}
|
||||
|
||||
// Get one note from the id
|
||||
@ -77,7 +77,7 @@ async function getNote(noteId: number) {
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
// Query to get the specific user's sus notes
|
||||
const getNote = await prisma.sus.findUnique({
|
||||
const note = await prisma.sus.findUnique({
|
||||
where: {
|
||||
id: noteId,
|
||||
},
|
||||
@ -85,7 +85,7 @@ async function getNote(noteId: number) {
|
||||
|
||||
// Close the database connection
|
||||
await prisma.$disconnect();
|
||||
return getNote;
|
||||
return note;
|
||||
}
|
||||
|
||||
async function deactivateNote(noteId: number) {
|
||||
@ -127,7 +127,7 @@ async function deactivateAllNotes(userId: string) {
|
||||
}
|
||||
|
||||
// Main command
|
||||
export class SusCommand extends Command {
|
||||
class SusCommand extends Command {
|
||||
public constructor(context: Command.Context) {
|
||||
super(context, {
|
||||
name: 'sus',
|
||||
@ -182,29 +182,34 @@ export class SusCommand extends Command {
|
||||
// Checks what subcommand was run
|
||||
switch (subcommand) {
|
||||
case 'add': {
|
||||
return await this.addNote(interaction);
|
||||
await this.addNote(interaction);
|
||||
return;
|
||||
}
|
||||
case 'view': {
|
||||
return await this.listNote(interaction);
|
||||
await this.listNote(interaction);
|
||||
return;
|
||||
}
|
||||
case 'remove': {
|
||||
return await this.removeNote(interaction);
|
||||
await this.removeNote(interaction);
|
||||
return;
|
||||
}
|
||||
case 'purge': {
|
||||
return await this.removeAllNotes(interaction);
|
||||
await this.removeAllNotes(interaction);
|
||||
return;
|
||||
}
|
||||
default: {
|
||||
// If subcommand is invalid
|
||||
await interaction.reply({
|
||||
content: 'Invalid sub command!',
|
||||
ephemeral: true,
|
||||
fetchReply: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// If subcommand is invalid
|
||||
await interaction.reply({
|
||||
content: 'Invalid sub command!',
|
||||
ephemeral: true,
|
||||
fetchReply: true,
|
||||
});
|
||||
}
|
||||
|
||||
// Subcommand to add sus note
|
||||
public async addNote(interaction: Command.ChatInputInteraction) {
|
||||
private async addNote(interaction: Command.ChatInputInteraction) {
|
||||
// Get the arguments
|
||||
let user = interaction.options.getUser('user');
|
||||
let note = interaction.options.getString('note');
|
||||
@ -261,7 +266,7 @@ export class SusCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
public async listNote(interaction: Command.ChatInputInteraction) {
|
||||
private async listNote(interaction: Command.ChatInputInteraction) {
|
||||
// Get the arguments
|
||||
let user = interaction.options.getUser('user');
|
||||
const { guild } = interaction;
|
||||
@ -321,7 +326,7 @@ export class SusCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
public async removeNote(interaction: Command.ChatInputInteraction) {
|
||||
private async removeNote(interaction: Command.ChatInputInteraction) {
|
||||
// Get the arguments
|
||||
let noteId = interaction.options.getInteger('id');
|
||||
const { guild, channel } = interaction;
|
||||
@ -375,7 +380,7 @@ export class SusCommand extends Command {
|
||||
.setThumbnail(user!.avatarURL()!) // TODO avatar does not show when run
|
||||
.addField(
|
||||
`ID: ${noteId} | Moderator: ${modName} | Date: <t:${Math.floor(note!.time.getTime() / 1000)}>`,
|
||||
note!.note,
|
||||
note!.note,
|
||||
);
|
||||
|
||||
// Create buttons to delete or cancel the deletion
|
||||
@ -439,7 +444,7 @@ export class SusCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
public async removeAllNotes(interaction: Command.ChatInputInteraction) {
|
||||
private async removeAllNotes(interaction: Command.ChatInputInteraction) {
|
||||
// Get the arguments
|
||||
const user = interaction.options.getUser('user');
|
||||
const { guild, channel } = interaction;
|
||||
@ -557,3 +562,5 @@ export class SusCommand extends Command {
|
||||
await userGuildMember!.roles.remove(IDs.roles.restrictions.sus);
|
||||
}
|
||||
}
|
||||
|
||||
export default SusCommand;
|
||||
|
@ -20,7 +20,7 @@
|
||||
import { Command, RegisterBehavior } from '@sapphire/framework';
|
||||
import IDs from '../../utils/ids';
|
||||
|
||||
export class StageHostCommand extends Command {
|
||||
class StageHostCommand extends Command {
|
||||
public constructor(context: Command.Context, options: Command.Options) {
|
||||
super(context, {
|
||||
...options,
|
||||
@ -98,3 +98,5 @@ export class StageHostCommand extends Command {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default StageHostCommand;
|
||||
|
@ -20,7 +20,7 @@
|
||||
import { Command, RegisterBehavior } from '@sapphire/framework';
|
||||
import IDs from '../../utils/ids';
|
||||
|
||||
export class VegCuriousCommand extends Command {
|
||||
class VegCuriousCommand extends Command {
|
||||
public constructor(context: Command.Context, options: Command.Options) {
|
||||
super(context, {
|
||||
...options,
|
||||
@ -109,3 +109,5 @@ export class VegCuriousCommand extends Command {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default VegCuriousCommand;
|
||||
|
@ -20,7 +20,7 @@
|
||||
import { isMessageInstance } from '@sapphire/discord.js-utilities';
|
||||
import { Command } from '@sapphire/framework';
|
||||
|
||||
export class PingCommand extends Command {
|
||||
class PingCommand extends Command {
|
||||
public constructor(context: Command.Context, options: Command.Options) {
|
||||
super(context, {
|
||||
...options,
|
||||
@ -49,3 +49,5 @@ export class PingCommand extends Command {
|
||||
return interaction.editReply('Failed to retrieve ping :(');
|
||||
}
|
||||
}
|
||||
|
||||
export default PingCommand;
|
||||
|
@ -21,7 +21,7 @@ import { Command, RegisterBehavior } from '@sapphire/framework';
|
||||
import { isMessageInstance } from '@sapphire/discord.js-utilities';
|
||||
import IDs from '../../utils/ids';
|
||||
|
||||
export class purgeVerifyingCommand extends Command {
|
||||
class PurgeVerifyingCommand extends Command {
|
||||
public constructor(context: Command.Context, options: Command.Options) {
|
||||
super(context, {
|
||||
...options,
|
||||
@ -129,3 +129,5 @@ export class purgeVerifyingCommand extends Command {
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
export default PurgeVerifyingCommand;
|
||||
|
@ -20,7 +20,7 @@
|
||||
import type { UserError, ChatInputCommandDeniedPayload } from '@sapphire/framework';
|
||||
import { Listener } from '@sapphire/framework';
|
||||
|
||||
export class CommandDeniedListener extends Listener {
|
||||
class CommandDeniedListener extends Listener {
|
||||
public constructor(context: Listener.Context, options: Listener.Options) {
|
||||
super(context, {
|
||||
...options,
|
||||
@ -33,3 +33,5 @@ export class CommandDeniedListener extends Listener {
|
||||
return interaction.reply(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
export default CommandDeniedListener;
|
||||
|
@ -23,7 +23,7 @@
|
||||
import { Listener } from '@sapphire/framework';
|
||||
import type { Client } from 'discord.js';
|
||||
|
||||
export class ReadyListener extends Listener {
|
||||
class ReadyListener extends Listener {
|
||||
public constructor(context: Listener.Context, options: Listener.Options) {
|
||||
super(context, {
|
||||
...options,
|
||||
@ -37,3 +37,5 @@ export class ReadyListener extends Listener {
|
||||
this.container.logger.info(`Successfully logged in as ${username} (${id})`);
|
||||
}
|
||||
}
|
||||
|
||||
export default ReadyListener;
|
||||
|
@ -26,7 +26,7 @@ import type {
|
||||
} from 'discord.js';
|
||||
import IDs from '../utils/ids';
|
||||
|
||||
export class CoordinatorOnlyPrecondition extends AllFlowsPrecondition {
|
||||
class CoordinatorOnlyPrecondition extends AllFlowsPrecondition {
|
||||
public override async messageRun(message: Message) {
|
||||
// for message command
|
||||
return this.checkCoordinator(message.member!);
|
||||
@ -54,3 +54,5 @@ declare module '@sapphire/framework' {
|
||||
CoordinatorOnly: never;
|
||||
}
|
||||
}
|
||||
|
||||
export default CoordinatorOnlyPrecondition;
|
||||
|
@ -26,7 +26,7 @@ import type {
|
||||
} from 'discord.js';
|
||||
import IDs from '../utils/ids';
|
||||
|
||||
export class DevCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
|
||||
class DevCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
|
||||
public override async messageRun(message: Message) {
|
||||
// for message command
|
||||
return this.checkDevCoordinator(message.member!);
|
||||
@ -54,3 +54,5 @@ declare module '@sapphire/framework' {
|
||||
DevCoordinatorOnly: never;
|
||||
}
|
||||
}
|
||||
|
||||
export default DevCoordinatorOnlyPrecondition;
|
||||
|
@ -26,7 +26,7 @@ import type {
|
||||
} from 'discord.js';
|
||||
import IDs from '../utils/ids';
|
||||
|
||||
export class DiversityCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
|
||||
class DiversityCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
|
||||
public override async messageRun(message: Message) {
|
||||
// for message command
|
||||
return this.checkDiversityCoordinator(message.member!);
|
||||
@ -54,3 +54,5 @@ declare module '@sapphire/framework' {
|
||||
DiversityCoordinatorOnly: never;
|
||||
}
|
||||
}
|
||||
|
||||
export default DiversityCoordinatorOnlyPrecondition;
|
||||
|
@ -26,7 +26,7 @@ import type {
|
||||
} from 'discord.js';
|
||||
import IDs from '../utils/ids';
|
||||
|
||||
export class EventCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
|
||||
class EventCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
|
||||
public override async messageRun(message: Message) {
|
||||
// for message command
|
||||
return this.checkEventCoordinator(message.member!);
|
||||
@ -54,3 +54,5 @@ declare module '@sapphire/framework' {
|
||||
EventCoordinatorOnly: never;
|
||||
}
|
||||
}
|
||||
|
||||
export default EventCoordinatorOnlyPrecondition;
|
||||
|
@ -26,7 +26,7 @@ import type {
|
||||
} from 'discord.js';
|
||||
import IDs from '../utils/ids';
|
||||
|
||||
export class MentorCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
|
||||
class MentorCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
|
||||
public override async messageRun(message: Message) {
|
||||
// for message command
|
||||
return this.checkMentorCoordinator(message.member!);
|
||||
@ -54,3 +54,5 @@ declare module '@sapphire/framework' {
|
||||
MentorCoordinatorOnly: never;
|
||||
}
|
||||
}
|
||||
|
||||
export default MentorCoordinatorOnlyPrecondition;
|
||||
|
@ -26,7 +26,7 @@ import type {
|
||||
} from 'discord.js';
|
||||
import IDs from '../utils/ids';
|
||||
|
||||
export class ModOnlyPrecondition extends AllFlowsPrecondition {
|
||||
class ModOnlyPrecondition extends AllFlowsPrecondition {
|
||||
public override async messageRun(message: Message) {
|
||||
// for message command
|
||||
return this.checkMod(message.member!);
|
||||
@ -54,3 +54,5 @@ declare module '@sapphire/framework' {
|
||||
ModOnly: never;
|
||||
}
|
||||
}
|
||||
|
||||
export default ModOnlyPrecondition;
|
||||
|
@ -26,7 +26,7 @@ import type {
|
||||
} from 'discord.js';
|
||||
import IDs from '../utils/ids';
|
||||
|
||||
export class PatreonOnlyPrecondition extends AllFlowsPrecondition {
|
||||
class PatreonOnlyPrecondition extends AllFlowsPrecondition {
|
||||
public override async messageRun(message: Message) {
|
||||
// for message command
|
||||
return this.checkPatreon(message.member!);
|
||||
@ -54,3 +54,5 @@ declare module '@sapphire/framework' {
|
||||
PatreonOnly: never;
|
||||
}
|
||||
}
|
||||
|
||||
export default PatreonOnlyPrecondition;
|
||||
|
@ -26,7 +26,7 @@ import type {
|
||||
} from 'discord.js';
|
||||
import IDs from '../utils/ids';
|
||||
|
||||
export class VerifierCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
|
||||
class VerifierCoordinatorOnlyPrecondition extends AllFlowsPrecondition {
|
||||
public override async messageRun(message: Message) {
|
||||
// for message command
|
||||
return this.checkVerifierCoordinator(message.member!);
|
||||
@ -54,3 +54,5 @@ declare module '@sapphire/framework' {
|
||||
VerifierCoordinatorOnly: never;
|
||||
}
|
||||
}
|
||||
|
||||
export default VerifierCoordinatorOnlyPrecondition;
|
||||
|
@ -26,7 +26,7 @@ import type {
|
||||
} from 'discord.js';
|
||||
import IDs from '../utils/ids';
|
||||
|
||||
export class VerifierOnlyPrecondition extends AllFlowsPrecondition {
|
||||
class VerifierOnlyPrecondition extends AllFlowsPrecondition {
|
||||
public override async messageRun(message: Message) {
|
||||
// for message command
|
||||
return this.checkVerifier(message.member!);
|
||||
@ -54,3 +54,5 @@ declare module '@sapphire/framework' {
|
||||
VerifierOnly: never;
|
||||
}
|
||||
}
|
||||
|
||||
export default VerifierOnlyPrecondition;
|
||||
|
50
src/scheduled-tasks/appleWarning.ts
Normal file
50
src/scheduled-tasks/appleWarning.ts
Normal file
@ -0,0 +1,50 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
/*
|
||||
Animal Rights Advocates Discord Bot
|
||||
Copyright (C) 2022 Anthony Berg
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ScheduledTask } from '@sapphire/plugin-scheduled-tasks';
|
||||
import { container } from '@sapphire/framework';
|
||||
import type { TextChannel } from 'discord.js';
|
||||
import IDs from '../utils/ids';
|
||||
|
||||
class AppleWarningTask extends ScheduledTask {
|
||||
public constructor(context: ScheduledTask.Context, options: ScheduledTask.Options) {
|
||||
super(context, {
|
||||
...options,
|
||||
cron: '0 */2 * * 2-3',
|
||||
});
|
||||
}
|
||||
|
||||
public async run() {
|
||||
const { client } = container;
|
||||
|
||||
const channel = client.channels.cache.get(IDs.channels.nonVegan.general) as TextChannel;
|
||||
|
||||
await channel.send('Hiya everyone, this is a warning to all **Apple users**!\n'
|
||||
+ 'Make sure to update your iOS, iPadOS and MacOS as there is a hack that lets anyone get remote access to your device if you click on a malicious link.\n'
|
||||
+ `For more information, read the post in <#${IDs.channels.information.news}>`);
|
||||
}
|
||||
}
|
||||
|
||||
declare module '@sapphire/plugin-scheduled-tasks' {
|
||||
interface ScheduledTasks {
|
||||
cron: never;
|
||||
}
|
||||
}
|
||||
|
||||
export default AppleWarningTask;
|
@ -22,7 +22,7 @@ import { container } from '@sapphire/framework';
|
||||
import type { TextChannel } from 'discord.js';
|
||||
import IDs from '../utils/ids';
|
||||
|
||||
export class StandupTask extends ScheduledTask {
|
||||
class StandupTask extends ScheduledTask {
|
||||
public constructor(context: ScheduledTask.Context, options: ScheduledTask.Options) {
|
||||
super(context, {
|
||||
...options,
|
||||
@ -45,3 +45,5 @@ declare module '@sapphire/plugin-scheduled-tasks' {
|
||||
cron: never;
|
||||
}
|
||||
}
|
||||
|
||||
export default StandupTask;
|
||||
|
87
src/utils/dbExistingUser.ts
Normal file
87
src/utils/dbExistingUser.ts
Normal file
@ -0,0 +1,87 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
/*
|
||||
Animal Rights Advocates Discord Bot
|
||||
Copyright (C) 2022 Anthony Berg
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import type { GuildMember } from 'discord.js';
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import IDs from './ids';
|
||||
|
||||
// Checks if the user exists on the database
|
||||
export async function userExists(user: GuildMember) {
|
||||
// Initialises Prisma Client
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
// Counts if the user is on the database by their snowflake
|
||||
const userQuery = await prisma.user.count({
|
||||
where: {
|
||||
id: user.id,
|
||||
},
|
||||
});
|
||||
|
||||
// Close the database connection
|
||||
await prisma.$disconnect();
|
||||
|
||||
// If the user is found on the database, then return true, otherwise, false.
|
||||
return userQuery > 0;
|
||||
}
|
||||
|
||||
// Adds the user to the database if they were already on the server before the bot/database
|
||||
export async function addExistingUser(user: GuildMember) {
|
||||
// Initialises Prisma Client
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
// Counts if the user is on the database by their snowflake
|
||||
const userQuery = await prisma.user.count({
|
||||
where: {
|
||||
id: user.id,
|
||||
},
|
||||
});
|
||||
|
||||
// If the user is already in the database
|
||||
if (userQuery > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Checks what roles the user has
|
||||
const hasVegan = user.roles.cache.has(IDs.roles.vegan.vegan);
|
||||
const hasActivist = user.roles.cache.has(IDs.roles.vegan.activist);
|
||||
const hasPlus = user.roles.cache.has(IDs.roles.vegan.plus);
|
||||
const hasNotVegan = user.roles.cache.has(IDs.roles.nonvegan.nonvegan);
|
||||
const hasVegCurious = user.roles.cache.has(IDs.roles.nonvegan.vegCurious);
|
||||
const hasConvinced = user.roles.cache.has(IDs.roles.nonvegan.convinced);
|
||||
const hasTrusted = user.roles.cache.has(IDs.roles.trusted);
|
||||
const hasMuted = user.roles.cache.has(IDs.roles.restrictions.muted);
|
||||
|
||||
// Create the user in the database
|
||||
await prisma.user.create({
|
||||
data: {
|
||||
id: user.id,
|
||||
vegan: hasVegan,
|
||||
trusted: hasTrusted,
|
||||
activist: hasActivist,
|
||||
plus: hasPlus,
|
||||
notVegan: hasNotVegan,
|
||||
vegCurious: hasVegCurious,
|
||||
convinced: hasConvinced,
|
||||
muted: hasMuted,
|
||||
},
|
||||
});
|
||||
|
||||
// Close the database connection
|
||||
await prisma.$disconnect();
|
||||
}
|
@ -57,11 +57,17 @@ const devIDs = {
|
||||
verifyBlock: '1007477161835372574',
|
||||
},
|
||||
channels: {
|
||||
information: {
|
||||
news: '999431676058927247',
|
||||
},
|
||||
staff: {
|
||||
coordinators: '999431676058927254',
|
||||
standup: '999431676289622183',
|
||||
verifiers: '999431677006860411',
|
||||
},
|
||||
nonVegan: {
|
||||
general: '999431677325615189',
|
||||
},
|
||||
diversity: {
|
||||
women: '999431679053660187',
|
||||
lgbtqia: '999431679053660188',
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
import devIDs from './devIDs';
|
||||
|
||||
// eslint-disable-next-line import/no-mutable-exports
|
||||
let IDs = {
|
||||
roles: {
|
||||
trusted: '731563158011117590',
|
||||
@ -59,11 +60,17 @@ let IDs = {
|
||||
verifyBlock: '',
|
||||
},
|
||||
channels: {
|
||||
information: {
|
||||
news: '866000393259319306',
|
||||
},
|
||||
staff: {
|
||||
coordinators: '1006240682505142354',
|
||||
standup: '996009201237233684',
|
||||
verifiers: '873215538627756072',
|
||||
},
|
||||
nonVegan: {
|
||||
general: '798967615636504657',
|
||||
},
|
||||
diversity: {
|
||||
women: '938808963544285324',
|
||||
lgbtqia: '956224226556272670',
|
||||
|
Loading…
x
Reference in New Issue
Block a user