chore: Add type Context
This commit is contained in:
parent
34e9985bfd
commit
3202183d8e
4 changed files with 9 additions and 11 deletions
|
@ -1,3 +1,4 @@
|
|||
import type { Context } from '../lib/context'
|
||||
import { Learn, Text } from '../lib/databases'
|
||||
import { ApplyOptions } from '@sapphire/decorators'
|
||||
import { Command } from '@sapphire/framework'
|
||||
|
@ -33,9 +34,7 @@ export default class DataLengthCommand extends Command {
|
|||
return await this._run(interaction)
|
||||
}
|
||||
|
||||
private async _run(
|
||||
ctx: Message<true> | ChatInputCommandInteraction<'cached'>,
|
||||
) {
|
||||
private async _run(ctx: Context) {
|
||||
let userId: string
|
||||
let username: string
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import type { Context } from '../lib/context'
|
||||
import { MuffinCustomId } from '../lib/customId'
|
||||
import { Learn } from '../lib/databases'
|
||||
import { ApplyOptions } from '@sapphire/decorators'
|
||||
|
@ -49,10 +50,7 @@ export default class DeleteLearnedData extends Command {
|
|||
return await this._run(interaction)
|
||||
}
|
||||
|
||||
private async _run(
|
||||
ctx: Message<true> | ChatInputCommandInteraction<'cached'>,
|
||||
args?: Args,
|
||||
) {
|
||||
private async _run(ctx: Context, args?: Args) {
|
||||
let command: string | undefined
|
||||
let userId: string
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import type { Context } from '../lib/context'
|
||||
import { Learn } from '../lib/databases'
|
||||
import { ApplyOptions } from '@sapphire/decorators'
|
||||
import { Args, Command } from '@sapphire/framework'
|
||||
|
@ -53,10 +54,7 @@ export default class LearnCommand extends Command {
|
|||
return await this._run(interaction)
|
||||
}
|
||||
|
||||
private async _run(
|
||||
ctx: Message<true> | ChatInputCommandInteraction<'cached'>,
|
||||
args?: Args,
|
||||
) {
|
||||
private async _run(ctx: Context, args?: Args) {
|
||||
const userId = ctx instanceof Message ? ctx.author.id : ctx.user.id
|
||||
let command: string | undefined
|
||||
let result: string | undefined
|
||||
|
|
3
src/lib/context.ts
Normal file
3
src/lib/context.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
import type { ChatInputCommandInteraction, Message } from 'discord.js'
|
||||
|
||||
export type Context = Message<true> | ChatInputCommandInteraction<'cached'>
|
Reference in a new issue