Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
chore: apply eslint warn
Browse files Browse the repository at this point in the history
  • Loading branch information
KagChi committed Feb 15, 2024
1 parent f6e054a commit 5fda44a
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-param-reassign */
/* eslint-disable @typescript-eslint/no-unsafe-argument */

import type { Message } from "@nezuchan/core";
import type { PieceContext } from "@sapphire/pieces";
import { Listener } from "../../Stores/Listener.js";
Expand Down
1 change: 0 additions & 1 deletion packages/framework/src/Listeners/Raw/InteractionCreate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unsafe-argument */
import { CommandInteraction, MessageContextMenuInteraction, UserContextMenuInteraction, AutoCompleteInteraction, MessageComponentInteraction, BaseInteraction, ModalSubmitInteraction } from "@nezuchan/core";
import type { LoaderPieceContext } from "@sapphire/pieces";
import type { GatewayInteractionCreateDispatch } from "discord-api-types/v10";
Expand Down
1 change: 0 additions & 1 deletion packages/framework/src/Listeners/Raw/MessageCreate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unsafe-argument */
import { Message } from "@nezuchan/core";
import type { LoaderPieceContext } from "@sapphire/pieces";
import type { GatewayMessageCreateDispatch } from "discord-api-types/v10";
Expand Down
11 changes: 5 additions & 6 deletions packages/framework/src/Preconditions/ClientTextPermissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,24 @@ import type { UserError } from "../Utilities/Errors/UserError.js";
export class ClientTextPermissions extends Precondition {
public async contextRun(ctx: CommandContext, command: Command, context: { permissions: PermissionsBitField; }): Promise<Result<unknown, UserError>> {
const guildId = ctx.isMessage() ? ctx.message.guildId! : ctx.interaction.guildId;
const user = ctx.isMessage() ? ctx.message.author : await ctx.interaction.member?.resolveUser({ cache: true });
const client = await this.container.client.resolveUser({ cache: true, id: this.container.client.clientId });
const channelId = ctx.isMessage() ? ctx.message.channelId : ctx.interaction.channelId;
return this.parseConditions(guildId, channelId, user, client, context);
return this.parseConditions(guildId, channelId, client, context);
}

public async interactionHandlerRun(interaction: BaseInteraction, handler: InteractionHandler, context: { permissions: PermissionsBitField; }): Promise<Result<unknown, UserError>> {
return this.parseConditions(interaction.guildId, interaction.channelId, await interaction.member?.resolveUser({ force: true }), await this.container.client.resolveUser({ cache: true, id: this.container.client.clientId }), context);
return this.parseConditions(interaction.guildId, interaction.channelId, await this.container.client.resolveUser({ cache: true, id: this.container.client.clientId }), context);
}

public async chatInputRun(interaction: CommandInteraction, command: Command, context: { permissions: PermissionsBitField; }): Promise<Result<unknown, UserError>> {
return this.parseConditions(interaction.guildId, interaction.channelId, await interaction.member?.resolveUser({ force: true }), await this.container.client.resolveUser({ cache: true, id: this.container.client.clientId }), context);
return this.parseConditions(interaction.guildId, interaction.channelId, await this.container.client.resolveUser({ cache: true, id: this.container.client.clientId }), context);
}

public async messageRun(message: Message, command: Command, context: { permissions: PermissionsBitField; }): Promise<Result<unknown, UserError>> {
return this.parseConditions(message.guildId, message.channelId, message.author, await this.container.client.resolveUser({ cache: true, id: this.container.client.clientId }), context);
return this.parseConditions(message.guildId, message.channelId, await this.container.client.resolveUser({ cache: true, id: this.container.client.clientId }), context);
}

public async parseConditions(guildId: string | null | undefined, channelId: string | null, user: User | null | undefined, client: User | null | undefined, context: { permissions: PermissionsBitField; }): Promise<Result<unknown, UserError>> {
public async parseConditions(guildId: string | null | undefined, channelId: string | null, client: User | null | undefined, context: { permissions: PermissionsBitField; }): Promise<Result<unknown, UserError>> {
if (guildId !== null && guildId !== undefined && client && channelId !== null) {
const channel = await this.container.client.resolveChannel({ id: channelId, guildId, cache: true });
const member = await this.container.client.resolveMember({ id: client.id, guildId, cache: true });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable stylistic/max-len */
/* eslint-disable @typescript-eslint/no-unsafe-argument */

import { inlineCode } from "@discordjs/builders";
import type { BaseInteraction, CommandInteraction, Message, PermissionsBitField } from "@nezuchan/core";
import type { Result } from "@sapphire/result";
Expand Down
1 change: 0 additions & 1 deletion packages/framework/src/Stores/CommandStore.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unsafe-argument */
import { AliasStore } from "@sapphire/pieces";
import type { RESTPostAPIApplicationCommandsJSONBody } from "discord-api-types/v10";
import { Routes } from "discord-api-types/v10";
Expand Down
2 changes: 1 addition & 1 deletion services/kanao-gateway/src/Stores/Listener.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable unicorn/no-nested-ternary */
/* eslint-disable @typescript-eslint/strict-boolean-expressions */

import type { EventEmitter } from "node:events";
import type { PieceContext, PieceOptions } from "@sapphire/pieces";
import { Piece } from "@sapphire/pieces";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
/* eslint-disable no-promise-executor-return */
/* eslint-disable consistent-return */

/* eslint-disable @typescript-eslint/no-confusing-void-expression */

import { Buffer } from "node:buffer";
import EventEmitter from "node:events";
import process from "node:process";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable unicorn/prefer-module */
/* eslint-disable promise/prefer-await-to-callbacks */

/* eslint-disable promise/always-return */

/* eslint-disable promise/prefer-await-to-then */
Expand Down

0 comments on commit 5fda44a

Please sign in to comment.