mirror of
https://github.com/janderedev/automod.git
synced 2024-12-22 18:55:28 +00:00
restructure commands
This commit is contained in:
parent
d4a41b7ba1
commit
ecef27f1e6
|
@ -1,16 +1,15 @@
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import { client, dbs } from "../..";
|
import { client, dbs } from "../../..";
|
||||||
import { commands, DEFAULT_PREFIX, ownerIDs } from "../modules/command_handler";
|
import { commands, DEFAULT_PREFIX, ownerIDs } from "../../modules/command_handler";
|
||||||
import child_process from 'child_process';
|
import child_process from 'child_process';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { wordlist } from "../modules/user_scan";
|
import { wordlist } from "../../modules/user_scan";
|
||||||
import { User } from "@janderedev/revolt.js/dist/maps/Users";
|
import { User } from "@janderedev/revolt.js/dist/maps/Users";
|
||||||
import { adminBotLog } from "../logging";
|
import { adminBotLog } from "../../logging";
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
import { parseUserOrId } from "../util";
|
import { parseUserOrId } from "../../util";
|
||||||
import { Permission } from "@janderedev/revolt.js/dist/permissions/definitions";
|
|
||||||
|
|
||||||
const BLACKLIST_BAN_REASON = `This user is globally blacklisted and has been banned automatically. If you wish to opt out of the global blacklist, run '/botctl ignore_blacklist yes'.`;
|
const BLACKLIST_BAN_REASON = `This user is globally blacklisted and has been banned automatically. If you wish to opt out of the global blacklist, run '/botctl ignore_blacklist yes'.`;
|
||||||
const BLACKLIST_MESSAGE = (username: string) => `\`@${username}\` has been banned automatically. Check the ban reason for more info.`;
|
const BLACKLIST_MESSAGE = (username: string) => `\`@${username}\` has been banned automatically. Check the ban reason for more info.`;
|
|
@ -1,9 +1,7 @@
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import { Message } from "@janderedev/revolt.js/dist/maps/Messages";
|
|
||||||
import { inspect } from 'util';
|
import { inspect } from 'util';
|
||||||
import { client } from "../..";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'eval',
|
name: 'eval',
|
|
@ -1,8 +1,7 @@
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import { Message } from "@janderedev/revolt.js/dist/maps/Messages";
|
|
||||||
import { exec } from 'child_process';
|
import { exec } from 'child_process';
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'shell',
|
name: 'shell',
|
|
@ -1,10 +1,9 @@
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import { hasPerm, parseUser } from "../util";
|
import { hasPerm, parseUser } from "../../util";
|
||||||
import ServerConfig from "../../struct/ServerConfig";
|
import { client, dbs } from "../../..";
|
||||||
import { client, dbs } from "../..";
|
|
||||||
import { User } from "@janderedev/revolt.js/dist/maps/Users";
|
import { User } from "@janderedev/revolt.js/dist/maps/Users";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
|
|
||||||
const SYNTAX = '/admin add @user; /admin remove @user; /admin list';
|
const SYNTAX = '/admin add @user; /admin remove @user; /admin list';
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { FindOneResult } from "monk";
|
import { FindOneResult } from "monk";
|
||||||
import { client, dbs } from "../..";
|
import { dbs } from "../../..";
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import ServerConfig from "../../struct/ServerConfig";
|
import ServerConfig from "../../../struct/ServerConfig";
|
||||||
import { scanServer } from "../modules/user_scan";
|
import { scanServer } from "../../modules/user_scan";
|
||||||
import { isBotManager, NO_MANAGER_MSG } from "../util";
|
import { isBotManager, NO_MANAGER_MSG } from "../../util";
|
||||||
|
|
||||||
let userscans: string[] = [];
|
let userscans: string[] = [];
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { Message } from "@janderedev/revolt.js";
|
import { Message } from "@janderedev/revolt.js";
|
||||||
import { ulid } from "ulid";
|
import { ulid } from "ulid";
|
||||||
import { SendableEmbed } from "revolt-api";
|
import { SendableEmbed } from "revolt-api";
|
||||||
import { dbs } from "../..";
|
import { dbs } from "../../..";
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import { DEFAULT_PREFIX } from "../modules/command_handler";
|
import { DEFAULT_PREFIX } from "../../modules/command_handler";
|
||||||
import { isBotManager, isModerator, NO_MANAGER_MSG } from "../util";
|
import { isBotManager, isModerator, NO_MANAGER_MSG } from "../../util";
|
||||||
|
|
||||||
const DISCORD_INVITE_URL = 'https://discord.com/api/oauth2/authorize?client_id=965692929643524136&permissions=536996864&scope=bot%20applications.commands'; // todo: read this from env or smth
|
const DISCORD_INVITE_URL = 'https://discord.com/api/oauth2/authorize?client_id=965692929643524136&permissions=536996864&scope=bot%20applications.commands'; // todo: read this from env or smth
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { FindOneResult } from "monk";
|
import { FindOneResult } from "monk";
|
||||||
import { client, dbs } from "../..";
|
import { client, dbs } from "../../..";
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import PendingLogin from "../../struct/PendingLogin";
|
import PendingLogin from "../../../struct/PendingLogin";
|
||||||
import logger from "../logger";
|
import logger from "../../logger";
|
||||||
import { DEFAULT_PREFIX } from "../modules/command_handler";
|
import { DEFAULT_PREFIX } from "../../modules/command_handler";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'login',
|
name: 'login',
|
|
@ -1,10 +1,8 @@
|
||||||
import { FindOneResult, FindResult } from "monk";
|
import { dbs } from "../../..";
|
||||||
import { client, dbs } from "../..";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import { DEFAULT_PREFIX } from "../../modules/command_handler";
|
||||||
import PendingLogin from "../../struct/PendingLogin";
|
|
||||||
import { DEFAULT_PREFIX } from "../modules/command_handler";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'logout',
|
name: 'logout',
|
|
@ -1,11 +1,9 @@
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import { Message } from "@janderedev/revolt.js/dist/maps/Messages";
|
import { isBotManager, NO_MANAGER_MSG, parseUser } from "../../util";
|
||||||
import { isBotManager, NO_MANAGER_MSG, parseUser } from "../util";
|
import { client, dbs } from "../../..";
|
||||||
import ServerConfig from "../../struct/ServerConfig";
|
|
||||||
import { client, dbs } from "../..";
|
|
||||||
import { User } from "@janderedev/revolt.js/dist/maps/Users";
|
import { User } from "@janderedev/revolt.js/dist/maps/Users";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
|
|
||||||
const SYNTAX = '/mod add @user; /mod remove @user; /mod list';
|
const SYNTAX = '/mod add @user; /mod remove @user; /mod list';
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import { client, dbs } from "../..";
|
import { client, dbs } from "../../..";
|
||||||
import ServerConfig from "../../struct/ServerConfig";
|
import { DEFAULT_PREFIX } from "../../modules/command_handler";
|
||||||
import { DEFAULT_PREFIX } from "../modules/command_handler";
|
import { isBotManager, NO_MANAGER_MSG } from "../../util";
|
||||||
import { isBotManager, NO_MANAGER_MSG } from "../util";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
|
||||||
|
|
||||||
const SYNTAX = '/prefix set [new prefix]; /prefix get; prefix clear';
|
const SYNTAX = '/prefix set [new prefix]; /prefix get; prefix clear';
|
||||||
const MENTION_TEXT = 'You can also @mention me instead of using the prefix.';
|
const MENTION_TEXT = 'You can also @mention me instead of using the prefix.';
|
|
@ -1,6 +1,6 @@
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'settings',
|
name: 'settings',
|
|
@ -1,10 +1,10 @@
|
||||||
import { User } from "@janderedev/revolt.js/dist/maps/Users";
|
import { User } from "@janderedev/revolt.js/dist/maps/Users";
|
||||||
import { client, dbs } from "../..";
|
import { client, dbs } from "../../..";
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import ServerConfig from "../../struct/ServerConfig";
|
import ServerConfig from "../../../struct/ServerConfig";
|
||||||
import { isBotManager, NO_MANAGER_MSG, parseUser } from "../util";
|
import { isBotManager, NO_MANAGER_MSG, parseUser } from "../../util";
|
||||||
|
|
||||||
const SYNTAX = '/whitelist add @user; /whitelist remove @user; /whitelist list';
|
const SYNTAX = '/whitelist add @user; /whitelist remove @user; /whitelist list';
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { Member } from "@janderedev/revolt.js/dist/maps/Members";
|
import { Member } from "@janderedev/revolt.js/dist/maps/Members";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import { hasPerm, isModerator, NO_MANAGER_MSG, parseUser } from "../util";
|
import { hasPerm, isModerator, NO_MANAGER_MSG, parseUser } from "../../util";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'avatar',
|
name: 'avatar',
|
|
@ -1,8 +1,8 @@
|
||||||
import { decodeTime } from "ulid";
|
import { decodeTime } from "ulid";
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import { ULID_REGEX } from "../util";
|
import { ULID_REGEX } from "../../util";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'debug',
|
name: 'debug',
|
|
@ -1,7 +1,7 @@
|
||||||
import Command from "../../struct/commands/SimpleCommand";
|
import Command from "../../../struct/commands/SimpleCommand";
|
||||||
import { commands, DEFAULT_PREFIX, ownerIDs } from "../modules/command_handler";
|
import { commands, DEFAULT_PREFIX, ownerIDs } from "../../modules/command_handler";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
|
|
||||||
const categories: { [key in CommandCategory]: {
|
const categories: { [key in CommandCategory]: {
|
||||||
friendlyName: string,
|
friendlyName: string,
|
|
@ -1,8 +1,7 @@
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import { Message } from "@janderedev/revolt.js/dist/maps/Messages";
|
import { client } from "../../..";
|
||||||
import { client } from "../..";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ping',
|
name: 'ping',
|
|
@ -1,6 +1,6 @@
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'test',
|
name: 'test',
|
|
@ -1,16 +1,16 @@
|
||||||
import { ulid } from "ulid";
|
import { ulid } from "ulid";
|
||||||
import { client } from "../../index";
|
import { client } from "../../../index";
|
||||||
import Infraction from "../../struct/antispam/Infraction";
|
import Infraction from "../../../struct/antispam/Infraction";
|
||||||
import InfractionType from "../../struct/antispam/InfractionType";
|
import InfractionType from "../../../struct/antispam/InfractionType";
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import TempBan from "../../struct/TempBan";
|
import TempBan from "../../../struct/TempBan";
|
||||||
import { fetchUsername, logModAction } from "../modules/mod_logs";
|
import { fetchUsername, logModAction } from "../../modules/mod_logs";
|
||||||
import { storeTempBan } from "../modules/tempbans";
|
import { storeTempBan } from "../../modules/tempbans";
|
||||||
import { isModerator, NO_MANAGER_MSG, parseUserOrId, storeInfraction } from "../util";
|
import { isModerator, NO_MANAGER_MSG, parseUserOrId, storeInfraction } from "../../util";
|
||||||
import Day from 'dayjs';
|
import Day from 'dayjs';
|
||||||
import RelativeTime from 'dayjs/plugin/relativeTime';
|
import RelativeTime from 'dayjs/plugin/relativeTime';
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
|
|
||||||
Day.extend(RelativeTime);
|
Day.extend(RelativeTime);
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import { Member } from "@janderedev/revolt.js/dist/maps/Members";
|
import { Member } from "@janderedev/revolt.js/dist/maps/Members";
|
||||||
import { ulid } from "ulid";
|
import { ulid } from "ulid";
|
||||||
import { client } from "../..";
|
import { client } from "../../../";
|
||||||
import Infraction from "../../struct/antispam/Infraction";
|
import Infraction from "../../../struct/antispam/Infraction";
|
||||||
import InfractionType from "../../struct/antispam/InfractionType";
|
import InfractionType from "../../../struct/antispam/InfractionType";
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import { logModAction } from "../modules/mod_logs";
|
import { logModAction } from "../../modules/mod_logs";
|
||||||
import { isModerator, NO_MANAGER_MSG, parseUser, storeInfraction } from "../util";
|
import { isModerator, NO_MANAGER_MSG, parseUser, storeInfraction } from "../../util";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'kick',
|
name: 'kick',
|
|
@ -1,9 +1,9 @@
|
||||||
import { Member } from "@janderedev/revolt.js/dist/maps/Members";
|
import { Member } from "@janderedev/revolt.js/dist/maps/Members";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import { hasPerm, isModerator, NO_MANAGER_MSG, parseUser } from "../util";
|
import { hasPerm, isModerator, NO_MANAGER_MSG, parseUser } from "../../util";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'nick',
|
name: 'nick',
|
|
@ -1,9 +1,9 @@
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import { Message } from "@janderedev/revolt.js/dist/maps/Messages";
|
import { Message } from "@janderedev/revolt.js/dist/maps/Messages";
|
||||||
import { decodeTime } from 'ulid';
|
import { decodeTime } from 'ulid';
|
||||||
import { isModerator, parseUser } from "../util";
|
import { isModerator, parseUser } from "../../util";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
|
|
||||||
const SYNTAX = '/purge [SELECTOR] [@user?[, @user?[, ...]]]; where SELECTOR: [number] || [messageID]-[messageID]';
|
const SYNTAX = '/purge [SELECTOR] [@user?[, @user?[, ...]]]; where SELECTOR: [number] || [messageID]-[messageID]';
|
||||||
const MAX_PURGE_AMOUNT = 100;
|
const MAX_PURGE_AMOUNT = 100;
|
|
@ -1,11 +1,9 @@
|
||||||
import { FindResult } from "monk";
|
import { dbs } from "../../../";
|
||||||
import { client, dbs } from "../..";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import { removeTempBan } from "../../modules/tempbans";
|
||||||
import TempBan from "../../struct/TempBan";
|
import { isModerator, NO_MANAGER_MSG, parseUser, ULID_REGEX, USER_MENTION_REGEX } from "../../util";
|
||||||
import { removeTempBan } from "../modules/tempbans";
|
|
||||||
import { isModerator, NO_MANAGER_MSG, parseUser, ULID_REGEX, USER_MENTION_REGEX } from "../util";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'unban',
|
name: 'unban',
|
|
@ -1,13 +1,12 @@
|
||||||
import { FindResult } from "monk";
|
import { FindResult } from "monk";
|
||||||
import { ulid } from "ulid";
|
import { ulid } from "ulid";
|
||||||
import { client, dbs } from "../..";
|
import { client, dbs } from "../../../";
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import ServerConfig from "../../struct/ServerConfig";
|
import { logModAction } from "../../modules/mod_logs";
|
||||||
import { logModAction } from "../modules/mod_logs";
|
import { storeTempBan } from "../../modules/tempbans";
|
||||||
import { storeTempBan } from "../modules/tempbans";
|
import { getPermissionLevel, isModerator, parseUser } from "../../util";
|
||||||
import { getPermissionLevel, isModerator, parseUser } from "../util";
|
|
||||||
|
|
||||||
type VoteEntry = {
|
type VoteEntry = {
|
||||||
id: string;
|
id: string;
|
|
@ -1,11 +1,11 @@
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import { dedupeArray, embed, EmbedColor, isModerator, NO_MANAGER_MSG, parseUserOrId, sanitizeMessageContent, storeInfraction } from "../util";
|
import { dedupeArray, embed, EmbedColor, isModerator, NO_MANAGER_MSG, parseUserOrId, sanitizeMessageContent, storeInfraction } from "../../util";
|
||||||
import Infraction from "../../struct/antispam/Infraction";
|
import Infraction from "../../../struct/antispam/Infraction";
|
||||||
import { ulid } from "ulid";
|
import { ulid } from "ulid";
|
||||||
import InfractionType from "../../struct/antispam/InfractionType";
|
import InfractionType from "../../../struct/antispam/InfractionType";
|
||||||
import { fetchUsername, logModAction } from "../modules/mod_logs";
|
import { fetchUsername, logModAction } from "../../modules/mod_logs";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
import { SendableEmbed } from "revolt-api";
|
import { SendableEmbed } from "revolt-api";
|
||||||
import { User } from "@janderedev/revolt.js";
|
import { User } from "@janderedev/revolt.js";
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import SimpleCommand from "../../struct/commands/SimpleCommand";
|
import SimpleCommand from "../../../struct/commands/SimpleCommand";
|
||||||
import { client, dbs } from "../..";
|
import { client, dbs } from "../../..";
|
||||||
import Infraction from "../../struct/antispam/Infraction";
|
import Infraction from "../../../struct/antispam/Infraction";
|
||||||
import InfractionType from "../../struct/antispam/InfractionType";
|
import InfractionType from "../../../struct/antispam/InfractionType";
|
||||||
import { isModerator, NO_MANAGER_MSG, parseUserOrId, uploadFile } from "../util";
|
import { isModerator, NO_MANAGER_MSG, parseUserOrId, uploadFile } from "../../util";
|
||||||
import Day from 'dayjs';
|
import Day from 'dayjs';
|
||||||
import RelativeTime from 'dayjs/plugin/relativeTime';
|
import RelativeTime from 'dayjs/plugin/relativeTime';
|
||||||
import Xlsx from 'xlsx';
|
import Xlsx from 'xlsx';
|
||||||
import { fetchUsername } from "../modules/mod_logs";
|
import { fetchUsername } from "../../modules/mod_logs";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import MessageCommandContext from "../../../struct/MessageCommandContext";
|
||||||
import CommandCategory from "../../struct/commands/CommandCategory";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
|
|
||||||
Day.extend(RelativeTime);
|
Day.extend(RelativeTime);
|
||||||
|
|
|
@ -3,13 +3,12 @@ import logger from "../logger";
|
||||||
import { client, dbs } from "../../index";
|
import { client, dbs } from "../../index";
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import ServerConfig from "../../struct/ServerConfig";
|
|
||||||
import { antispam } from "./antispam";
|
import { antispam } from "./antispam";
|
||||||
import checkCustomRules from "./custom_rules/custom_rules";
|
import checkCustomRules from "./custom_rules/custom_rules";
|
||||||
import MessageCommandContext from "../../struct/MessageCommandContext";
|
import MessageCommandContext from "../../struct/MessageCommandContext";
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import { getOwnMemberInServer, hasPermForChannel } from "../util";
|
import { getOwnMemberInServer, hasPermForChannel } from "../util";
|
||||||
import { isSudo, updateSudoTimeout } from "../commands/botadm";
|
import { isSudo, updateSudoTimeout } from "../commands/admin/botadm";
|
||||||
import { metrics } from "./metrics";
|
import { metrics } from "./metrics";
|
||||||
|
|
||||||
// thanks a lot esm
|
// thanks a lot esm
|
||||||
|
@ -26,9 +25,9 @@ let commands: SimpleCommand[];
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
commands = (await Promise.all(
|
commands = (await Promise.all(
|
||||||
fs.readdirSync(path.join(dirname, '..', 'commands'))
|
dirTreeSync(path.join(dirname, '..', 'commands'))
|
||||||
.filter(file => file.endsWith('.js'))
|
.filter(file => file.endsWith('.js'))
|
||||||
.map(async file => await import(path.join(dirname, '..', 'commands', file)) as SimpleCommand)
|
.map(async file => await import(file) as SimpleCommand)
|
||||||
)).map(c => (c as any).default)
|
)).map(c => (c as any).default)
|
||||||
|
|
||||||
client.on('message/update', async msg => {
|
client.on('message/update', async msg => {
|
||||||
|
@ -144,4 +143,19 @@ let commands: SimpleCommand[];
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
function dirTreeSync(dir: string): string[] {
|
||||||
|
const paths: string[] = [];
|
||||||
|
|
||||||
|
const files = fs.readdirSync(dir, { withFileTypes: true });
|
||||||
|
for (const file of files) {
|
||||||
|
if (file.isDirectory()) {
|
||||||
|
paths.push(...dirTreeSync(path.join(dir, file.name)));
|
||||||
|
} else if (file.isFile()) {
|
||||||
|
paths.push(path.join(dir, file.name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return paths;
|
||||||
|
}
|
||||||
|
|
||||||
export { DEFAULT_PREFIX, commands, ownerIDs }
|
export { DEFAULT_PREFIX, commands, ownerIDs }
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import { Permission } from "@janderedev/revolt.js/dist/permissions/definitions";
|
|
||||||
import { ulid } from "ulid";
|
import { ulid } from "ulid";
|
||||||
import { client, dbs } from "../..";
|
import { client, dbs } from "../..";
|
||||||
import Infraction from "../../struct/antispam/Infraction";
|
import Infraction from "../../struct/antispam/Infraction";
|
||||||
import InfractionType from "../../struct/antispam/InfractionType";
|
import InfractionType from "../../struct/antispam/InfractionType";
|
||||||
import { BLACKLIST_BAN_REASON, BLACKLIST_MESSAGE } from "../commands/botadm";
|
import { BLACKLIST_BAN_REASON, BLACKLIST_MESSAGE } from "../commands/admin/botadm";
|
||||||
import logger from "../logger";
|
import logger from "../logger";
|
||||||
import { hasPermForChannel, storeInfraction } from "../util";
|
import { hasPermForChannel, storeInfraction } from "../util";
|
||||||
import { DEFAULT_PREFIX } from "./command_handler";
|
import { DEFAULT_PREFIX } from "./command_handler";
|
||||||
|
|
|
@ -13,7 +13,7 @@ import { ulid } from "ulid";
|
||||||
import { Channel } from "@janderedev/revolt.js/dist/maps/Channels";
|
import { Channel } from "@janderedev/revolt.js/dist/maps/Channels";
|
||||||
import { Permission } from "@janderedev/revolt.js/dist/permissions/definitions";
|
import { Permission } from "@janderedev/revolt.js/dist/permissions/definitions";
|
||||||
import { Message } from "@janderedev/revolt.js/dist/maps/Messages";
|
import { Message } from "@janderedev/revolt.js/dist/maps/Messages";
|
||||||
import { isSudo } from "./commands/botadm";
|
import { isSudo } from "./commands/admin/botadm";
|
||||||
import { SendableEmbed } from "revolt-api";
|
import { SendableEmbed } from "revolt-api";
|
||||||
|
|
||||||
const NO_MANAGER_MSG = '🔒 Missing permission';
|
const NO_MANAGER_MSG = '🔒 Missing permission';
|
||||||
|
|
|
@ -9,7 +9,7 @@ import ServerConfig from './struct/ServerConfig';
|
||||||
import Infraction from './struct/antispam/Infraction';
|
import Infraction from './struct/antispam/Infraction';
|
||||||
import PendingLogin from './struct/PendingLogin';
|
import PendingLogin from './struct/PendingLogin';
|
||||||
import TempBan from './struct/TempBan';
|
import TempBan from './struct/TempBan';
|
||||||
import { VoteEntry } from './bot/commands/votekick';
|
import { VoteEntry } from './bot/commands/moderation/votekick';
|
||||||
import ScannedUser from './struct/ScannedUser';
|
import ScannedUser from './struct/ScannedUser';
|
||||||
import BridgeRequest from './struct/BridgeRequest';
|
import BridgeRequest from './struct/BridgeRequest';
|
||||||
import BridgeConfig from './struct/BridgeConfig';
|
import BridgeConfig from './struct/BridgeConfig';
|
||||||
|
|
Loading…
Reference in a new issue