Consistent type imports and exports for bot
This commit is contained in:
parent
345eec93fc
commit
df1b9275ef
14 changed files with 25 additions and 15 deletions
|
@ -1,4 +1,4 @@
|
||||||
import { FindOneResult } from "monk";
|
import type { FindOneResult } from "monk";
|
||||||
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";
|
||||||
|
|
|
@ -23,7 +23,7 @@ import {
|
||||||
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";
|
||||||
import { SendableEmbed } from "revolt-api";
|
import type { SendableEmbed } from "revolt-api";
|
||||||
import { User } from "revolt.js";
|
import { User } from "revolt.js";
|
||||||
import logger from "../../logger";
|
import logger from "../../logger";
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { User } from "revolt.js";
|
import { User } from "revolt.js";
|
||||||
import { SendableEmbed } from "revolt-api";
|
import type { SendableEmbed } from "revolt-api";
|
||||||
import { ulid } from "ulid";
|
import { ulid } from "ulid";
|
||||||
import { client } from "../../../";
|
import { client } from "../../../";
|
||||||
import Infraction from "automod/dist/types/antispam/Infraction";
|
import Infraction from "automod/dist/types/antispam/Infraction";
|
||||||
|
|
|
@ -114,4 +114,4 @@ export default {
|
||||||
}
|
}
|
||||||
} as SimpleCommand;
|
} as SimpleCommand;
|
||||||
|
|
||||||
export { VoteEntry }
|
export type { VoteEntry }
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { ulid } from "ulid";
|
||||||
import InfractionType from "automod/dist/types/antispam/InfractionType";
|
import InfractionType from "automod/dist/types/antispam/InfractionType";
|
||||||
import { fetchUsername, logModAction } from "../../modules/mod_logs";
|
import { fetchUsername, logModAction } from "../../modules/mod_logs";
|
||||||
import CommandCategory from "../../../struct/commands/CommandCategory";
|
import CommandCategory from "../../../struct/commands/CommandCategory";
|
||||||
import { SendableEmbed } from "revolt-api";
|
import type { SendableEmbed } from "revolt-api";
|
||||||
import { User } from "revolt.js";
|
import { User } from "revolt.js";
|
||||||
import logger from "../../logger";
|
import logger from "../../logger";
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,8 @@ import { User } from "revolt.js";
|
||||||
import { client, dbs } from "../../..";
|
import { client, dbs } from "../../..";
|
||||||
import ServerConfig from "automod/dist/types/ServerConfig";
|
import ServerConfig from "automod/dist/types/ServerConfig";
|
||||||
import { getPermissionLevel } from "../../util";
|
import { getPermissionLevel } from "../../util";
|
||||||
import { wsEvents, WSResponse } from "../api_communication";
|
import type { WSResponse } from "../api_communication";
|
||||||
|
import { wsEvents } from "../api_communication";
|
||||||
|
|
||||||
type ReqData = { user: string, server: string }
|
type ReqData = { user: string, server: string }
|
||||||
type APIUser = { id: string, username?: string, avatarURL?: string }
|
type APIUser = { id: string, username?: string, avatarURL?: string }
|
||||||
|
@ -95,4 +96,4 @@ wsEvents.on('req:getUserServerDetails', async (data: ReqData, cb: (data: WSRespo
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export { APIUser }
|
export type { APIUser }
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import { User } from 'revolt.js';
|
import { User } from 'revolt.js';
|
||||||
import { client } from '../../..';
|
import { client } from '../../..';
|
||||||
import { getMutualServers, getPermissionLevel } from '../../util';
|
import { getMutualServers, getPermissionLevel } from '../../util';
|
||||||
import { wsEvents, WSResponse } from '../api_communication';
|
import type { WSResponse } from "../api_communication";
|
||||||
|
import { wsEvents } from "../api_communication";
|
||||||
|
|
||||||
type ReqData = { user: string }
|
type ReqData = { user: string }
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import { User } from "revolt.js";
|
import { User } from "revolt.js";
|
||||||
import { client } from "../../..";
|
import { client } from "../../..";
|
||||||
import { getPermissionLevel, parseUser } from "../../util";
|
import { getPermissionLevel, parseUser } from "../../util";
|
||||||
import { wsEvents, WSResponse } from "../api_communication";
|
import type { WSResponse } from "../api_communication";
|
||||||
import { APIUser } from "./server_details";
|
import { wsEvents } from "../api_communication";
|
||||||
|
import type { APIUser } from "./server_details";
|
||||||
|
|
||||||
wsEvents.on('req:getPermissionLevel', async (data: { user: string, server: string }, cb: (data: WSResponse) => void) => {
|
wsEvents.on('req:getPermissionLevel', async (data: { user: string, server: string }, cb: (data: WSResponse) => void) => {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -158,7 +158,8 @@ wsEvents.on("req:stats", async (_data: any, cb: (data: { servers: number }) => v
|
||||||
cb({ servers });
|
cb({ servers });
|
||||||
});
|
});
|
||||||
|
|
||||||
export { wsEvents, wsSend, WSResponse };
|
export { wsEvents, wsSend };
|
||||||
|
export type { WSResponse };
|
||||||
|
|
||||||
import("./api/servers");
|
import("./api/servers");
|
||||||
import("./api/server_details");
|
import("./api/server_details");
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { BLACKLIST_BAN_REASON, BLACKLIST_MESSAGE } from "../commands/admin/botad
|
||||||
import logger from "../logger";
|
import logger from "../logger";
|
||||||
import { storeInfraction } from "../util";
|
import { storeInfraction } from "../util";
|
||||||
import { DEFAULT_PREFIX } from "./command_handler";
|
import { DEFAULT_PREFIX } from "./command_handler";
|
||||||
import { SendableEmbed } from "revolt-api";
|
import type { SendableEmbed } from "revolt-api";
|
||||||
import { UserSystemMessage } from "revolt.js";
|
import { UserSystemMessage } from "revolt.js";
|
||||||
|
|
||||||
const DM_SESSION_LIFETIME = 1000 * 60 * 60 * 24 * 30;
|
const DM_SESSION_LIFETIME = 1000 * 60 * 60 * 24 * 30;
|
||||||
|
|
|
@ -11,7 +11,7 @@ import logger from "./logger";
|
||||||
import { Channel } from "revolt.js";
|
import { Channel } from "revolt.js";
|
||||||
import { Message } from "revolt.js";
|
import { Message } from "revolt.js";
|
||||||
import { isSudo } from "./commands/admin/botadm";
|
import { isSudo } from "./commands/admin/botadm";
|
||||||
import { SendableEmbed } from "revolt-api";
|
import type { SendableEmbed } from "revolt-api";
|
||||||
import ServerConfig from "automod/dist/types/ServerConfig";
|
import ServerConfig from "automod/dist/types/ServerConfig";
|
||||||
|
|
||||||
const NO_MANAGER_MSG = "🔒 Missing permission";
|
const NO_MANAGER_MSG = "🔒 Missing permission";
|
||||||
|
|
|
@ -9,7 +9,7 @@ import ServerConfig from 'automod/dist/types/ServerConfig';
|
||||||
import Infraction from 'automod/dist/types/antispam/Infraction';
|
import Infraction from 'automod/dist/types/antispam/Infraction';
|
||||||
import PendingLogin from 'automod/dist/types/PendingLogin';
|
import PendingLogin from 'automod/dist/types/PendingLogin';
|
||||||
import TempBan from 'automod/dist/types/TempBan';
|
import TempBan from 'automod/dist/types/TempBan';
|
||||||
import { VoteEntry } from './bot/commands/moderation/votekick';
|
import type { VoteEntry } from './bot/commands/moderation/votekick';
|
||||||
|
|
||||||
logger.info('Initializing client');
|
logger.info('Initializing client');
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as Revolt from "revolt.js";
|
import * as Revolt from "revolt.js";
|
||||||
import { IMonkManager } from 'monk';
|
import { IMonkManager } from 'monk';
|
||||||
import logger from '../bot/logger';
|
import logger from '../bot/logger';
|
||||||
import { ClientOptions } from "revolt.js";
|
import type { ClientOptions } from "revolt.js";
|
||||||
|
|
||||||
class AutomodClient extends Revolt.Client {
|
class AutomodClient extends Revolt.Client {
|
||||||
db: IMonkManager;
|
db: IMonkManager;
|
||||||
|
|
|
@ -4,6 +4,12 @@ import { Server } from "revolt.js";
|
||||||
class MessageCommandContext extends Message {
|
class MessageCommandContext extends Message {
|
||||||
// The server to which the command should be applied.
|
// The server to which the command should be applied.
|
||||||
serverContext: Server;
|
serverContext: Server;
|
||||||
|
|
||||||
|
constructor(messageData: any, channelData: any, serverContext: Server) {
|
||||||
|
// Assuming `Message` expects `messageData` and `channelData` as its arguments.
|
||||||
|
super(messageData, channelData);
|
||||||
|
this.serverContext = serverContext;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default MessageCommandContext;
|
export default MessageCommandContext;
|
||||||
|
|
Loading…
Reference in a new issue