mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
chore: resolve lint errors
This commit is contained in:
parent
59c5176cbd
commit
77ab2718e7
17 changed files with 16 additions and 40 deletions
|
@ -203,7 +203,7 @@ if (env.DEBUG) {
|
|||
}
|
||||
|
||||
logger.info("Connecting to database");
|
||||
connect().then(async (connection) => {
|
||||
connect().then(async () => {
|
||||
const client = new Client({
|
||||
partials: [Partials.User, Partials.Channel, Partials.GuildMember, Partials.Message, Partials.Reaction],
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ export async function userInfoAction(
|
|||
const utility = pluginData.getPlugin(UtilityPlugin);
|
||||
|
||||
if (userCfg.can_use && (await utility.hasPermission(executingMember, interaction.channelId, "can_userinfo"))) {
|
||||
const embed = await utility.userInfo(interaction.targetId, interaction.user.id);
|
||||
const embed = await utility.userInfo(interaction.targetId);
|
||||
if (!embed) {
|
||||
await interaction.followUp({ content: "Cannot info: internal error" });
|
||||
return;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { BasePluginType, CooldownManager, guildPluginEventListener } from "knub";
|
||||
import { ZodString, z } from "zod";
|
||||
import { z } from "zod";
|
||||
import { RegExpRunner } from "../../RegExpRunner";
|
||||
import { GuildArchives } from "../../data/GuildArchives";
|
||||
import { GuildCases } from "../../data/GuildCases";
|
||||
|
|
|
@ -169,8 +169,8 @@ export const UtilityPlugin = zeppelinGuildPlugin<UtilityPluginType>()({
|
|||
},
|
||||
|
||||
userInfo(pluginData) {
|
||||
return (userId: Snowflake, requestMemberId?: Snowflake) => {
|
||||
return getUserInfoEmbed(pluginData, userId, false, requestMemberId);
|
||||
return (userId: Snowflake) => {
|
||||
return getUserInfoEmbed(pluginData, userId, false);
|
||||
};
|
||||
},
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ export const InfoCmd = utilityCmd({
|
|||
const channelId = getChannelId(value);
|
||||
const channel = channelId && pluginData.guild.channels.cache.get(channelId as Snowflake);
|
||||
if (channel) {
|
||||
const embed = await getChannelInfoEmbed(pluginData, channelId!, message.author.id);
|
||||
const embed = await getChannelInfoEmbed(pluginData, channelId!);
|
||||
if (embed) {
|
||||
message.channel.send({ embeds: [embed] });
|
||||
return;
|
||||
|
@ -54,7 +54,7 @@ export const InfoCmd = utilityCmd({
|
|||
if (userCfg.can_server) {
|
||||
const guild = await pluginData.client.guilds.fetch(value as Snowflake).catch(noop);
|
||||
if (guild) {
|
||||
const embed = await getServerInfoEmbed(pluginData, value, message.author.id);
|
||||
const embed = await getServerInfoEmbed(pluginData, value);
|
||||
if (embed) {
|
||||
message.channel.send({ embeds: [embed] });
|
||||
return;
|
||||
|
@ -66,7 +66,7 @@ export const InfoCmd = utilityCmd({
|
|||
if (userCfg.can_userinfo) {
|
||||
const user = await resolveUser(pluginData.client, value);
|
||||
if (user && userCfg.can_userinfo) {
|
||||
const embed = await getUserInfoEmbed(pluginData, user.id, Boolean(args.compact), message.author.id);
|
||||
const embed = await getUserInfoEmbed(pluginData, user.id, Boolean(args.compact));
|
||||
if (embed) {
|
||||
message.channel.send({ embeds: [embed] });
|
||||
return;
|
||||
|
@ -83,7 +83,6 @@ export const InfoCmd = utilityCmd({
|
|||
pluginData,
|
||||
messageTarget.channel.id,
|
||||
messageTarget.messageId,
|
||||
message.author.id,
|
||||
);
|
||||
if (embed) {
|
||||
message.channel.send({ embeds: [embed] });
|
||||
|
@ -112,7 +111,7 @@ export const InfoCmd = utilityCmd({
|
|||
if (userCfg.can_server) {
|
||||
const serverPreview = await getGuildPreview(pluginData.client, value).catch(() => null);
|
||||
if (serverPreview) {
|
||||
const embed = await getServerInfoEmbed(pluginData, value, message.author.id);
|
||||
const embed = await getServerInfoEmbed(pluginData, value);
|
||||
if (embed) {
|
||||
message.channel.send({ embeds: [embed] });
|
||||
return;
|
||||
|
@ -125,7 +124,7 @@ export const InfoCmd = utilityCmd({
|
|||
const roleId = getRoleId(value);
|
||||
const role = roleId && pluginData.guild.roles.cache.get(roleId as Snowflake);
|
||||
if (role) {
|
||||
const embed = await getRoleInfoEmbed(pluginData, role, message.author.id);
|
||||
const embed = await getRoleInfoEmbed(pluginData, role);
|
||||
message.channel.send({ embeds: [embed] });
|
||||
return;
|
||||
}
|
||||
|
@ -145,7 +144,7 @@ export const InfoCmd = utilityCmd({
|
|||
|
||||
// 9. Arbitrary ID
|
||||
if (isValidSnowflake(value) && userCfg.can_snowflake) {
|
||||
const embed = await getSnowflakeInfoEmbed(pluginData, value, true, message.author.id);
|
||||
const embed = await getSnowflakeInfoEmbed(value, true);
|
||||
message.channel.send({ embeds: [embed] });
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ export const MessageInfoCmd = utilityCmd({
|
|||
pluginData,
|
||||
args.message.channel.id,
|
||||
args.message.messageId,
|
||||
message.author.id,
|
||||
);
|
||||
if (!embed) {
|
||||
sendErrorMessage(pluginData, message.channel, "Unknown message");
|
||||
|
|
|
@ -13,7 +13,7 @@ export const RoleInfoCmd = utilityCmd({
|
|||
},
|
||||
|
||||
async run({ message, args, pluginData }) {
|
||||
const embed = await getRoleInfoEmbed(pluginData, args.role, message.author.id);
|
||||
const embed = await getRoleInfoEmbed(pluginData, args.role);
|
||||
message.channel.send({ embeds: [embed] });
|
||||
},
|
||||
});
|
||||
|
|
|
@ -15,7 +15,7 @@ export const ServerInfoCmd = utilityCmd({
|
|||
|
||||
async run({ message, pluginData, args }) {
|
||||
const serverId = args.serverId || pluginData.guild.id;
|
||||
const serverInfoEmbed = await getServerInfoEmbed(pluginData, serverId, message.author.id);
|
||||
const serverInfoEmbed = await getServerInfoEmbed(pluginData, serverId);
|
||||
if (!serverInfoEmbed) {
|
||||
sendErrorMessage(pluginData, message.channel, "Could not find information for that server");
|
||||
return;
|
||||
|
|
|
@ -12,8 +12,8 @@ export const SnowflakeInfoCmd = utilityCmd({
|
|||
id: ct.anyId(),
|
||||
},
|
||||
|
||||
async run({ message, args, pluginData }) {
|
||||
const embed = await getSnowflakeInfoEmbed(pluginData, args.id, false, message.author.id);
|
||||
async run({ message, args }) {
|
||||
const embed = await getSnowflakeInfoEmbed(args.id, false);
|
||||
message.channel.send({ embeds: [embed] });
|
||||
},
|
||||
});
|
||||
|
|
|
@ -17,7 +17,7 @@ export const UserInfoCmd = utilityCmd({
|
|||
|
||||
async run({ message, args, pluginData }) {
|
||||
const userId = args.user?.id || message.author.id;
|
||||
const embed = await getUserInfoEmbed(pluginData, userId, args.compact, message.author.id);
|
||||
const embed = await getUserInfoEmbed(pluginData, userId, args.compact);
|
||||
if (!embed) {
|
||||
sendErrorMessage(pluginData, message.channel, "User not found");
|
||||
return;
|
||||
|
|
|
@ -22,7 +22,6 @@ const FORUM_CHANNEL_ICON =
|
|||
export async function getChannelInfoEmbed(
|
||||
pluginData: GuildPluginData<UtilityPluginType>,
|
||||
channelId: string,
|
||||
requestMemberId?: string,
|
||||
): Promise<APIEmbed | null> {
|
||||
const channel = pluginData.guild.channels.cache.get(channelId as Snowflake);
|
||||
if (!channel) {
|
||||
|
|
|
@ -9,7 +9,6 @@ import {
|
|||
trimEmptyLines,
|
||||
trimLines,
|
||||
} from "../../../utils";
|
||||
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
|
||||
import { UtilityPluginType } from "../types";
|
||||
|
||||
const MESSAGE_ICON = "https://cdn.discordapp.com/attachments/740650744830623756/740685652152025088/message.png";
|
||||
|
@ -18,7 +17,6 @@ export async function getMessageInfoEmbed(
|
|||
pluginData: GuildPluginData<UtilityPluginType>,
|
||||
channelId: string,
|
||||
messageId: string,
|
||||
requestMemberId?: string,
|
||||
): Promise<APIEmbed | null> {
|
||||
const message = await (pluginData.guild.channels.resolve(channelId as Snowflake) as TextChannel).messages
|
||||
.fetch(messageId as Snowflake)
|
||||
|
@ -27,8 +25,6 @@ export async function getMessageInfoEmbed(
|
|||
return null;
|
||||
}
|
||||
|
||||
const timeAndDate = pluginData.getPlugin(TimeAndDatePlugin);
|
||||
|
||||
const embed: EmbedWith<"fields" | "author"> = {
|
||||
fields: [],
|
||||
author: {
|
||||
|
|
|
@ -9,7 +9,6 @@ const MENTION_ICON = "https://cdn.discordapp.com/attachments/705009450855039042/
|
|||
export async function getRoleInfoEmbed(
|
||||
pluginData: GuildPluginData<UtilityPluginType>,
|
||||
role: Role,
|
||||
requestMemberId?: string,
|
||||
): Promise<APIEmbed> {
|
||||
const embed: EmbedWith<"fields" | "author" | "color"> = {
|
||||
fields: [],
|
||||
|
|
|
@ -25,7 +25,6 @@ const prettifyFeature = (feature: string): string =>
|
|||
export async function getServerInfoEmbed(
|
||||
pluginData: GuildPluginData<UtilityPluginType>,
|
||||
serverId: string,
|
||||
requestMemberId?: string,
|
||||
): Promise<APIEmbed | null> {
|
||||
const thisServer = serverId === pluginData.guild.id ? pluginData.guild : null;
|
||||
const [restGuild, guildPreview] = await Promise.all([
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
import { APIEmbed } from "discord.js";
|
||||
import { GuildPluginData } from "knub";
|
||||
import { EmbedWith, preEmbedPadding } from "../../../utils";
|
||||
import { snowflakeToTimestamp } from "../../../utils/snowflakeToTimestamp";
|
||||
import { UtilityPluginType } from "../types";
|
||||
|
||||
const SNOWFLAKE_ICON = "https://cdn.discordapp.com/attachments/740650744830623756/742020790471491668/snowflake.png";
|
||||
|
||||
export async function getSnowflakeInfoEmbed(
|
||||
pluginData: GuildPluginData<UtilityPluginType>,
|
||||
snowflake: string,
|
||||
showUnknownWarning = false,
|
||||
requestMemberId?: string,
|
||||
): Promise<APIEmbed> {
|
||||
const embed: EmbedWith<"fields" | "author"> = {
|
||||
fields: [],
|
||||
|
|
|
@ -13,7 +13,6 @@ import {
|
|||
trimLines,
|
||||
UnknownUser,
|
||||
} from "../../../utils";
|
||||
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
|
||||
import { UtilityPluginType } from "../types";
|
||||
|
||||
const MAX_ROLES_TO_DISPLAY = 15;
|
||||
|
@ -27,7 +26,6 @@ export async function getUserInfoEmbed(
|
|||
pluginData: GuildPluginData<UtilityPluginType>,
|
||||
userId: string,
|
||||
compact = false,
|
||||
requestMemberId?: string,
|
||||
): Promise<APIEmbed | null> {
|
||||
const user = await resolveUser(pluginData.client, userId);
|
||||
if (!user || user instanceof UnknownUser) {
|
||||
|
@ -40,8 +38,6 @@ export async function getUserInfoEmbed(
|
|||
fields: [],
|
||||
};
|
||||
|
||||
const timeAndDate = pluginData.getPlugin(TimeAndDatePlugin);
|
||||
|
||||
embed.author = {
|
||||
name: `${user.bot ? "Bot" : "User"}: ${renderUsername(user.username, user.discriminator)}`,
|
||||
};
|
||||
|
|
|
@ -150,13 +150,6 @@ export type GroupDMInvite = Invite & {
|
|||
type: typeof ChannelType.GroupDM;
|
||||
};
|
||||
|
||||
function isBoundedString(str: unknown, min: number, max: number): str is string {
|
||||
if (typeof str !== "string") {
|
||||
return false;
|
||||
}
|
||||
return (str.length >= min && str.length <= max);
|
||||
}
|
||||
|
||||
export function zBoundedCharacters(min: number, max: number) {
|
||||
return z.string().refine(str => {
|
||||
const len = [...str].length; // Unicode aware character split
|
||||
|
|
Loading…
Add table
Reference in a new issue