zynko 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -2
- package/dist/bits.d.ts +42 -0
- package/dist/bits.js +46 -0
- package/dist/bits.js.map +1 -0
- package/dist/client.d.ts +132 -0
- package/dist/client.js +369 -0
- package/dist/client.js.map +1 -0
- package/dist/gateway.d.ts +28 -0
- package/dist/gateway.js +102 -0
- package/dist/gateway.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/interaction.d.ts +45 -0
- package/dist/interaction.js +73 -0
- package/dist/interaction.js.map +1 -0
- package/dist/message.d.ts +40 -0
- package/dist/message.js +67 -0
- package/dist/message.js.map +1 -0
- package/dist/player.d.ts +78 -0
- package/dist/player.js +230 -0
- package/dist/player.js.map +1 -0
- package/dist/rest.d.ts +122 -0
- package/dist/rest.js +129 -0
- package/dist/rest.js.map +1 -0
- package/dist/types.d.ts +306 -0
- package/dist/types.js +13 -0
- package/dist/types.js.map +1 -0
- package/dist/voice.d.ts +63 -0
- package/dist/voice.js +203 -0
- package/dist/voice.js.map +1 -0
- package/package.json +43 -4
package/README.md
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
-
#
|
|
1
|
+
# zynko
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A biblioteca oficial para bots do [Zynko](https://zynko.org): gateway com reconexão, cache de
|
|
4
|
+
servidores, canais e membros, a API inteira, e voz (tocar e ouvir áudio nas salas).
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
npm install zynko
|
|
8
|
+
npm install @livekit/rtc-node # só para voz
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { Client, Intents } from 'zynko';
|
|
13
|
+
|
|
14
|
+
const client = new Client({ token: process.env.ZYNKO_TOKEN!, intents: Intents.GUILDS | Intents.MESSAGES });
|
|
15
|
+
|
|
16
|
+
client.on('messageCreate', async (msg) => {
|
|
17
|
+
if (!msg.mine && msg.content === '!ping') await msg.reply('pong');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
await client.login();
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Voz:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
const voice = await client.joinVoice(channelId);
|
|
27
|
+
voice.player.enqueue('https://exemplo.com/musica.mp3');
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Node.js 22 ou mais novo. Para tocar arquivos e links, o ffmpeg precisa estar instalado.
|
|
31
|
+
|
|
32
|
+
Documentação: https://docs.zynko.org/bots/javascript · Crie seu bot: https://dev.zynko.org
|
|
33
|
+
|
|
34
|
+
Licença MIT.
|
package/dist/bits.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Intents: the kinds of event a bot asks the gateway for (docs.zynko.org/api/gateway#intents).
|
|
3
|
+
* READY, GUILD_CREATE, GUILD_DELETE, CHANNEL_CREATE and USER_UPDATE always arrive.
|
|
4
|
+
*/
|
|
5
|
+
export declare const Intents: {
|
|
6
|
+
/** Houses changing, and their channels, roles and emojis. */
|
|
7
|
+
readonly GUILDS: number;
|
|
8
|
+
/** Members joining, leaving or changing. */
|
|
9
|
+
readonly GUILD_MEMBERS: number;
|
|
10
|
+
/** Who is online. */
|
|
11
|
+
readonly PRESENCES: number;
|
|
12
|
+
/** Messages created, edited and deleted, in houses and DMs. */
|
|
13
|
+
readonly MESSAGES: number;
|
|
14
|
+
readonly REACTIONS: number;
|
|
15
|
+
readonly TYPING: number;
|
|
16
|
+
/** Who is in which voice room. A bot that joins voice needs it. */
|
|
17
|
+
readonly VOICE_STATES: number;
|
|
18
|
+
readonly ALL: number;
|
|
19
|
+
};
|
|
20
|
+
/** Role permissions, as bits (docs.zynko.org/api/permissoes). */
|
|
21
|
+
export declare const Permissions: {
|
|
22
|
+
readonly ADMINISTRATOR: number;
|
|
23
|
+
readonly MANAGE_GUILD: number;
|
|
24
|
+
readonly MANAGE_CHANNELS: number;
|
|
25
|
+
readonly MANAGE_ROLES: number;
|
|
26
|
+
readonly KICK_MEMBERS: number;
|
|
27
|
+
readonly BAN_MEMBERS: number;
|
|
28
|
+
readonly MANAGE_MESSAGES: number;
|
|
29
|
+
readonly MANAGE_NICKNAMES: number;
|
|
30
|
+
readonly CREATE_INVITE: number;
|
|
31
|
+
readonly SEND_MESSAGES: number;
|
|
32
|
+
readonly ATTACH_FILES: number;
|
|
33
|
+
readonly CONNECT: number;
|
|
34
|
+
readonly SPEAK: number;
|
|
35
|
+
readonly MANAGE_EMOJIS: number;
|
|
36
|
+
readonly VIEW_CHANNEL: number;
|
|
37
|
+
readonly ADD_REACTIONS: number;
|
|
38
|
+
readonly READ_MESSAGE_HISTORY: number;
|
|
39
|
+
readonly STREAM: number;
|
|
40
|
+
};
|
|
41
|
+
/** When an id was made, in milliseconds since 1970 (ids are snowflakes). */
|
|
42
|
+
export declare function idTime(id: string): number;
|
package/dist/bits.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Intents: the kinds of event a bot asks the gateway for (docs.zynko.org/api/gateway#intents).
|
|
3
|
+
* READY, GUILD_CREATE, GUILD_DELETE, CHANNEL_CREATE and USER_UPDATE always arrive.
|
|
4
|
+
*/
|
|
5
|
+
export const Intents = {
|
|
6
|
+
/** Houses changing, and their channels, roles and emojis. */
|
|
7
|
+
GUILDS: 1 << 0,
|
|
8
|
+
/** Members joining, leaving or changing. */
|
|
9
|
+
GUILD_MEMBERS: 1 << 1,
|
|
10
|
+
/** Who is online. */
|
|
11
|
+
PRESENCES: 1 << 2,
|
|
12
|
+
/** Messages created, edited and deleted, in houses and DMs. */
|
|
13
|
+
MESSAGES: 1 << 3,
|
|
14
|
+
REACTIONS: 1 << 4,
|
|
15
|
+
TYPING: 1 << 5,
|
|
16
|
+
/** Who is in which voice room. A bot that joins voice needs it. */
|
|
17
|
+
VOICE_STATES: 1 << 6,
|
|
18
|
+
ALL: (1 << 7) - 1,
|
|
19
|
+
};
|
|
20
|
+
/** Role permissions, as bits (docs.zynko.org/api/permissoes). */
|
|
21
|
+
export const Permissions = {
|
|
22
|
+
ADMINISTRATOR: 1 << 0,
|
|
23
|
+
MANAGE_GUILD: 1 << 1,
|
|
24
|
+
MANAGE_CHANNELS: 1 << 2,
|
|
25
|
+
MANAGE_ROLES: 1 << 3,
|
|
26
|
+
KICK_MEMBERS: 1 << 4,
|
|
27
|
+
BAN_MEMBERS: 1 << 5,
|
|
28
|
+
MANAGE_MESSAGES: 1 << 6,
|
|
29
|
+
MANAGE_NICKNAMES: 1 << 7,
|
|
30
|
+
CREATE_INVITE: 1 << 8,
|
|
31
|
+
SEND_MESSAGES: 1 << 9,
|
|
32
|
+
ATTACH_FILES: 1 << 10,
|
|
33
|
+
CONNECT: 1 << 11,
|
|
34
|
+
SPEAK: 1 << 12,
|
|
35
|
+
MANAGE_EMOJIS: 1 << 13,
|
|
36
|
+
VIEW_CHANNEL: 1 << 14,
|
|
37
|
+
ADD_REACTIONS: 1 << 15,
|
|
38
|
+
READ_MESSAGE_HISTORY: 1 << 16,
|
|
39
|
+
STREAM: 1 << 17,
|
|
40
|
+
};
|
|
41
|
+
const EPOCH_MS = 1_767_225_600_000;
|
|
42
|
+
/** When an id was made, in milliseconds since 1970 (ids are snowflakes). */
|
|
43
|
+
export function idTime(id) {
|
|
44
|
+
return Number(BigInt(id) >> 22n) + EPOCH_MS;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=bits.js.map
|
package/dist/bits.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bits.js","sourceRoot":"","sources":["../src/bits.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,6DAA6D;IAC7D,MAAM,EAAE,CAAC,IAAI,CAAC;IACd,4CAA4C;IAC5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AAC"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Interaction } from './interaction.js';
|
|
2
|
+
import { Message } from './message.js';
|
|
3
|
+
import { Rest, type SendOptions } from './rest.js';
|
|
4
|
+
import type { Channel, Command, Emoji, Guild, Id, Member, MessageUpdate, ReactionEvent, Role, TypingEvent, User, VoiceState } from './types.js';
|
|
5
|
+
import type { JoinVoiceOptions, VoiceConnection } from './voice.js';
|
|
6
|
+
/** A house as the client keeps it, updated by the gateway's events. */
|
|
7
|
+
export interface CachedGuild extends Guild {
|
|
8
|
+
channels: Map<Id, Channel>;
|
|
9
|
+
members: Map<Id, Member>;
|
|
10
|
+
roles: Map<Id, Role>;
|
|
11
|
+
emojis: Emoji[];
|
|
12
|
+
/** Ids of members online now (needs the PRESENCES intent to stay current). */
|
|
13
|
+
online: Set<Id>;
|
|
14
|
+
}
|
|
15
|
+
export interface ClientEvents {
|
|
16
|
+
/** Connected (again): the caches were rebuilt from READY. */
|
|
17
|
+
ready: [user: User];
|
|
18
|
+
messageCreate: [message: Message];
|
|
19
|
+
/** Partial: only what changed (see MessageUpdate). */
|
|
20
|
+
messageUpdate: [update: MessageUpdate];
|
|
21
|
+
messageDelete: [data: {
|
|
22
|
+
id: Id;
|
|
23
|
+
channel_id: Id;
|
|
24
|
+
}];
|
|
25
|
+
reactionAdd: [reaction: ReactionEvent];
|
|
26
|
+
reactionRemove: [reaction: ReactionEvent];
|
|
27
|
+
typingStart: [typing: TypingEvent];
|
|
28
|
+
/** Added to a house, or connected with it in READY's list. */
|
|
29
|
+
guildCreate: [guild: CachedGuild];
|
|
30
|
+
guildUpdate: [guild: CachedGuild];
|
|
31
|
+
/** Removed from a house, or the house was deleted. */
|
|
32
|
+
guildDelete: [guildId: Id];
|
|
33
|
+
channelCreate: [channel: Channel];
|
|
34
|
+
channelUpdate: [channel: Channel, previous: Channel | undefined];
|
|
35
|
+
channelDelete: [channel: Channel];
|
|
36
|
+
memberAdd: [member: Member];
|
|
37
|
+
memberUpdate: [member: Member, previous: Member | undefined];
|
|
38
|
+
memberRemove: [data: {
|
|
39
|
+
guild_id: Id;
|
|
40
|
+
user_id: Id;
|
|
41
|
+
}];
|
|
42
|
+
presenceUpdate: [data: {
|
|
43
|
+
user_id: Id;
|
|
44
|
+
status: 'online' | 'offline';
|
|
45
|
+
}];
|
|
46
|
+
voiceStateUpdate: [state: VoiceState, previous: VoiceState | undefined];
|
|
47
|
+
/** Someone used one of the bot's "/" commands, or clicked a button on its message. */
|
|
48
|
+
interaction: [interaction: Interaction];
|
|
49
|
+
/** Every gateway event, as it came. */
|
|
50
|
+
raw: [type: string, data: any];
|
|
51
|
+
/** The link dropped; the client is connecting again. */
|
|
52
|
+
reconnecting: [info: {
|
|
53
|
+
code: number;
|
|
54
|
+
reason: string;
|
|
55
|
+
wait: number;
|
|
56
|
+
}];
|
|
57
|
+
error: [error: Error];
|
|
58
|
+
}
|
|
59
|
+
export interface ClientOptions {
|
|
60
|
+
/** The bot's token (dev.zynko.org). Keep it out of the code: an environment variable. */
|
|
61
|
+
token: string;
|
|
62
|
+
/** What to receive (see `Intents`). Default: houses and messages. */
|
|
63
|
+
intents?: number;
|
|
64
|
+
/** https://zynko.org/api unless you run your own server. */
|
|
65
|
+
api?: string;
|
|
66
|
+
/** The gateway; worked out from `api` unless given. */
|
|
67
|
+
gateway?: string;
|
|
68
|
+
}
|
|
69
|
+
type Listener<K extends keyof ClientEvents> = (...args: ClientEvents[K]) => unknown;
|
|
70
|
+
/**
|
|
71
|
+
* A Zynko bot: connects to the gateway, keeps houses, channels and members up to date,
|
|
72
|
+
* and turns events into `on(...)` calls.
|
|
73
|
+
*
|
|
74
|
+
* ```ts
|
|
75
|
+
* const client = new Client({ token: process.env.ZYNKO_TOKEN!, intents: Intents.GUILDS | Intents.MESSAGES });
|
|
76
|
+
* client.on('messageCreate', (msg) => msg.content === '!ping' && msg.reply('pong'));
|
|
77
|
+
* await client.login();
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare class Client {
|
|
81
|
+
readonly rest: Rest;
|
|
82
|
+
readonly intents: number;
|
|
83
|
+
user: User | null;
|
|
84
|
+
sessionId: string;
|
|
85
|
+
readonly guilds: Map<string, CachedGuild>;
|
|
86
|
+
/** Every channel the bot sees, DMs included. */
|
|
87
|
+
readonly channels: Map<string, Channel>;
|
|
88
|
+
readonly users: Map<string, User>;
|
|
89
|
+
/** Who is in voice, by user id (needs VOICE_STATES). */
|
|
90
|
+
readonly voiceStates: Map<string, VoiceState>;
|
|
91
|
+
/** The voice room the bot is in: one at a time, as for anyone. */
|
|
92
|
+
voice: VoiceConnection | null;
|
|
93
|
+
private readonly emitter;
|
|
94
|
+
private readonly gateway;
|
|
95
|
+
private firstReady;
|
|
96
|
+
constructor(opts: ClientOptions);
|
|
97
|
+
on<K extends keyof ClientEvents>(event: K, listener: Listener<K>): this;
|
|
98
|
+
once<K extends keyof ClientEvents>(event: K, listener: Listener<K>): this;
|
|
99
|
+
off<K extends keyof ClientEvents>(event: K, listener: Listener<K>): this;
|
|
100
|
+
/** Waits for the next occurrence of an event, optionally one that passes `filter`. */
|
|
101
|
+
wait<K extends keyof ClientEvents>(event: K, filter?: (...args: ClientEvents[K]) => boolean, timeoutMs?: number): Promise<ClientEvents[K]>;
|
|
102
|
+
private emit;
|
|
103
|
+
/** A listener that throws (or rejects) becomes an `error` event instead of a crash. */
|
|
104
|
+
private call;
|
|
105
|
+
/** Connects; resolves with the bot's account once READY arrives. */
|
|
106
|
+
login(): Promise<User>;
|
|
107
|
+
/** Leaves voice and closes the link. */
|
|
108
|
+
destroy(): Promise<void>;
|
|
109
|
+
/** Sends a gateway op. Used by the voice connection (op 4). */
|
|
110
|
+
sendOp(op: number, d: unknown): boolean;
|
|
111
|
+
/** Sends a message to a channel; files are uploaded first. */
|
|
112
|
+
send(channelId: Id, message: string | SendOptions): Promise<Message>;
|
|
113
|
+
/** Sends someone a direct message. */
|
|
114
|
+
sendDm(userId: Id, message: string | SendOptions): Promise<Message>;
|
|
115
|
+
/** Replaces all of the bot's "/" commands (they show up in the apps right away). */
|
|
116
|
+
setCommands(commands: Command[]): Promise<Command[]>;
|
|
117
|
+
/** Joins a voice room to play (and optionally hear) audio. Needs the `@livekit/rtc-node` package. */
|
|
118
|
+
joinVoice(channelId: Id, opts?: JoinVoiceOptions): Promise<VoiceConnection>;
|
|
119
|
+
/**
|
|
120
|
+
* What someone may do in a channel, the server's way: @everyone and their roles, then the
|
|
121
|
+
* channel's overwrites. Owners and admins may do everything.
|
|
122
|
+
*/
|
|
123
|
+
permissionsIn(channelId: Id, userId: Id): number;
|
|
124
|
+
/** Whether someone has a permission in a channel (see `Permissions`). */
|
|
125
|
+
can(channelId: Id, userId: Id, permission: number): boolean;
|
|
126
|
+
/** A full link to an avatar, emoji or other `/api/...` path the API hands out. */
|
|
127
|
+
link(path: string | null | undefined): string | null;
|
|
128
|
+
private addGuild;
|
|
129
|
+
private dropGuild;
|
|
130
|
+
private dispatch;
|
|
131
|
+
}
|
|
132
|
+
export {};
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import { Intents, Permissions } from './bits.js';
|
|
3
|
+
import { Gateway } from './gateway.js';
|
|
4
|
+
import { Interaction } from './interaction.js';
|
|
5
|
+
import { Message } from './message.js';
|
|
6
|
+
import { Rest } from './rest.js';
|
|
7
|
+
/**
|
|
8
|
+
* A Zynko bot: connects to the gateway, keeps houses, channels and members up to date,
|
|
9
|
+
* and turns events into `on(...)` calls.
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* const client = new Client({ token: process.env.ZYNKO_TOKEN!, intents: Intents.GUILDS | Intents.MESSAGES });
|
|
13
|
+
* client.on('messageCreate', (msg) => msg.content === '!ping' && msg.reply('pong'));
|
|
14
|
+
* await client.login();
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export class Client {
|
|
18
|
+
rest;
|
|
19
|
+
intents;
|
|
20
|
+
user = null;
|
|
21
|
+
sessionId = '';
|
|
22
|
+
guilds = new Map();
|
|
23
|
+
/** Every channel the bot sees, DMs included. */
|
|
24
|
+
channels = new Map();
|
|
25
|
+
users = new Map();
|
|
26
|
+
/** Who is in voice, by user id (needs VOICE_STATES). */
|
|
27
|
+
voiceStates = new Map();
|
|
28
|
+
/** The voice room the bot is in: one at a time, as for anyone. */
|
|
29
|
+
voice = null;
|
|
30
|
+
emitter = new EventEmitter();
|
|
31
|
+
gateway;
|
|
32
|
+
firstReady = null;
|
|
33
|
+
constructor(opts) {
|
|
34
|
+
if (!opts.token)
|
|
35
|
+
throw new Error('Falta o token do bot (crie um em dev.zynko.org)');
|
|
36
|
+
this.rest = new Rest({ token: opts.token, api: opts.api });
|
|
37
|
+
this.intents = opts.intents ?? Intents.GUILDS | Intents.MESSAGES;
|
|
38
|
+
const url = opts.gateway ?? this.rest.api.replace(/^http/, 'ws') + '/gateway';
|
|
39
|
+
this.gateway = new Gateway({
|
|
40
|
+
url,
|
|
41
|
+
token: opts.token,
|
|
42
|
+
intents: this.intents,
|
|
43
|
+
onDispatch: (t, d) => this.dispatch(t, d),
|
|
44
|
+
onState: (state, detail) => {
|
|
45
|
+
if (state === 'reconnecting' && detail)
|
|
46
|
+
this.emit('reconnecting', detail);
|
|
47
|
+
if (state === 'closed') {
|
|
48
|
+
const err = detail instanceof Error ? detail : new Error('Gateway fechado');
|
|
49
|
+
if (this.firstReady)
|
|
50
|
+
this.firstReady.reject(err);
|
|
51
|
+
else
|
|
52
|
+
this.emit('error', err);
|
|
53
|
+
this.firstReady = null;
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
// An error nobody listens to would crash the process.
|
|
58
|
+
this.emitter.on('error', () => { });
|
|
59
|
+
}
|
|
60
|
+
on(event, listener) {
|
|
61
|
+
this.emitter.on(event, (...args) => this.call(listener, args));
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
once(event, listener) {
|
|
65
|
+
this.emitter.once(event, (...args) => this.call(listener, args));
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
68
|
+
off(event, listener) {
|
|
69
|
+
this.emitter.off(event, listener);
|
|
70
|
+
return this;
|
|
71
|
+
}
|
|
72
|
+
/** Waits for the next occurrence of an event, optionally one that passes `filter`. */
|
|
73
|
+
wait(event, filter, timeoutMs = 30_000) {
|
|
74
|
+
return new Promise((resolve, reject) => {
|
|
75
|
+
const t = setTimeout(() => (this.emitter.off(event, h), reject(new Error(`Esperando ${event}: tempo esgotado`))), timeoutMs);
|
|
76
|
+
const h = (...args) => {
|
|
77
|
+
if (filter && !filter(...args))
|
|
78
|
+
return;
|
|
79
|
+
clearTimeout(t);
|
|
80
|
+
this.emitter.off(event, h);
|
|
81
|
+
resolve(args);
|
|
82
|
+
};
|
|
83
|
+
this.emitter.on(event, h);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
emit(event, ...args) {
|
|
87
|
+
this.emitter.emit(event, ...args);
|
|
88
|
+
}
|
|
89
|
+
/** A listener that throws (or rejects) becomes an `error` event instead of a crash. */
|
|
90
|
+
call(listener, args) {
|
|
91
|
+
try {
|
|
92
|
+
const r = listener(...args);
|
|
93
|
+
if (r instanceof Promise)
|
|
94
|
+
r.catch((e) => this.emit('error', e instanceof Error ? e : new Error(String(e))));
|
|
95
|
+
}
|
|
96
|
+
catch (e) {
|
|
97
|
+
this.emit('error', e instanceof Error ? e : new Error(String(e)));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/** Connects; resolves with the bot's account once READY arrives. */
|
|
101
|
+
login() {
|
|
102
|
+
return new Promise((resolve, reject) => {
|
|
103
|
+
this.firstReady = { resolve, reject };
|
|
104
|
+
this.gateway.connect();
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
/** Leaves voice and closes the link. */
|
|
108
|
+
async destroy() {
|
|
109
|
+
await this.voice?.leave();
|
|
110
|
+
this.gateway.close();
|
|
111
|
+
}
|
|
112
|
+
/** Sends a gateway op. Used by the voice connection (op 4). */
|
|
113
|
+
sendOp(op, d) {
|
|
114
|
+
return this.gateway.send(op, d);
|
|
115
|
+
}
|
|
116
|
+
// ---------- shortcuts ----------
|
|
117
|
+
/** Sends a message to a channel; files are uploaded first. */
|
|
118
|
+
async send(channelId, message) {
|
|
119
|
+
return new Message(this, await this.rest.send(channelId, message));
|
|
120
|
+
}
|
|
121
|
+
/** Sends someone a direct message. */
|
|
122
|
+
async sendDm(userId, message) {
|
|
123
|
+
const dm = await this.rest.dm(userId);
|
|
124
|
+
this.channels.set(dm.id, dm);
|
|
125
|
+
return this.send(dm.id, message);
|
|
126
|
+
}
|
|
127
|
+
/** Replaces all of the bot's "/" commands (they show up in the apps right away). */
|
|
128
|
+
setCommands(commands) {
|
|
129
|
+
return this.rest.setCommands(commands);
|
|
130
|
+
}
|
|
131
|
+
/** Joins a voice room to play (and optionally hear) audio. Needs the `@livekit/rtc-node` package. */
|
|
132
|
+
async joinVoice(channelId, opts = {}) {
|
|
133
|
+
const { VoiceConnection } = await import('./voice.js');
|
|
134
|
+
if (this.voice?.channelId === channelId)
|
|
135
|
+
return this.voice;
|
|
136
|
+
await this.voice?.leave();
|
|
137
|
+
const conn = new VoiceConnection(this, channelId, opts);
|
|
138
|
+
this.voice = conn;
|
|
139
|
+
try {
|
|
140
|
+
await conn.connect();
|
|
141
|
+
}
|
|
142
|
+
catch (e) {
|
|
143
|
+
if (this.voice === conn)
|
|
144
|
+
this.voice = null;
|
|
145
|
+
await conn.leave().catch(() => { });
|
|
146
|
+
throw e;
|
|
147
|
+
}
|
|
148
|
+
return conn;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* What someone may do in a channel, the server's way: @everyone and their roles, then the
|
|
152
|
+
* channel's overwrites. Owners and admins may do everything.
|
|
153
|
+
*/
|
|
154
|
+
permissionsIn(channelId, userId) {
|
|
155
|
+
const ALL = (1 << 18) - 1;
|
|
156
|
+
const channel = this.channels.get(channelId);
|
|
157
|
+
const guild = channel?.guild_id ? this.guilds.get(channel.guild_id) : undefined;
|
|
158
|
+
if (!channel || !guild)
|
|
159
|
+
return 0;
|
|
160
|
+
const member = guild.members.get(userId);
|
|
161
|
+
if (!member)
|
|
162
|
+
return 0;
|
|
163
|
+
if (guild.owner_id === userId || member.is_admin)
|
|
164
|
+
return ALL;
|
|
165
|
+
let base = guild.roles.get(guild.id)?.permissions ?? 0;
|
|
166
|
+
for (const r of member.roles)
|
|
167
|
+
base |= guild.roles.get(r)?.permissions ?? 0;
|
|
168
|
+
if (base & Permissions.ADMINISTRATOR)
|
|
169
|
+
return ALL;
|
|
170
|
+
const overwrites = channel.permission_overwrites ?? [];
|
|
171
|
+
let p = base;
|
|
172
|
+
const everyone = overwrites.find((o) => o.type === 0 && o.id === guild.id);
|
|
173
|
+
if (everyone)
|
|
174
|
+
p = (p & ~everyone.deny) | everyone.allow;
|
|
175
|
+
let allow = 0;
|
|
176
|
+
let deny = 0;
|
|
177
|
+
for (const o of overwrites) {
|
|
178
|
+
if (o.type === 0 && o.id !== guild.id && member.roles.includes(o.id)) {
|
|
179
|
+
allow |= o.allow;
|
|
180
|
+
deny |= o.deny;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
p = (p & ~deny) | allow;
|
|
184
|
+
const own = overwrites.find((o) => o.type === 1 && o.id === userId);
|
|
185
|
+
if (own)
|
|
186
|
+
p = (p & ~own.deny) | own.allow;
|
|
187
|
+
if (!(p & Permissions.VIEW_CHANNEL))
|
|
188
|
+
return 0;
|
|
189
|
+
if (!(p & Permissions.SEND_MESSAGES))
|
|
190
|
+
p &= ~Permissions.ATTACH_FILES;
|
|
191
|
+
if (!(p & Permissions.CONNECT))
|
|
192
|
+
p &= ~(Permissions.SPEAK | Permissions.STREAM);
|
|
193
|
+
return p;
|
|
194
|
+
}
|
|
195
|
+
/** Whether someone has a permission in a channel (see `Permissions`). */
|
|
196
|
+
can(channelId, userId, permission) {
|
|
197
|
+
return (this.permissionsIn(channelId, userId) & permission) === permission;
|
|
198
|
+
}
|
|
199
|
+
/** A full link to an avatar, emoji or other `/api/...` path the API hands out. */
|
|
200
|
+
link(path) {
|
|
201
|
+
if (!path)
|
|
202
|
+
return null;
|
|
203
|
+
return /^https?:/.test(path) ? path : this.rest.base + path;
|
|
204
|
+
}
|
|
205
|
+
// ---------- cache ----------
|
|
206
|
+
addGuild(g) {
|
|
207
|
+
const { channels, members, roles, emojis, presences, ...guild } = g;
|
|
208
|
+
const cached = {
|
|
209
|
+
...guild,
|
|
210
|
+
channels: new Map(channels.map((c) => [c.id, c])),
|
|
211
|
+
members: new Map(members.map((m) => [m.user.id, m])),
|
|
212
|
+
roles: new Map(roles.map((r) => [r.id, r])),
|
|
213
|
+
emojis,
|
|
214
|
+
online: new Set(presences),
|
|
215
|
+
};
|
|
216
|
+
for (const c of channels)
|
|
217
|
+
this.channels.set(c.id, c);
|
|
218
|
+
for (const m of members)
|
|
219
|
+
this.users.set(m.user.id, m.user);
|
|
220
|
+
this.guilds.set(guild.id, cached);
|
|
221
|
+
return cached;
|
|
222
|
+
}
|
|
223
|
+
dropGuild(id) {
|
|
224
|
+
const g = this.guilds.get(id);
|
|
225
|
+
if (!g)
|
|
226
|
+
return;
|
|
227
|
+
for (const c of g.channels.keys())
|
|
228
|
+
this.channels.delete(c);
|
|
229
|
+
this.guilds.delete(id);
|
|
230
|
+
}
|
|
231
|
+
dispatch(t, d) {
|
|
232
|
+
this.emit('raw', t, d);
|
|
233
|
+
switch (t) {
|
|
234
|
+
case 'READY': {
|
|
235
|
+
const r = d;
|
|
236
|
+
this.user = r.user;
|
|
237
|
+
this.sessionId = r.session_id;
|
|
238
|
+
this.guilds.clear();
|
|
239
|
+
this.channels.clear();
|
|
240
|
+
this.voiceStates.clear();
|
|
241
|
+
for (const g of r.guilds)
|
|
242
|
+
this.addGuild(g);
|
|
243
|
+
for (const c of r.dm_channels) {
|
|
244
|
+
this.channels.set(c.id, c);
|
|
245
|
+
for (const u of c.recipients ?? [])
|
|
246
|
+
this.users.set(u.id, u);
|
|
247
|
+
}
|
|
248
|
+
for (const v of r.voice_states)
|
|
249
|
+
if (v.channel_id)
|
|
250
|
+
this.voiceStates.set(v.user_id, v);
|
|
251
|
+
this.firstReady?.resolve(r.user);
|
|
252
|
+
this.firstReady = null;
|
|
253
|
+
this.voice?.resync();
|
|
254
|
+
this.emit('ready', r.user);
|
|
255
|
+
for (const g of this.guilds.values())
|
|
256
|
+
this.emit('guildCreate', g);
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
case 'GUILD_CREATE':
|
|
260
|
+
return this.emit('guildCreate', this.addGuild(d));
|
|
261
|
+
case 'GUILD_UPDATE': {
|
|
262
|
+
const g = this.guilds.get(d.id);
|
|
263
|
+
if (!g)
|
|
264
|
+
return;
|
|
265
|
+
Object.assign(g, { name: d.name, icon: d.icon, owner_id: d.owner_id });
|
|
266
|
+
return this.emit('guildUpdate', g);
|
|
267
|
+
}
|
|
268
|
+
case 'GUILD_DELETE':
|
|
269
|
+
this.dropGuild(d.id);
|
|
270
|
+
return this.emit('guildDelete', d.id);
|
|
271
|
+
case 'GUILD_ROLE_CREATE':
|
|
272
|
+
case 'GUILD_ROLE_UPDATE':
|
|
273
|
+
this.guilds.get(d.guild_id)?.roles.set(d.id, d);
|
|
274
|
+
return;
|
|
275
|
+
case 'GUILD_ROLE_DELETE':
|
|
276
|
+
this.guilds.get(d.guild_id)?.roles.delete(d.role_id ?? d.id);
|
|
277
|
+
return;
|
|
278
|
+
case 'GUILD_EMOJIS_UPDATE': {
|
|
279
|
+
const g = this.guilds.get(d.guild_id);
|
|
280
|
+
if (g)
|
|
281
|
+
g.emojis = d.emojis;
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
case 'CHANNEL_CREATE':
|
|
285
|
+
case 'CHANNEL_UPDATE': {
|
|
286
|
+
const c = d;
|
|
287
|
+
const previous = this.channels.get(c.id);
|
|
288
|
+
if (previous?.recipients && !c.recipients)
|
|
289
|
+
c.recipients = previous.recipients;
|
|
290
|
+
this.channels.set(c.id, c);
|
|
291
|
+
if (c.guild_id)
|
|
292
|
+
this.guilds.get(c.guild_id)?.channels.set(c.id, c);
|
|
293
|
+
for (const u of c.recipients ?? [])
|
|
294
|
+
this.users.set(u.id, u);
|
|
295
|
+
if (t === 'CHANNEL_CREATE')
|
|
296
|
+
return this.emit('channelCreate', c);
|
|
297
|
+
this.voice?.onChannelUpdate(c);
|
|
298
|
+
return this.emit('channelUpdate', c, previous);
|
|
299
|
+
}
|
|
300
|
+
case 'CHANNEL_DELETE': {
|
|
301
|
+
this.channels.delete(d.id);
|
|
302
|
+
if (d.guild_id)
|
|
303
|
+
this.guilds.get(d.guild_id)?.channels.delete(d.id);
|
|
304
|
+
return this.emit('channelDelete', d);
|
|
305
|
+
}
|
|
306
|
+
case 'GUILD_MEMBER_ADD':
|
|
307
|
+
case 'GUILD_MEMBER_UPDATE': {
|
|
308
|
+
const m = d;
|
|
309
|
+
const g = this.guilds.get(m.guild_id);
|
|
310
|
+
const previous = g?.members.get(m.user.id);
|
|
311
|
+
g?.members.set(m.user.id, m);
|
|
312
|
+
this.users.set(m.user.id, m.user);
|
|
313
|
+
if (t === 'GUILD_MEMBER_ADD')
|
|
314
|
+
return this.emit('memberAdd', m);
|
|
315
|
+
return this.emit('memberUpdate', m, previous);
|
|
316
|
+
}
|
|
317
|
+
case 'GUILD_MEMBER_REMOVE':
|
|
318
|
+
this.guilds.get(d.guild_id)?.members.delete(d.user_id);
|
|
319
|
+
return this.emit('memberRemove', d);
|
|
320
|
+
case 'PRESENCE_UPDATE':
|
|
321
|
+
for (const g of this.guilds.values()) {
|
|
322
|
+
if (!g.members.has(d.user_id))
|
|
323
|
+
continue;
|
|
324
|
+
if (d.status === 'online')
|
|
325
|
+
g.online.add(d.user_id);
|
|
326
|
+
else
|
|
327
|
+
g.online.delete(d.user_id);
|
|
328
|
+
}
|
|
329
|
+
return this.emit('presenceUpdate', d);
|
|
330
|
+
case 'USER_UPDATE':
|
|
331
|
+
this.users.set(d.id, d);
|
|
332
|
+
if (d.id === this.user?.id)
|
|
333
|
+
this.user = d;
|
|
334
|
+
return;
|
|
335
|
+
case 'MESSAGE_CREATE': {
|
|
336
|
+
const m = d;
|
|
337
|
+
const c = this.channels.get(m.channel_id);
|
|
338
|
+
if (c)
|
|
339
|
+
c.last_message_id = m.id;
|
|
340
|
+
this.users.set(m.author.id, m.author);
|
|
341
|
+
return this.emit('messageCreate', new Message(this, m));
|
|
342
|
+
}
|
|
343
|
+
case 'MESSAGE_UPDATE':
|
|
344
|
+
return this.emit('messageUpdate', d);
|
|
345
|
+
case 'MESSAGE_DELETE':
|
|
346
|
+
return this.emit('messageDelete', d);
|
|
347
|
+
case 'MESSAGE_REACTION_ADD':
|
|
348
|
+
return this.emit('reactionAdd', d);
|
|
349
|
+
case 'MESSAGE_REACTION_REMOVE':
|
|
350
|
+
return this.emit('reactionRemove', d);
|
|
351
|
+
case 'TYPING_START':
|
|
352
|
+
return this.emit('typingStart', d);
|
|
353
|
+
case 'INTERACTION_CREATE':
|
|
354
|
+
return this.emit('interaction', new Interaction(this, d));
|
|
355
|
+
case 'VOICE_STATE_UPDATE': {
|
|
356
|
+
const v = d;
|
|
357
|
+
const previous = this.voiceStates.get(v.user_id);
|
|
358
|
+
if (v.channel_id)
|
|
359
|
+
this.voiceStates.set(v.user_id, v);
|
|
360
|
+
else
|
|
361
|
+
this.voiceStates.delete(v.user_id);
|
|
362
|
+
if (v.user_id === this.user?.id)
|
|
363
|
+
this.voice?.onOwnState(v);
|
|
364
|
+
return this.emit('voiceStateUpdate', v, previous);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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