Skip to content

Commit 30d76f4

Browse files
committed
style: linting
1 parent e461388 commit 30d76f4

File tree

4 files changed

+44
-19
lines changed

4 files changed

+44
-19
lines changed

src/events.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import createJiti from 'jiti'
22
import { filename } from 'pathe/utils'
3-
import type { DefineEvent, DefineEventWithOptions, EventCallback, EventResult } from '../types'
3+
import type {
4+
DefineEvent,
5+
DefineEventWithOptions,
6+
EventCallback,
7+
EventResult
8+
} from '../types'
49

510
const jiti = createJiti(undefined as unknown as string, {
611
interopDefault: true,

src/harmony.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ export class Harmony {
2525
return this._events
2626
}
2727

28-
constructor() {}
28+
constructor() {}
2929

3030
public static async create(opts: LoadHarmonyConfigOptions) {
3131
const harmony = new Harmony()
3232

33-
await harmony._initConfig(opts)
34-
harmony._initCommands()
35-
harmony._initEvents()
33+
await harmony._initConfig(opts)
34+
harmony._initCommands()
35+
harmony._initEvents()
3636

37-
return harmony
37+
return harmony
3838
}
3939

4040
private async _initConfig(opts: LoadHarmonyConfigOptions) {
@@ -43,9 +43,9 @@ export class Harmony {
4343
}
4444

4545
private _initCommands() {
46-
if (!this._config || !this._cwd) {
47-
throw new Error("Configuration not initialized")
48-
}
46+
if (!this._config || !this._cwd) {
47+
throw new Error('Configuration not initialized')
48+
}
4949
const filesPath = getAllFiles(
5050
resolve(this._cwd, this._config!.dir.commands as string)
5151
)
@@ -60,9 +60,9 @@ export class Harmony {
6060
}
6161

6262
private _initEvents() {
63-
if (!this._config || !this._cwd) {
64-
throw new Error("Configuration not initialized")
65-
}
63+
if (!this._config || !this._cwd) {
64+
throw new Error('Configuration not initialized')
65+
}
6666
const filesPath = getAllFiles(
6767
resolve(this._cwd, this._config.dir.events as string)
6868
)
@@ -92,13 +92,15 @@ export class Harmony {
9292
name: c.name,
9393
description: c.description,
9494
options: c.arguments,
95-
nsfw: c.nsfw,
95+
nsfw: c.nsfw
9696
})
9797
}
9898
}
9999

100100
public initClient() {
101-
this._client = new Client({ intents: ['Guilds', 'GuildMessages', 'MessageContent'] })
101+
this._client = new Client({
102+
intents: ['Guilds', 'GuildMessages', 'MessageContent']
103+
})
102104

103105
this._refreshSlashCommands()
104106

types/commands.d.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
1-
import type { Client, Message, Interaction, CacheType, ChatInputCommandInteraction } from 'discord.js'
1+
import type {
2+
Client,
3+
Message,
4+
Interaction,
5+
CacheType,
6+
ChatInputCommandInteraction
7+
} from 'discord.js'
28

3-
export type MessageOrInteraction = Message | ChatInputCommandInteraction<CacheType>
9+
export type MessageOrInteraction =
10+
| Message
11+
| ChatInputCommandInteraction<CacheType>
412

5-
export type ExecuteArgument<Slash extends boolean> = Slash extends true ? ChatInputCommandInteraction<CacheType> : Slash extends false ? Message : MessageOrInteraction
13+
export type ExecuteArgument<Slash extends boolean> = Slash extends true
14+
? ChatInputCommandInteraction<CacheType>
15+
: Slash extends false
16+
? Message
17+
: MessageOrInteraction
618

7-
export type CommandExecute<Slash extends boolean> = (client: Client, entity: ExecuteArgument<Slash>) => void
19+
export type CommandExecute<Slash extends boolean> = (
20+
client: Client,
21+
entity: ExecuteArgument<Slash>
22+
) => void
823

924
export interface CommandResult<Slash extends boolean> {
1025
options: CommandOptions

types/events.d.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import type { Client } from 'discord.js'
33
export type EventCallback = (client: Client) => void
44

55
export type DefineEvent = (callback: EventCallback) => EventResult
6-
export type DefineEventWithOptions = (options: EventOptions, callback: EventCallback) => EventResult
6+
export type DefineEventWithOptions = (
7+
options: EventOptions,
8+
callback: EventCallback
9+
) => EventResult
710

811
export interface EventResult {
912
options: EventOptions

0 commit comments

Comments
 (0)