mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-20 09:43:59 +00:00
feat(bots/discord): add source
This commit is contained in:
15
bots/discord/src/utils/api/events.ts
Normal file
15
bots/discord/src/utils/api/events.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { ClientWebSocketEvents } from '@revanced/bot-api'
|
||||
import { api } from '../../context'
|
||||
|
||||
const { client } = api
|
||||
|
||||
export function on<Event extends EventName>(event: Event, listener: ListenerOf<Event>) {
|
||||
client.on(event, listener)
|
||||
}
|
||||
|
||||
export function once<Event extends EventName>(event: Event, listener: ListenerOf<Event>) {
|
||||
client.once(event, listener)
|
||||
}
|
||||
|
||||
export type EventName = keyof ClientWebSocketEvents
|
||||
export type ListenerOf<Event extends EventName> = ClientWebSocketEvents[Event]
|
||||
Reference in New Issue
Block a user