micup.ts 0.0.0-stage → 1.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.
Files changed (104) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +134 -2
  3. package/README.tr.md +137 -0
  4. package/dist/bot/client.d.ts +79 -0
  5. package/dist/bot/client.js +299 -0
  6. package/dist/events/background.d.ts +7 -0
  7. package/dist/events/background.js +23 -0
  8. package/dist/events/catalog.d.ts +243 -0
  9. package/dist/events/catalog.js +1 -0
  10. package/dist/events/guild-tag.d.ts +9 -0
  11. package/dist/events/guild-tag.js +38 -0
  12. package/dist/events/mux.d.ts +97 -0
  13. package/dist/events/mux.js +23 -0
  14. package/dist/events/names.d.ts +1 -0
  15. package/dist/events/names.js +71 -0
  16. package/dist/events/router.d.ts +11 -0
  17. package/dist/events/router.js +54 -0
  18. package/dist/events/safe.d.ts +9 -0
  19. package/dist/events/safe.js +27 -0
  20. package/dist/gateway/compression.d.ts +9 -0
  21. package/dist/gateway/compression.js +119 -0
  22. package/dist/gateway/connection.d.ts +30 -0
  23. package/dist/gateway/connection.js +297 -0
  24. package/dist/gateway/protocol.d.ts +43 -0
  25. package/dist/gateway/protocol.js +65 -0
  26. package/dist/gateway/subscription.d.ts +10 -0
  27. package/dist/gateway/subscription.js +26 -0
  28. package/dist/index.d.ts +73 -0
  29. package/dist/index.js +28 -0
  30. package/dist/model/components.d.ts +82 -0
  31. package/dist/model/components.js +74 -0
  32. package/dist/model/constants.d.ts +330 -0
  33. package/dist/model/constants.js +330 -0
  34. package/dist/model/embed.d.ts +59 -0
  35. package/dist/model/embed.js +40 -0
  36. package/dist/model/entities.d.ts +125 -0
  37. package/dist/model/entities.js +12 -0
  38. package/dist/model/format.d.ts +32 -0
  39. package/dist/model/format.js +61 -0
  40. package/dist/model/guild.d.ts +182 -0
  41. package/dist/model/guild.js +1 -0
  42. package/dist/model/helpers.d.ts +88 -0
  43. package/dist/model/helpers.js +185 -0
  44. package/dist/model/interaction.d.ts +137 -0
  45. package/dist/model/interaction.js +18 -0
  46. package/dist/model/locale.d.ts +15 -0
  47. package/dist/model/locale.js +55 -0
  48. package/dist/model/media.d.ts +23 -0
  49. package/dist/model/media.js +65 -0
  50. package/dist/model/permissions.d.ts +52 -0
  51. package/dist/model/permissions.js +112 -0
  52. package/dist/model/presence.d.ts +16 -0
  53. package/dist/model/presence.js +30 -0
  54. package/dist/rest/attachments.d.ts +26 -0
  55. package/dist/rest/attachments.js +82 -0
  56. package/dist/rest/channels.d.ts +166 -0
  57. package/dist/rest/channels.js +247 -0
  58. package/dist/rest/commands.d.ts +19 -0
  59. package/dist/rest/commands.js +111 -0
  60. package/dist/rest/discovery.d.ts +35 -0
  61. package/dist/rest/discovery.js +33 -0
  62. package/dist/rest/errors.d.ts +62 -0
  63. package/dist/rest/errors.js +72 -0
  64. package/dist/rest/expressions.d.ts +65 -0
  65. package/dist/rest/expressions.js +89 -0
  66. package/dist/rest/guilds.d.ts +177 -0
  67. package/dist/rest/guilds.js +217 -0
  68. package/dist/rest/identity.d.ts +1 -0
  69. package/dist/rest/identity.js +15 -0
  70. package/dist/rest/interactions.d.ts +30 -0
  71. package/dist/rest/interactions.js +79 -0
  72. package/dist/rest/messages.d.ts +89 -0
  73. package/dist/rest/messages.js +58 -0
  74. package/dist/rest/rooms.d.ts +142 -0
  75. package/dist/rest/rooms.js +133 -0
  76. package/dist/rest/sounds.d.ts +44 -0
  77. package/dist/rest/sounds.js +89 -0
  78. package/dist/rest/transport.d.ts +22 -0
  79. package/dist/rest/transport.js +187 -0
  80. package/dist/rest/users.d.ts +65 -0
  81. package/dist/rest/users.js +63 -0
  82. package/dist/rest/webhooks.d.ts +56 -0
  83. package/dist/rest/webhooks.js +94 -0
  84. package/dist/session/inventory.d.ts +22 -0
  85. package/dist/session/inventory.js +159 -0
  86. package/dist/session/requests.d.ts +39 -0
  87. package/dist/session/requests.js +144 -0
  88. package/dist/session/session.d.ts +82 -0
  89. package/dist/session/session.js +250 -0
  90. package/dist/session/voice.d.ts +42 -0
  91. package/dist/session/voice.js +176 -0
  92. package/dist/shard/manager.d.ts +57 -0
  93. package/dist/shard/manager.js +180 -0
  94. package/dist/state/cache.d.ts +20 -0
  95. package/dist/state/cache.js +301 -0
  96. package/docs/README.md +13 -0
  97. package/docs/commands-and-interactions.md +120 -0
  98. package/docs/errors-and-limits.md +79 -0
  99. package/docs/gateway-and-sharding.md +102 -0
  100. package/docs/getting-started.md +79 -0
  101. package/docs/migrating.md +44 -0
  102. package/docs/rest-reference.md +101 -0
  103. package/docs/voice.md +95 -0
  104. package/package.json +57 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mitune
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,135 @@
1
- # Temporary Holding Version
1
+ # micup.ts
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The TypeScript SDK for [Micup](https://micup.gg) bots. It connects a bot to the Micup Gateway and REST API with reconnects, resume, sharding, rate-limit handling and full type declarations, and covers slash commands, buttons, select menus, modals, soundboard, voice rooms and voice playback.
4
+
5
+ [Türkçe README](README.tr.md) · [Docs](docs/README.md) · [Changelog](CHANGELOG.md)
6
+
7
+ ```sh
8
+ npm install micup.ts
9
+ ```
10
+
11
+ Requires Node.js 22 or later and a Micup bot token. Based on [micup.go](https://github.com/yestefir/micup.go), the Go library that runs production bots.
12
+
13
+ ## Quick start
14
+
15
+ Send a message:
16
+
17
+ ```js
18
+ import { MicupClient } from 'micup.ts';
19
+
20
+ const client = await MicupClient.connect({ token: process.env.MICUP_BOT_TOKEN });
21
+ console.log(client.self.username);
22
+ await client.sendMessage(process.env.MICUP_CHANNEL_ID, 'Merhaba!');
23
+ ```
24
+
25
+ Answer a command and a button:
26
+
27
+ ```js
28
+ import { EventMux, InteractionRouter, MicupClient, actionRow, primaryButton } from 'micup.ts';
29
+
30
+ const client = await MicupClient.connect({ token: process.env.MICUP_BOT_TOKEN });
31
+ await client.commands.create({ name: 'ping', description: 'Check the bot' }, { guildId: process.env.MICUP_GUILD_ID });
32
+
33
+ const router = new InteractionRouter()
34
+ .command('ping', (interaction, signal) =>
35
+ client.interactions.respond(interaction, {
36
+ content: 'pong',
37
+ components: [actionRow(primaryButton('again', 'Again'))],
38
+ }, { signal }))
39
+ .component('again', (interaction, signal) =>
40
+ client.interactions.update(interaction, { content: 'pong again', components: [] }, { signal }));
41
+
42
+ const events = new EventMux();
43
+ events.on('INTERACTION_CREATE', (interaction, event, signal) => router.handle(interaction, signal));
44
+
45
+ const stop = new AbortController();
46
+ process.once('SIGINT', () => stop.abort());
47
+ await client.newSession({ handler: events.handle }).run({ signal: stop.signal });
48
+ ```
49
+
50
+ `client.newSession().run()` reconnects with backoff and resumes from the last processed sequence. A failed handler can receive its event again, so keep externally visible effects safe to repeat.
51
+
52
+ ## What is inside
53
+
54
+ | Area | What you get | Start here |
55
+ | --- | --- | --- |
56
+ | Client | Authenticated REST with rate-limit waits, retries, audit-log reasons, `AbortSignal` support, bot identity (`self`, `application()`, `tokenId`) | `MicupClient` |
57
+ | Gateway | Supervised sessions with resume, heartbeat checks, Zstandard compression, presence, lazy subscriptions, member inventories, guild and channel counts | `client.newSession()` |
58
+ | Sharding | Shard manager that spaces IDENTIFY, routes guilds to shards and recommends a shard count | `client.newShardManager()` |
59
+ | State | Cache of guilds, channels, threads, members, roles and voice states with permission and hierarchy checks | `session.state` |
60
+ | Commands and interactions | Slash and context menu commands, autocomplete, buttons, select menus, modals, deferred and private replies, follow-ups, routing by name | `client.commands`, `client.interactions`, `InteractionRouter` |
61
+ | Messages | Send, edit, reply, forward, crosspost, search, bulk delete, embeds, direct uploads, embed suppression, reactions, pins | `client.sendMessage()`, `client.channels`, `client.attachments` |
62
+ | Servers | Guild, member, role, ban, timeout, audit log, vanity URL, channel layout, invites, threads and forums, webhooks | `client.guilds`, `client.channels`, `client.webhooks` |
63
+ | Expressions | Emoji and sticker listing, creation, cloning, bulk creation | `client.expressions` |
64
+ | Sound | Soundboard sounds, playback in a voice channel, guild and channel notification sounds | `client.sounds` |
65
+ | Voice rooms | The 3D room stage (board or video on the room TV, host, effects) and room tournaments | `client.rooms` |
66
+ | Discovery | Read, apply for, edit and withdraw a server discovery listing | `client.discovery` |
67
+ | Events | A typed catalog of Gateway events, an event mux and handler wrappers | `EventMux`, `knownGatewayEvents`, `safeHandler()` |
68
+ | Helpers | Constant groups, button and select builders, command option readers, permission helpers, mentions, timestamps, snowflakes, localized message catalogs | `ChannelType`, `primaryButton()`, `optionString()`, `permissionNames()` |
69
+ | Voice playback | LiveKit audio with FFmpeg decoding, PCM player and a connection object with events | [`@micupts/voice`](packages/voice) |
70
+
71
+ Everything takes an optional `AbortSignal`. HTTP failures throw `MicupAPIError` with `status`, `code`, field errors, `retryAfter` and helpers such as `notFound`, `rateLimited` and `hasFieldCode()`. `MicupErrorCode` names the error codes.
72
+
73
+ ## More examples
74
+
75
+ Read command options and open a modal:
76
+
77
+ ```js
78
+ import { modalRows, optionString, shortInput } from 'micup.ts';
79
+
80
+ router.command('hello', async (interaction, signal) => {
81
+ const name = optionString(interaction.data, 'name') ?? 'there';
82
+ await client.interactions.respond(interaction, `Hello ${name}`, { ephemeral: true, signal });
83
+ });
84
+
85
+ router.command('feedback', (interaction, signal) =>
86
+ client.interactions.modal(interaction, {
87
+ title: 'Feedback',
88
+ custom_id: 'feedback',
89
+ components: modalRows(shortInput('subject', 'Subject')),
90
+ }, { signal }));
91
+ ```
92
+
93
+ Run several shards and move slow work off the Gateway handler:
94
+
95
+ ```js
96
+ import { background } from 'micup.ts';
97
+
98
+ const manager = client.newShardManager({
99
+ shardCount: await client.recommendedShards(),
100
+ session: { handler: events.handle, compress: true, trackMembers: true },
101
+ });
102
+ void background(async (signal) => { await slowSearch(signal); }, { timeoutMs: 30_000, name: 'search' });
103
+ await manager.run({ signal: stop.signal });
104
+ ```
105
+
106
+ Log requests that fail because the bot lacks a permission, at most once a minute per route:
107
+
108
+ ```js
109
+ const client = await MicupClient.connect({
110
+ token: process.env.MICUP_BOT_TOKEN,
111
+ logger: { warn: (message, fields) => console.warn(message, fields) },
112
+ });
113
+ ```
114
+
115
+ ## Voice
116
+
117
+ [`@micupts/voice`](packages/voice) publishes audio to a voice channel through LiveKit. `VoiceConnection` joins the channel, plays files, URLs, streams or raw PCM, and emits `start`, `finish`, `status`, `memberJoin`, `memberLeave`, `disconnect` and `error`. Install it with `npm install @micupts/voice` and install FFmpeg to decode files and streams.
118
+
119
+ ## Documentation
120
+
121
+ - [Getting started](docs/getting-started.md): token, invite link, first bot, project layout
122
+ - [Commands and interactions](docs/commands-and-interactions.md): commands, options, buttons, selects, modals, autocomplete, private replies
123
+ - [Gateway and sharding](docs/gateway-and-sharding.md): sessions, resume, presence, shards, state cache, events
124
+ - [REST reference](docs/rest-reference.md): every resource and method
125
+ - [Voice](docs/voice.md): joining, playing, regranting, soundboard and voice rooms
126
+ - [Errors and limits](docs/errors-and-limits.md): error handling, rate limits, cancellation, logging
127
+ - [Migrating](docs/migrating.md): from micup.js, micup.gg.js or discord.js
128
+
129
+ ## Reliability
130
+
131
+ The test suite runs the SDK against mocked servers and a local LiveKit room. Releases are also checked end to end against the Micup service with a live bot: commands, autocomplete, buttons, select menus, modals, deferred and private replies, REST resources and voice playback.
132
+
133
+ Run `npm ci` once, then `npm test` to verify both workspaces locally.
134
+
135
+ MIT license. See [LICENSE](LICENSE).
package/README.tr.md ADDED
@@ -0,0 +1,137 @@
1
+ # micup.ts
2
+
3
+ [Micup](https://micup.gg) botları için TypeScript SDK'sı. Botu Micup Gateway ve REST API'sine yeniden bağlanma, oturum sürdürme (resume), shard desteği, hız sınırı yönetimi ve tam tip tanımlarıyla bağlar. Slash komutları, butonlar, seçim menüleri, modallar, soundboard, ses odaları ve ses çalmayı kapsar.
4
+
5
+ [English README](README.md) · [Dokümantasyon](docs/README.md) · [Değişiklik günlüğü](CHANGELOG.md)
6
+
7
+ ```sh
8
+ npm install micup.ts
9
+ ```
10
+
11
+ Node.js 22 veya üstü ve bir Micup bot token'ı gerekir. Üretimdeki botları çalıştıran Go kütüphanesi [micup.go](https://github.com/yestefir/micup.go) temel alınmıştır.
12
+
13
+ ## Hızlı başlangıç
14
+
15
+ Mesaj gönderme:
16
+
17
+ ```js
18
+ import { MicupClient } from 'micup.ts';
19
+
20
+ const client = await MicupClient.connect({ token: process.env.MICUP_BOT_TOKEN });
21
+ console.log(client.self.username);
22
+ await client.sendMessage(process.env.MICUP_CHANNEL_ID, 'Merhaba!');
23
+ ```
24
+
25
+ Komut ve butona yanıt verme:
26
+
27
+ ```js
28
+ import { EventMux, InteractionRouter, MicupClient, actionRow, primaryButton } from 'micup.ts';
29
+
30
+ const client = await MicupClient.connect({ token: process.env.MICUP_BOT_TOKEN });
31
+ await client.commands.create({ name: 'ping', description: 'Botu dene' }, { guildId: process.env.MICUP_GUILD_ID });
32
+
33
+ const router = new InteractionRouter()
34
+ .command('ping', (interaction, signal) =>
35
+ client.interactions.respond(interaction, {
36
+ content: 'pong',
37
+ components: [actionRow(primaryButton('again', 'Tekrar'))],
38
+ }, { signal }))
39
+ .component('again', (interaction, signal) =>
40
+ client.interactions.update(interaction, { content: 'tekrar pong', components: [] }, { signal }));
41
+
42
+ const events = new EventMux();
43
+ events.on('INTERACTION_CREATE', (interaction, event, signal) => router.handle(interaction, signal));
44
+
45
+ const stop = new AbortController();
46
+ process.once('SIGINT', () => stop.abort());
47
+ await client.newSession({ handler: events.handle }).run({ signal: stop.signal });
48
+ ```
49
+
50
+ `client.newSession().run()` geri çekilmeyle yeniden bağlanır ve en son işlenen sıradan devam eder. Başarısız bir işleyici aynı olayı yeniden alabilir; dışarıdan görünen işlemleri tekrarlanabilir yazın.
51
+
52
+ ## İçinde neler var
53
+
54
+ | Alan | Ne sağlar | Başlangıç |
55
+ | --- | --- | --- |
56
+ | İstemci | Hız sınırı beklemeli, yeniden denemeli, denetim kaydı sebepli, `AbortSignal` destekli REST; bot kimliği (`self`, `application()`, `tokenId`) | `MicupClient` |
57
+ | Gateway | Resume, kalp atışı denetimi, Zstandard sıkıştırma, durum (presence), tembel abonelikler, üye envanteri ve sayımlar içeren denetlenen oturumlar | `client.newSession()` |
58
+ | Shard | IDENTIFY'ları aralıklayan, sunucuları shard'lara yönlendiren ve shard sayısı öneren yönetici | `client.newShardManager()` |
59
+ | Durum | Sunucu, kanal, thread, üye, rol ve ses durumu önbelleği; izin ve rol hiyerarşisi kontrolleri | `session.state` |
60
+ | Komutlar ve etkileşimler | Slash ve bağlam menüsü komutları, otomatik tamamlama, butonlar, seçim menüleri, modallar, ertelenmiş ve gizli yanıtlar, takip mesajları, isme göre yönlendirme | `client.commands`, `client.interactions`, `InteractionRouter` |
61
+ | Mesajlar | Gönderme, düzenleme, yanıt, iletme, yayınlama, arama, toplu silme, embed, doğrudan yükleme, embed gizleme, tepki, sabitleme | `client.sendMessage()`, `client.channels`, `client.attachments` |
62
+ | Sunucu yönetimi | Sunucu, üye, rol, ban, zaman aşımı, denetim kaydı, özel davet adresi, kanal düzeni, davetler, thread ve forum, webhook | `client.guilds`, `client.channels`, `client.webhooks` |
63
+ | İfadeler | Emoji ve çıkartma listeleme, oluşturma, kopyalama, toplu oluşturma | `client.expressions` |
64
+ | Ses efektleri | Soundboard sesleri, ses kanalında çalma, sunucu ve kanal bildirim sesleri | `client.sounds` |
65
+ | Ses odaları | 3D oda sahnesi (oda TV'sinde pano veya video, host, efektler) ve oda turnuvaları | `client.rooms` |
66
+ | Keşif | Sunucu keşif kaydını okuma, başvuru, düzenleme ve geri çekme | `client.discovery` |
67
+ | Olaylar | Tipli Gateway olay kataloğu, olay çoklayıcı ve işleyici sarmalayıcıları | `EventMux`, `knownGatewayEvents`, `safeHandler()` |
68
+ | Yardımcılar | Sabit grupları, buton ve seçim menüsü oluşturucular, komut seçeneği okuyucuları, izin yardımcıları, etiketleme, zaman damgası, snowflake, yerelleştirilmiş mesaj kataloğu | `ChannelType`, `primaryButton()`, `optionString()`, `permissionNames()` |
69
+ | Ses çalma | FFmpeg çözmeli LiveKit sesi, PCM oynatıcı ve olay yayan bağlantı nesnesi | [`@micupts/voice`](packages/voice) |
70
+
71
+ Her çağrı isteğe bağlı `AbortSignal` alır. HTTP hataları `status`, `code`, alan hataları, `retryAfter` ve `notFound`, `rateLimited`, `hasFieldCode()` gibi yardımcılarla `MicupAPIError` olarak gelir. Hata kodlarının adları `MicupErrorCode` içindedir.
72
+
73
+ ## Daha fazla örnek
74
+
75
+ Komut seçeneğini okuma ve modal açma:
76
+
77
+ ```js
78
+ import { modalRows, optionString, shortInput } from 'micup.ts';
79
+
80
+ router.command('merhaba', async (interaction, signal) => {
81
+ const name = optionString(interaction.data, 'isim') ?? 'dostum';
82
+ await client.interactions.respond(interaction, `Merhaba ${name}`, { ephemeral: true, signal });
83
+ });
84
+
85
+ router.command('geri-bildirim', (interaction, signal) =>
86
+ client.interactions.modal(interaction, {
87
+ title: 'Geri bildirim',
88
+ custom_id: 'feedback',
89
+ components: modalRows(shortInput('subject', 'Konu')),
90
+ }, { signal }));
91
+ ```
92
+
93
+ Birden çok shard çalıştırma ve yavaş işi Gateway işleyicisinden ayırma:
94
+
95
+ ```js
96
+ import { background } from 'micup.ts';
97
+
98
+ const manager = client.newShardManager({
99
+ shardCount: await client.recommendedShards(),
100
+ session: { handler: events.handle, compress: true, trackMembers: true },
101
+ });
102
+ void background(async (signal) => { await slowSearch(signal); }, { timeoutMs: 30_000, name: 'search' });
103
+ await manager.run({ signal: stop.signal });
104
+ ```
105
+
106
+ Botun izni olmadığı için başarısız olan istekleri, rota başına dakikada en fazla bir kez günlüğe yazma:
107
+
108
+ ```js
109
+ const client = await MicupClient.connect({
110
+ token: process.env.MICUP_BOT_TOKEN,
111
+ logger: { warn: (message, fields) => console.warn(message, fields) },
112
+ });
113
+ ```
114
+
115
+ ## Ses
116
+
117
+ [`@micupts/voice`](packages/voice) sesi LiveKit üzerinden ses kanalına yayınlar. `VoiceConnection` kanala girer; dosya, URL, akış veya ham PCM çalar ve `start`, `finish`, `status`, `memberJoin`, `memberLeave`, `disconnect`, `error` olaylarını yayar. `npm install @micupts/voice` ile kurun; dosya ve akışları çözmek için FFmpeg kurun.
118
+
119
+ ## Dokümantasyon
120
+
121
+ - [Başlangıç](docs/getting-started.md): token, davet bağlantısı, ilk bot, proje düzeni
122
+ - [Komutlar ve etkileşimler](docs/commands-and-interactions.md)
123
+ - [Gateway ve shard](docs/gateway-and-sharding.md)
124
+ - [REST başvurusu](docs/rest-reference.md)
125
+ - [Ses](docs/voice.md)
126
+ - [Hatalar ve sınırlar](docs/errors-and-limits.md)
127
+ - [Geçiş rehberi](docs/migrating.md): micup.js, micup.gg.js veya discord.js'ten
128
+
129
+ Dokümanlar İngilizcedir.
130
+
131
+ ## Güvenilirlik
132
+
133
+ Test paketi SDK'yı sahte sunucular ve yerel bir LiveKit odasına karşı çalıştırır. Sürümler ayrıca canlı bir botla Micup servisine karşı uçtan uca denenir: komutlar, otomatik tamamlama, butonlar, seçim menüleri, modallar, ertelenmiş ve gizli yanıtlar, REST kaynakları ve ses çalma.
134
+
135
+ İki çalışma alanını yerelde doğrulamak için bir kez `npm ci`, ardından `npm test` çalıştırın.
136
+
137
+ MIT lisansı. Bkz. [LICENSE](LICENSE).
@@ -0,0 +1,79 @@
1
+ import { GatewaySession, type GatewaySessionConfig, type GatewaySessionOptions } from '../session/session.js';
2
+ import { ShardManager, type ShardManagerOptions } from '../shard/manager.js';
3
+ import { type MicupLogger, type MicupRequestOptions, type RestMethod, type RestRequestOptions } from '../rest/transport.js';
4
+ import type { MicupApplication } from '../rest/users.js';
5
+ import { type ListMessageOptions, type MessageForward, type MessageInput, type MessageSearch, type MessageSearchResult } from '../rest/messages.js';
6
+ import { MicupCommands } from '../rest/commands.js';
7
+ import { MicupInteractions } from '../rest/interactions.js';
8
+ import { MicupGuilds } from '../rest/guilds.js';
9
+ import { MicupChannels } from '../rest/channels.js';
10
+ import type { MicupMessage, MicupUser } from '../model/entities.js';
11
+ import { MicupAttachments } from '../rest/attachments.js';
12
+ import { MicupWebhooks } from '../rest/webhooks.js';
13
+ import { MicupUsers } from '../rest/users.js';
14
+ import { MicupExpressions } from '../rest/expressions.js';
15
+ import { MicupSounds } from '../rest/sounds.js';
16
+ import { MicupDiscovery } from '../rest/discovery.js';
17
+ import { MicupVoiceRooms } from '../rest/rooms.js';
18
+ import { MicupMedia } from '../model/media.js';
19
+ export interface MicupClientOptions {
20
+ token: string;
21
+ origin?: string;
22
+ maxRestAttempts?: number;
23
+ logger?: MicupLogger;
24
+ }
25
+ export declare class MicupClient {
26
+ #private;
27
+ readonly interactions: MicupInteractions;
28
+ readonly guilds: MicupGuilds;
29
+ readonly channels: MicupChannels;
30
+ readonly attachments: MicupAttachments;
31
+ readonly webhooks: MicupWebhooks;
32
+ readonly users: MicupUsers;
33
+ readonly expressions: MicupExpressions;
34
+ readonly sounds: MicupSounds;
35
+ readonly discovery: MicupDiscovery;
36
+ readonly rooms: MicupVoiceRooms;
37
+ readonly media: MicupMedia;
38
+ readonly inviteBase: string;
39
+ private constructor();
40
+ static connect({ token, origin, maxRestAttempts, logger }: MicupClientOptions, { signal }?: MicupRequestOptions): Promise<MicupClient>;
41
+ get self(): MicupUser;
42
+ get tokenId(): string | undefined;
43
+ application(options?: MicupRequestOptions): Promise<MicupApplication>;
44
+ applicationId(options?: MicupRequestOptions): Promise<string>;
45
+ get commands(): MicupCommands;
46
+ newSession(options: GatewaySessionOptions, shard?: Pick<GatewaySessionConfig, 'shardId' | 'shardCount'>): GatewaySession;
47
+ newShardManager(options: ShardManagerOptions): ShardManager;
48
+ gateway(options: GatewaySessionOptions, runOptions?: {
49
+ signal?: AbortSignal;
50
+ }): Promise<void>;
51
+ recommendedShards(options?: MicupRequestOptions): Promise<number>;
52
+ botInviteURL({ scopes, permissions, guildId }?: {
53
+ scopes?: readonly string[];
54
+ permissions?: bigint;
55
+ guildId?: string;
56
+ }): string;
57
+ getCurrentUser({ signal }?: MicupRequestOptions): Promise<MicupUser>;
58
+ sendMessage(channelId: string, content: string | MessageInput, { replyTo, signal }?: MicupRequestOptions & {
59
+ replyTo?: string;
60
+ }): Promise<MicupMessage>;
61
+ getMessage(channelId: string, messageId: string, options?: MicupRequestOptions): Promise<MicupMessage>;
62
+ listMessages(channelId: string, options?: ListMessageOptions): Promise<MicupMessage[]>;
63
+ iterateMessages(channelId: string, options?: Omit<ListMessageOptions, 'around' | 'limit'>): AsyncGenerator<MicupMessage>;
64
+ editMessage(channelId: string, messageId: string, edit: MessageInput, options?: MicupRequestOptions): Promise<MicupMessage>;
65
+ suppressEmbeds(channelId: string, messageId: string, suppress?: boolean, options?: MicupRequestOptions): Promise<MicupMessage>;
66
+ deleteMessage(channelId: string, messageId: string, options?: MicupRequestOptions & {
67
+ reason?: string;
68
+ }): Promise<void>;
69
+ triggerTyping(channelId: string, options?: MicupRequestOptions): Promise<void>;
70
+ sendDM(userId: string, message: string | MessageInput, options?: MicupRequestOptions): Promise<MicupMessage>;
71
+ forwardMessage(channelId: string, forward: MessageForward, { signal, nonce, flags }?: MicupRequestOptions & Pick<MessageInput, 'nonce' | 'flags'>): Promise<MicupMessage>;
72
+ crosspostMessage(channelId: string, messageId: string, options?: MicupRequestOptions): Promise<MicupMessage>;
73
+ bulkDeleteMessages(channelId: string, messageIds: readonly string[], options?: MicupRequestOptions & {
74
+ reason?: string;
75
+ }): Promise<void>;
76
+ deleteAttachment(channelId: string, messageId: string, attachmentId: string, options?: MicupRequestOptions): Promise<void>;
77
+ searchMessages(search: MessageSearch, options?: MicupRequestOptions): Promise<MessageSearchResult>;
78
+ request<T = unknown>(method: RestMethod, path: string, options?: RestRequestOptions): Promise<T>;
79
+ }