Merge branch 'main' into verification

This commit is contained in:
Anthony Berg 2022-10-20 22:35:42 +01:00 committed by GitHub
commit bb117f3c23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 143 additions and 3 deletions

View File

@ -1,3 +1,4 @@
version: "3.7"
services:
postgres:
image: postgres:14

49
docs/COMMANDS.md Normal file
View File

@ -0,0 +1,49 @@
# Commands for the bot
## Moderation
### Sus
This command stores notes on users that could be information on the user
or anything that is not serious enough for a warning.
#### Classic Commands
- `?sus <user> <note>` Add a note to the user
#### Application Commands
- `/sus add <user> <note>`
- `/sus view <user>`
- `/sus remove <id>`
- `/sus purge <user>`
## Coordinator Only
### Diversity Team
- `/diversity toggleopen`
### Events Team
- `/stagehost`
### Mentor Team
- `/vegancurious`
### Verification Team
- `/purgeverifying`
## Utilities
- `/ping`
## Fun Commands
- `/1984`
- `/happy`
- `/hug`
- `/kill`
- `/poke`
- `/sad`
- `/shrug`

2
package-lock.json generated
View File

@ -30,7 +30,7 @@
"@types/ioredis": "^4.28.10",
"@typescript-eslint/eslint-plugin": "^5.30.7",
"@typescript-eslint/parser": "^5.30.7",
"eslint": "^8.20.0",
"eslint": "8.22.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-plugin-import": "^2.26.0",

View File

@ -47,7 +47,7 @@
"@types/ioredis": "^4.28.10",
"@typescript-eslint/eslint-plugin": "^5.30.7",
"@typescript-eslint/parser": "^5.30.7",
"eslint": "^8.20.0",
"eslint": "8.22.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-plugin-import": "^2.26.0",

View File

@ -17,7 +17,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { Command, RegisterBehavior } from '@sapphire/framework';
import { Command, RegisterBehavior, Args } from '@sapphire/framework';
import {
MessageEmbed, MessageActionRow, MessageButton, Constants, ButtonInteraction,
} from 'discord.js';
@ -468,6 +468,55 @@ class SusCommand extends Command {
// Remove sus role from the user
await userGuildMember!.roles.remove(IDs.roles.restrictions.sus);
}
// Non Application Command method of adding a sus note
// xlevra begged me to add this... so I guess here it is
public async messageRun(message: Message, args: Args) {
// Get arguments
let user: GuildMember;
try {
user = await args.pick('member');
} catch {
await message.react('❌');
await message.reply('User was not provided!');
return;
}
const note = args.finished ? null : await args.rest('string');
const mod = message.member;
if (note === null) {
await message.react('❌');
await message.reply('No sus note was provided!');
return;
}
if (mod === null) {
await message.react('❌');
await message.reply('Moderator not found! Try again or contact a developer!');
return;
}
// Check if user and mod are on the database
if (!await userExists(user)) {
await addExistingUser(user);
}
if (!await userExists(mod!)) {
await addExistingUser(mod!);
}
await addToDatabase(user.id, mod.id, note);
// Give the user the sus role they don't already have the sus note
if (!user.roles.cache.has(IDs.roles.restrictions.sus)) {
await user!.roles.add(IDs.roles.restrictions.sus);
}
// Checks if the user is xlevra to send a very kind message
if (mod.id === '259624904746467329') {
await message.reply('Fuck you for making me add this feature 🤬');
}
await message.react('✅');
}
}
export default SusCommand;

View File

@ -0,0 +1,38 @@
// 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 { UserError, MessageCommandDeniedPayload } from '@sapphire/framework';
import { Listener } from '@sapphire/framework';
class OldCommandDeniedListener extends Listener {
public constructor(context: Listener.Context, options: Listener.Options) {
super(context, {
...options,
once: false,
event: 'messageCommandDenied',
});
}
public async run(error: UserError, { message }: MessageCommandDeniedPayload) {
await message.react('❌');
return message.reply(error.message);
}
}
export default OldCommandDeniedListener;

View File

@ -44,6 +44,7 @@ class ModOnlyPrecondition extends AllFlowsPrecondition {
private async checkMod(user: GuildMember) {
return user.roles.cache.has(IDs.roles.staff.moderator)
|| user.roles.cache.has(IDs.roles.staff.trialModerator)
? this.ok()
: this.error({ message: 'Only moderators can run this command!' });
}

View File

@ -47,6 +47,7 @@ const devIDs = {
eventCoordinator: '999431675165556817',
restricted: '999431675123597407',
moderator: '999431675123597408',
trialModerator: '999431675123597404',
verifier: '999431675123597406',
trialVerifier: '999431675123597405',
},

View File

@ -50,6 +50,7 @@ let IDs = {
eventCoordinator: '944732860554817586',
restricted: '851624392928264222',
moderator: '826157475815489598',
trialModerator: '982074555596152904',
verifier: '871802735031373856',
trialVerifier: '982635638010572850',
},