@notidotbot/noti-api-client 1.9.117 → 1.9.119

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.
@@ -37,6 +37,30 @@ export declare class APIMe {
37
37
  }>>;
38
38
  /** Unlink in one server. 404 when nothing is linked there. */
39
39
  unlinkMinecraft({ auth, guildId }: MeFunctionsInput['unlinkMinecraft']): Promise<import("../types").WebResponse<string>>;
40
+ /**
41
+ * Kick badge sync link page (noti.bot/link/kick/<guildId>): the server, whether this user is a member, their linked
42
+ * Kick account, the creators and the badge roles they give, and - when the server's join door is open (Premium
43
+ * Plus) and the user is NOT a member - which badges let them in plus Discord's Authorize link (`authorizeUrl`, null
44
+ * until Kick is linked). 404 `unknown_guild`, 403 `not_available`, 503 `guild_unavailable`.
45
+ */
46
+ getKickGuildLink({ auth, guildId }: MeFunctionsInput['getKickGuildLink']): Promise<import("../types").WebResponse<KickGuildLink>>;
47
+ /**
48
+ * Sync my Kick badge roles in this server - the same as /sync. Errors (`error.code`): 403 `vote_required` (same
49
+ * shape as the other vote gates; Premium Plus skips it), 429 `daily_limit` (`error.retryAt`, `error.premiumUrl` -
50
+ * free servers sync once a day), 409 `kick_not_linked` / `bot_missing_permissions`, 403 `not_member`, 404
51
+ * `no_creators`, 503 `guild_unavailable`.
52
+ */
53
+ syncKickGuildRoles({ auth, guildId }: MeFunctionsInput['syncKickGuildRoles']): Promise<import("../types").WebResponse<KickBadgeSyncResult>>;
54
+ /**
55
+ * The join door: Discord's Authorize screen (from `getKickGuildLink().join.authorizeUrl`) sent the user back with
56
+ * `code` and `state` - pass both as they arrived. Noti checks their badges on the server's door creators (any one is enough), adds them,
57
+ * and gives their roles. Errors: 400 `invalid_state` / `discord_refused` / `join_not_allowed` (they unticked "Join
58
+ * servers"), 403 `wrong_account` / `join_closed` / `badge_required` (`error.creators`: `{ streamer, badges }[]`), 409
59
+ * `already_member` / `kick_not_linked` / `running`, 502 `join_failed`, 503 `kick_unavailable` / `join_unavailable`.
60
+ */
61
+ joinKickGuild({ auth, guildId, code, state }: MeFunctionsInput['joinKickGuild']): Promise<import("../types").WebResponse<KickBadgeSyncResult & {
62
+ joined: true;
63
+ }>>;
40
64
  /**
41
65
  * The one server upgrade that comes with User Premium: where it currently sits, and whether it can
42
66
  * be moved yet. Everything the dashboard needs is inside `data` - a field beside it would exist at
@@ -163,6 +187,20 @@ export type MeFunctionsInput<T extends GuildDataType = never> = {
163
187
  'confirmMinecraftAuthorization': {
164
188
  pendingId: string;
165
189
  };
190
+ 'getKickGuildLink': {
191
+ auth: string;
192
+ guildId: string;
193
+ };
194
+ 'syncKickGuildRoles': {
195
+ auth: string;
196
+ guildId: string;
197
+ };
198
+ 'joinKickGuild': {
199
+ auth: string;
200
+ guildId: string;
201
+ code: string;
202
+ state: string;
203
+ };
166
204
  };
167
205
  export type MeGetReturnTypes = {
168
206
  'getCurrentUserRaw': Awaited<ReturnType<APIMe['getCurrentUser']>>;
@@ -207,6 +245,51 @@ export type MeGetReturnTypes = {
207
245
  'createMinecraftAuthorizationSuccess': CancelOutWebResponses<Awaited<ReturnType<APIMe['createMinecraftAuthorization']>>>;
208
246
  'confirmMinecraftAuthorizationRaw': Awaited<ReturnType<APIMe['confirmMinecraftAuthorization']>>;
209
247
  'confirmMinecraftAuthorizationSuccess': CancelOutWebResponses<Awaited<ReturnType<APIMe['confirmMinecraftAuthorization']>>>;
248
+ 'getKickGuildLinkRaw': Awaited<ReturnType<APIMe['getKickGuildLink']>>;
249
+ 'getKickGuildLinkSuccess': CancelOutWebResponses<Awaited<ReturnType<APIMe['getKickGuildLink']>>>;
250
+ 'syncKickGuildRolesRaw': Awaited<ReturnType<APIMe['syncKickGuildRoles']>>;
251
+ 'syncKickGuildRolesSuccess': CancelOutWebResponses<Awaited<ReturnType<APIMe['syncKickGuildRoles']>>>;
252
+ 'joinKickGuildRaw': Awaited<ReturnType<APIMe['joinKickGuild']>>;
253
+ 'joinKickGuildSuccess': CancelOutWebResponses<Awaited<ReturnType<APIMe['joinKickGuild']>>>;
254
+ };
255
+ export type KickBadgeName = 'subscriber' | 'vip' | 'og' | 'founder' | 'moderator' | 'verified' | 'sub_gifter';
256
+ /** The Kick badge sync link page for one server (`getKickGuildLink`). */
257
+ export type KickGuildLink = {
258
+ guild: {
259
+ id: string;
260
+ name: string;
261
+ icon: string | null;
262
+ };
263
+ isMember: boolean;
264
+ kickAccount: {
265
+ username: string;
266
+ } | null;
267
+ /** Premium: roles update themselves (instant sub role, rechecks, grace). */
268
+ autoSync: boolean;
269
+ creators: {
270
+ streamer: string;
271
+ roles: {
272
+ badge: Exclude<KickBadgeName, 'sub_gifter'>;
273
+ roleName: string | null;
274
+ }[];
275
+ }[];
276
+ /** The join door, only for a non-member while it is open. Each creator has its own badges; any one opens it. */
277
+ join: {
278
+ creators: {
279
+ streamer: string;
280
+ badges: KickBadgeName[];
281
+ }[];
282
+ authorizeUrl: string | null;
283
+ } | null;
284
+ };
285
+ /** One sync: role ids added / removed, and roles Noti could not touch (`error`: missing_role, managed, position, unknown). */
286
+ export type KickBadgeSyncResult = {
287
+ added: string[];
288
+ removed: string[];
289
+ errors: {
290
+ roleId: string;
291
+ error: 'missing_role' | 'managed' | 'position' | 'unknown';
292
+ }[];
210
293
  };
211
294
  /** What `connectMinecraft` linked. `bedrock`: a Bedrock player through Geyser/Floodgate. */
212
295
  export type MinecraftLinkResult = {
@@ -103,6 +103,43 @@ class APIMe {
103
103
  endpoint: this.web.qp('/@me/connect/minecraft/' + guildId),
104
104
  });
105
105
  }
106
+ /**
107
+ * Kick badge sync link page (noti.bot/link/kick/<guildId>): the server, whether this user is a member, their linked
108
+ * Kick account, the creators and the badge roles they give, and - when the server's join door is open (Premium
109
+ * Plus) and the user is NOT a member - which badges let them in plus Discord's Authorize link (`authorizeUrl`, null
110
+ * until Kick is linked). 404 `unknown_guild`, 403 `not_available`, 503 `guild_unavailable`.
111
+ */
112
+ async getKickGuildLink({ auth, guildId }) {
113
+ return await this.web.request({
114
+ method: 'GET', auth,
115
+ endpoint: this.web.qp('/@me/connect/kick/guilds/' + guildId),
116
+ });
117
+ }
118
+ /**
119
+ * Sync my Kick badge roles in this server - the same as /sync. Errors (`error.code`): 403 `vote_required` (same
120
+ * shape as the other vote gates; Premium Plus skips it), 429 `daily_limit` (`error.retryAt`, `error.premiumUrl` -
121
+ * free servers sync once a day), 409 `kick_not_linked` / `bot_missing_permissions`, 403 `not_member`, 404
122
+ * `no_creators`, 503 `guild_unavailable`.
123
+ */
124
+ async syncKickGuildRoles({ auth, guildId }) {
125
+ return await this.web.request({
126
+ method: 'POST', auth,
127
+ endpoint: this.web.qp('/@me/connect/kick/guilds/' + guildId + '/sync'),
128
+ });
129
+ }
130
+ /**
131
+ * The join door: Discord's Authorize screen (from `getKickGuildLink().join.authorizeUrl`) sent the user back with
132
+ * `code` and `state` - pass both as they arrived. Noti checks their badges on the server's door creators (any one is enough), adds them,
133
+ * and gives their roles. Errors: 400 `invalid_state` / `discord_refused` / `join_not_allowed` (they unticked "Join
134
+ * servers"), 403 `wrong_account` / `join_closed` / `badge_required` (`error.creators`: `{ streamer, badges }[]`), 409
135
+ * `already_member` / `kick_not_linked` / `running`, 502 `join_failed`, 503 `kick_unavailable` / `join_unavailable`.
136
+ */
137
+ async joinKickGuild({ auth, guildId, code, state }) {
138
+ return await this.web.request({
139
+ method: 'POST', auth, body: { code, state },
140
+ endpoint: this.web.qp('/@me/connect/kick/guilds/' + guildId + '/join'),
141
+ });
142
+ }
106
143
  /**
107
144
  * The one server upgrade that comes with User Premium: where it currently sits, and whether it can
108
145
  * be moved yet. Everything the dashboard needs is inside `data` - a field beside it would exist at
@@ -40,15 +40,15 @@ export declare class APIClient {
40
40
  content: string;
41
41
  thumbnail: string | null;
42
42
  authorIcon: string;
43
- createdAt: Date;
44
- tags: string[];
45
43
  clientId: string;
46
44
  identifier: string;
47
45
  isPinned: boolean;
48
46
  views: number | null;
49
47
  reactions: string[];
50
48
  reactionsCount: number | null;
49
+ tags: string[];
51
50
  authorName: string;
51
+ createdAt: Date;
52
52
  lastEdited: Date;
53
53
  isPublic: boolean;
54
54
  }[]>>;
@@ -8,6 +8,14 @@ export declare class APIGuild {
8
8
  constructor(web: WebDataManager);
9
9
  getGuild({ auth, guildId }: GuildFunctionsInput['getGuild']): Promise<import("../types").WebResponse<GuildWithStuff>>;
10
10
  updateGuild({ auth, guildId, guild }: GuildFunctionsInput['updateGuild']): Promise<import("../types").WebResponse<string>>;
11
+ /**
12
+ * Kick badge sync (Premium): recheck every synced member at the next round. Members whose sub role came from Kick's
13
+ * live event are otherwise not rechecked for 30 days. Once an hour per server. Errors: 403 `not_available` /
14
+ * `premium_required`, 429 `cooldown` (`error.retryAt`). Answers how many members were queued.
15
+ */
16
+ createKickBadgeRecheck({ auth, guildId }: GuildFunctionsInput['createKickBadgeRecheck']): Promise<import("../types").WebResponse<{
17
+ members: number;
18
+ }>>;
11
19
  getCustomBotProfile({ auth, guildId }: GuildFunctionsInput['getCustomBotProfile']): Promise<import("../types").WebResponse<GetCustomBotProfileResponse>>;
12
20
  updateCustomBotProfile({ auth, guildId, formData }: GuildFunctionsInput['updateCustomBotProfile']): Promise<import("../types").WebResponse<GetCustomBotProfileResponse>>;
13
21
  getGuildErrors({ auth, guildId }: GuildFunctionsInput['getGuildErrors']): Promise<import("../types").WebResponse<GuildErrors>>;
@@ -45,6 +53,10 @@ export type GuildFunctionsInput<T extends SendPanelType = never, T2 extends Guil
45
53
  guildId: string;
46
54
  guild: DeepPartial<GuildZod>;
47
55
  };
56
+ 'createKickBadgeRecheck': {
57
+ auth: string;
58
+ guildId: string;
59
+ };
48
60
  'getCustomBotProfile': {
49
61
  auth: string;
50
62
  guildId: string;
@@ -162,6 +174,8 @@ export type GuildReturnTypes = {
162
174
  'getGuildRaw': Awaited<ReturnType<APIGuild['getGuild']>>;
163
175
  'getGuildSuccess': CancelOutWebResponses<Awaited<ReturnType<APIGuild['getGuild']>>>;
164
176
  'updateGuildRaw': Awaited<ReturnType<APIGuild['updateGuild']>>;
177
+ 'createKickBadgeRecheckRaw': Awaited<ReturnType<APIGuild['createKickBadgeRecheck']>>;
178
+ 'createKickBadgeRecheckSuccess': CancelOutWebResponses<Awaited<ReturnType<APIGuild['createKickBadgeRecheck']>>>;
165
179
  'updateGuildSuccess': CancelOutWebResponses<Awaited<ReturnType<APIGuild['updateGuild']>>>;
166
180
  'getCustomBotProfileRaw': Awaited<ReturnType<APIGuild['getCustomBotProfile']>>;
167
181
  'getCustomBotProfileSuccess': CancelOutWebResponses<Awaited<ReturnType<APIGuild['getCustomBotProfile']>>>;
@@ -20,6 +20,17 @@ class APIGuild {
20
20
  endpoint: this.web.qp('/data/guild/' + guildId),
21
21
  });
22
22
  }
23
+ /**
24
+ * Kick badge sync (Premium): recheck every synced member at the next round. Members whose sub role came from Kick's
25
+ * live event are otherwise not rechecked for 30 days. Once an hour per server. Errors: 403 `not_available` /
26
+ * `premium_required`, 429 `cooldown` (`error.retryAt`). Answers how many members were queued.
27
+ */
28
+ async createKickBadgeRecheck({ auth, guildId }) {
29
+ return await this.web.request({
30
+ method: 'POST', auth,
31
+ endpoint: this.web.qp('/data/guild/' + guildId + '/kick-badges/rechecks'),
32
+ });
33
+ }
23
34
  async getCustomBotProfile({ auth, guildId }) {
24
35
  return await this.web.request({
25
36
  method: 'GET', auth,
@@ -48,10 +48,8 @@ export declare class APIGuildClipForward {
48
48
  platform: import("@prisma/client").$Enums.PlatformEnum;
49
49
  channelId: string | null;
50
50
  streamerUserName: string;
51
- usePerStreamerEmbeds: boolean | null;
52
- showNotifyButton: boolean | null;
53
- pingRoleId: string | null;
54
51
  clipForwardId: string;
52
+ pingRoleId: string | null;
55
53
  minViews: number | null;
56
54
  minDuration: number | null;
57
55
  maxPerCycle: number | null;
@@ -61,6 +59,8 @@ export declare class APIGuildClipForward {
61
59
  blacklistClippers: string[];
62
60
  whitelistCategories: string[];
63
61
  blacklistCategories: string[];
62
+ showNotifyButton: boolean | null;
63
+ usePerStreamerEmbeds: boolean | null;
64
64
  lastClipAt: Date | null;
65
65
  lastClipId: string | null;
66
66
  } | null;
@@ -72,10 +72,8 @@ export declare class APIGuildClipForward {
72
72
  platform: import("@prisma/client").$Enums.PlatformEnum;
73
73
  channelId: string | null;
74
74
  streamerUserName: string;
75
- usePerStreamerEmbeds: boolean | null;
76
- showNotifyButton: boolean | null;
77
- pingRoleId: string | null;
78
75
  clipForwardId: string;
76
+ pingRoleId: string | null;
79
77
  minViews: number | null;
80
78
  minDuration: number | null;
81
79
  maxPerCycle: number | null;
@@ -85,6 +83,8 @@ export declare class APIGuildClipForward {
85
83
  blacklistClippers: string[];
86
84
  whitelistCategories: string[];
87
85
  blacklistCategories: string[];
86
+ showNotifyButton: boolean | null;
87
+ usePerStreamerEmbeds: boolean | null;
88
88
  lastClipAt: Date | null;
89
89
  lastClipId: string | null;
90
90
  } | null;
@@ -157,10 +157,8 @@ export declare class APIGuildClipForward {
157
157
  platform: import("@prisma/client").$Enums.PlatformEnum;
158
158
  channelId: string | null;
159
159
  streamerUserName: string;
160
- usePerStreamerEmbeds: boolean | null;
161
- showNotifyButton: boolean | null;
162
- pingRoleId: string | null;
163
160
  clipForwardId: string;
161
+ pingRoleId: string | null;
164
162
  minViews: number | null;
165
163
  minDuration: number | null;
166
164
  maxPerCycle: number | null;
@@ -170,6 +168,8 @@ export declare class APIGuildClipForward {
170
168
  blacklistClippers: string[];
171
169
  whitelistCategories: string[];
172
170
  blacklistCategories: string[];
171
+ showNotifyButton: boolean | null;
172
+ usePerStreamerEmbeds: boolean | null;
173
173
  lastClipAt: Date | null;
174
174
  lastClipId: string | null;
175
175
  } | null;
@@ -223,10 +223,8 @@ export declare class APIGuildClipForward {
223
223
  platform: import("@prisma/client").$Enums.PlatformEnum;
224
224
  channelId: string | null;
225
225
  streamerUserName: string;
226
- usePerStreamerEmbeds: boolean | null;
227
- showNotifyButton: boolean | null;
228
- pingRoleId: string | null;
229
226
  clipForwardId: string;
227
+ pingRoleId: string | null;
230
228
  minViews: number | null;
231
229
  minDuration: number | null;
232
230
  maxPerCycle: number | null;
@@ -236,6 +234,8 @@ export declare class APIGuildClipForward {
236
234
  blacklistClippers: string[];
237
235
  whitelistCategories: string[];
238
236
  blacklistCategories: string[];
237
+ showNotifyButton: boolean | null;
238
+ usePerStreamerEmbeds: boolean | null;
239
239
  lastClipAt: Date | null;
240
240
  lastClipId: string | null;
241
241
  } | null;
@@ -283,10 +283,8 @@ export declare class APIGuildClipForward {
283
283
  platform: import("@prisma/client").$Enums.PlatformEnum;
284
284
  channelId: string | null;
285
285
  streamerUserName: string;
286
- usePerStreamerEmbeds: boolean | null;
287
- showNotifyButton: boolean | null;
288
- pingRoleId: string | null;
289
286
  clipForwardId: string;
287
+ pingRoleId: string | null;
290
288
  minViews: number | null;
291
289
  minDuration: number | null;
292
290
  maxPerCycle: number | null;
@@ -296,6 +294,8 @@ export declare class APIGuildClipForward {
296
294
  blacklistClippers: string[];
297
295
  whitelistCategories: string[];
298
296
  blacklistCategories: string[];
297
+ showNotifyButton: boolean | null;
298
+ usePerStreamerEmbeds: boolean | null;
299
299
  lastClipAt: Date | null;
300
300
  lastClipId: string | null;
301
301
  } | null;
@@ -372,10 +372,8 @@ export declare class APIGuildClipForward {
372
372
  platform: import("@prisma/client").$Enums.PlatformEnum;
373
373
  channelId: string | null;
374
374
  streamerUserName: string;
375
- usePerStreamerEmbeds: boolean | null;
376
- showNotifyButton: boolean | null;
377
- pingRoleId: string | null;
378
375
  clipForwardId: string;
376
+ pingRoleId: string | null;
379
377
  minViews: number | null;
380
378
  minDuration: number | null;
381
379
  maxPerCycle: number | null;
@@ -385,6 +383,8 @@ export declare class APIGuildClipForward {
385
383
  blacklistClippers: string[];
386
384
  whitelistCategories: string[];
387
385
  blacklistCategories: string[];
386
+ showNotifyButton: boolean | null;
387
+ usePerStreamerEmbeds: boolean | null;
388
388
  lastClipAt: Date | null;
389
389
  lastClipId: string | null;
390
390
  }>>;
@@ -3,13 +3,15 @@ import { CancelOutWebResponses, WebResponse } from '../types';
3
3
  /**
4
4
  * Reposition Emojis - reorder a server's emojis in Discord's emoji picker.
5
5
  *
6
- * Discord has no reorder API: the picker lists a server's emojis oldest upload first. So Noti re-uploads the emojis
7
- * that have to move, in the new order, and deletes the originals. **Every re-uploaded emoji gets a new id**: Noti
8
- * updates its own settings (role panels, starboards, message buttons, `<:name:id>` in message text) and re-renders
9
- * posted role panels, but emojis in old chat messages and other bots' settings may show as broken.
6
+ * Discord has no reorder API, and its picker sorts a server's emojis **by name**: case-sensitive (capitals before
7
+ * lowercase), same names oldest upload first. So Noti renames every emoji with a letter prefix in the new order:
8
+ * `a_wave`, `b_heart`, ... (`aa_`, `ab_`, ... past 26). Ids, images and role locks stay, so old messages still show the
9
+ * emoji; people type the new names, and other bots that look an emoji up by name may need updating. Noti updates its
10
+ * own starboards. A re-run replaces Noti's earlier prefix (`base`) instead of stacking it.
10
11
  *
11
- * Only what must move is re-uploaded: emojis at the start of the new order that are already in age order keep their
12
- * place. Integration emojis (`managed`) and greyed-out ones (`available: false`) can never move - pin them.
12
+ * New name = prefix + `base`, cut to 32 characters. Integration emojis (`managed`) and greyed-out ones
13
+ * (`available: false`) cannot be renamed: they keep their name and stay where it sorts, and their place in `order` is
14
+ * ignored - show them apart, as fixed.
13
15
  *
14
16
  * Free servers: one reposition per 7 days (`nextFreeAt`). Premium: unlimited (`unlimited`). Starting one needs a top.gg
15
17
  * vote (403 `vote_required`, Premium skips it) and Manage Expressions for both the caller and Noti. Behind the
@@ -18,14 +20,13 @@ import { CancelOutWebResponses, WebResponse } from '../types';
18
20
  export declare class APIGuildEmojis {
19
21
  private web;
20
22
  constructor(web: WebDataManager);
21
- /** The server's emojis in picker order, its slot limits, the weekly cap, permissions, and the current / last job. */
23
+ /** The server's emojis in picker order, the weekly cap, permissions, and the current / last job. */
22
24
  getGuildEmojis({ auth, guildId }: GuildEmojisFunctionsInput['getGuildEmojis']): Promise<WebResponse<GuildEmojisData>>;
23
25
  /**
24
26
  * Start a reposition. `order` is EVERY emoji id in the server, in the new order. Runs in the background - poll
25
- * `getEmojiReposition` for progress (large servers can take hours: Discord limits emoji uploads).
27
+ * `getEmojiReposition` for progress (about one rename a second).
26
28
  *
27
- * Errors (`error.code`): 400 `invalid_body` / `mismatch` (the list changed - reload) / `noop` / `managed_locked` /
28
- * `unavailable_locked` (`error.ids`) / `over_limit`; 403 `not_available` / `vote_required` / `not_manager` /
29
+ * Errors (`error.code`): 400 `invalid_body` / `mismatch` (the list changed - reload) / `noop`; 403 `not_available` / `vote_required` / `not_manager` /
29
30
  * `missing_permissions`; 409 `running`; 429 `weekly_limit` (`error.resetsAt`, `error.premiumUrl`); 503
30
31
  * `guild_unavailable`.
31
32
  */
@@ -41,23 +42,19 @@ export type GuildEmoji = {
41
42
  id: string;
42
43
  name: string;
43
44
  animated: boolean;
44
- /** Integration (Twitch / YouTube) emoji: cannot be moved. */
45
+ /** The name without the prefix Noti gave it last time - what the new prefix goes in front of. */
46
+ base: string;
47
+ /** Integration (Twitch / YouTube) emoji: cannot be renamed, stays where its name sorts. */
45
48
  managed: boolean;
46
- /** False when greyed out (over the limit after a boost-level drop): cannot be moved. */
49
+ /** False when greyed out (over the limit after a boost-level drop): cannot be renamed. */
47
50
  available: boolean;
48
- /** Restricted to roles; the re-upload keeps the restriction. */
51
+ /** Restricted to roles; a rename keeps the restriction. */
49
52
  roleLocked: boolean;
50
53
  url: string;
51
54
  };
52
55
  export type GuildEmojisData = {
53
- /** Picker order: oldest upload first. */
56
+ /** Picker order: by name, capitals first, same names oldest upload first. */
54
57
  emojis: GuildEmoji[];
55
- /** Static and animated each have `max` slots. */
56
- limits: {
57
- static: number;
58
- animated: number;
59
- max: number;
60
- };
61
58
  canManage: {
62
59
  bot: boolean;
63
60
  member: boolean;
@@ -68,30 +65,27 @@ export type GuildEmojisData = {
68
65
  nextFreeAt: number | null;
69
66
  job: EmojiRepositionJob | null;
70
67
  };
71
- /** One emoji's progress. `skipped` = someone deleted it during the job; `failed` carries `error`. */
72
- export type EmojiRepositionStep = 'pending' | 'backedUp' | 'creating' | 'created' | 'deleting' | 'done' | 'failed' | 'skipped';
68
+ /** One emoji's progress. `skipped` = someone deleted it during the job; `failed` carries `error` (the emoji keeps its old name). */
69
+ export type EmojiRepositionStep = 'pending' | 'done' | 'failed' | 'skipped';
73
70
  export type EmojiRepositionJob = {
74
71
  jobId: string;
75
72
  guildId: string;
76
73
  startedBy: string;
77
74
  startedAt: number;
78
- status: 'backing-up' | 'moving' | 'repointing' | 'done' | 'failed';
79
- /** Emojis that kept their place. */
80
- keep: string[];
81
- /** Emojis being re-uploaded, in order. `newId` once its copy exists. */
75
+ /** `repointing`: renames finished, Noti's starboards are being updated. `superseded`-failed jobs are from the old re-upload build. */
76
+ status: 'renaming' | 'repointing' | 'done' | 'failed';
77
+ /** The renames, in order. Emojis already carrying their new name are not listed. */
82
78
  emojis: Array<{
83
79
  id: string;
84
- name: string;
85
- animated: boolean;
86
- roles: string[];
80
+ from: string;
81
+ to: string;
82
+ prefix: string;
87
83
  step: EmojiRepositionStep;
88
- newId?: string;
89
- deletedFirst?: boolean;
90
- backupKey?: string;
91
84
  error?: string;
92
85
  }>;
93
- movedAny: boolean;
94
- /** Why it failed, e.g. `backup_too_large:<id>`, `emoji_down:<id>`, `repoint_failed`. */
86
+ /** False on a failed job = nothing changed (the free week was given back). */
87
+ renamedAny: boolean;
88
+ /** `guild_unreachable` / `superseded` on a failed job; `repoint_failed` on a done one (renames stand, a starboard may need its emoji re-picked). */
95
89
  failure?: string;
96
90
  finishedAt?: number;
97
91
  };
@@ -4,13 +4,15 @@ exports.APIGuildEmojis = void 0;
4
4
  /**
5
5
  * Reposition Emojis - reorder a server's emojis in Discord's emoji picker.
6
6
  *
7
- * Discord has no reorder API: the picker lists a server's emojis oldest upload first. So Noti re-uploads the emojis
8
- * that have to move, in the new order, and deletes the originals. **Every re-uploaded emoji gets a new id**: Noti
9
- * updates its own settings (role panels, starboards, message buttons, `<:name:id>` in message text) and re-renders
10
- * posted role panels, but emojis in old chat messages and other bots' settings may show as broken.
7
+ * Discord has no reorder API, and its picker sorts a server's emojis **by name**: case-sensitive (capitals before
8
+ * lowercase), same names oldest upload first. So Noti renames every emoji with a letter prefix in the new order:
9
+ * `a_wave`, `b_heart`, ... (`aa_`, `ab_`, ... past 26). Ids, images and role locks stay, so old messages still show the
10
+ * emoji; people type the new names, and other bots that look an emoji up by name may need updating. Noti updates its
11
+ * own starboards. A re-run replaces Noti's earlier prefix (`base`) instead of stacking it.
11
12
  *
12
- * Only what must move is re-uploaded: emojis at the start of the new order that are already in age order keep their
13
- * place. Integration emojis (`managed`) and greyed-out ones (`available: false`) can never move - pin them.
13
+ * New name = prefix + `base`, cut to 32 characters. Integration emojis (`managed`) and greyed-out ones
14
+ * (`available: false`) cannot be renamed: they keep their name and stay where it sorts, and their place in `order` is
15
+ * ignored - show them apart, as fixed.
14
16
  *
15
17
  * Free servers: one reposition per 7 days (`nextFreeAt`). Premium: unlimited (`unlimited`). Starting one needs a top.gg
16
18
  * vote (403 `vote_required`, Premium skips it) and Manage Expressions for both the caller and Noti. Behind the
@@ -21,7 +23,7 @@ class APIGuildEmojis {
21
23
  constructor(web) {
22
24
  this.web = web;
23
25
  }
24
- /** The server's emojis in picker order, its slot limits, the weekly cap, permissions, and the current / last job. */
26
+ /** The server's emojis in picker order, the weekly cap, permissions, and the current / last job. */
25
27
  async getGuildEmojis({ auth, guildId }) {
26
28
  return await this.web.request({
27
29
  method: 'GET', auth,
@@ -30,10 +32,9 @@ class APIGuildEmojis {
30
32
  }
31
33
  /**
32
34
  * Start a reposition. `order` is EVERY emoji id in the server, in the new order. Runs in the background - poll
33
- * `getEmojiReposition` for progress (large servers can take hours: Discord limits emoji uploads).
35
+ * `getEmojiReposition` for progress (about one rename a second).
34
36
  *
35
- * Errors (`error.code`): 400 `invalid_body` / `mismatch` (the list changed - reload) / `noop` / `managed_locked` /
36
- * `unavailable_locked` (`error.ids`) / `over_limit`; 403 `not_available` / `vote_required` / `not_manager` /
37
+ * Errors (`error.code`): 400 `invalid_body` / `mismatch` (the list changed - reload) / `noop`; 403 `not_available` / `vote_required` / `not_manager` /
37
38
  * `missing_permissions`; 409 `running`; 429 `weekly_limit` (`error.resetsAt`, `error.premiumUrl`); 503
38
39
  * `guild_unavailable`.
39
40
  */
@@ -19,8 +19,8 @@ export declare class APIGuildRolePanel {
19
19
  thumbnail: string | null;
20
20
  author: string | null;
21
21
  authorIcon: string | null;
22
- guildRolePanelId: string;
23
22
  order: number;
23
+ guildRolePanelId: string;
24
24
  } | null;
25
25
  } & {
26
26
  name: string;
@@ -41,8 +41,8 @@ export declare class APIGuildRolePanel {
41
41
  thumbnail: string | null;
42
42
  author: string | null;
43
43
  authorIcon: string | null;
44
- guildRolePanelId: string;
45
44
  order: number;
45
+ guildRolePanelId: string;
46
46
  })[];
47
47
  rows: {
48
48
  dbId: string;
@@ -51,9 +51,9 @@ export declare class APIGuildRolePanel {
51
51
  blacklistRoleIds: string[];
52
52
  emojiUnicodeOrId: string | null;
53
53
  label: string | null;
54
+ guildRolePanelId: string;
54
55
  style: number | null;
55
56
  temporaryMinutes: number | null;
56
- guildRolePanelId: string;
57
57
  }[];
58
58
  } & {
59
59
  name: string;
@@ -61,14 +61,14 @@ export declare class APIGuildRolePanel {
61
61
  guildId: string;
62
62
  channelId: string;
63
63
  messageId: string | null;
64
- webhookEnabled: boolean;
65
- webhookUsername: string | null;
66
- webhookAvatarUrl: string | null;
64
+ logChannelId: string | null;
67
65
  panelId: string;
68
66
  interactionType: import("@prisma/client").$Enums.RolePanelType;
69
67
  assignMode: import("@prisma/client").$Enums.RolePanelAssignMode;
70
68
  maxRoles: number | null;
71
- logChannelId: string | null;
69
+ webhookEnabled: boolean;
70
+ webhookUsername: string | null;
71
+ webhookAvatarUrl: string | null;
72
72
  requireAccountAgeDays: number | null;
73
73
  requireJoinAgeDays: number | null;
74
74
  requireMessageCount: number | null;
@@ -89,8 +89,8 @@ export declare class APIGuildRolePanel {
89
89
  thumbnail: string | null;
90
90
  author: string | null;
91
91
  authorIcon: string | null;
92
- guildRolePanelId: string;
93
92
  order: number;
93
+ guildRolePanelId: string;
94
94
  } | null;
95
95
  } & {
96
96
  name: string;
@@ -111,8 +111,8 @@ export declare class APIGuildRolePanel {
111
111
  thumbnail: string | null;
112
112
  author: string | null;
113
113
  authorIcon: string | null;
114
- guildRolePanelId: string;
115
114
  order: number;
115
+ guildRolePanelId: string;
116
116
  })[];
117
117
  rows: {
118
118
  dbId: string;
@@ -121,9 +121,9 @@ export declare class APIGuildRolePanel {
121
121
  blacklistRoleIds: string[];
122
122
  emojiUnicodeOrId: string | null;
123
123
  label: string | null;
124
+ guildRolePanelId: string;
124
125
  style: number | null;
125
126
  temporaryMinutes: number | null;
126
- guildRolePanelId: string;
127
127
  }[];
128
128
  } & {
129
129
  name: string;
@@ -131,14 +131,14 @@ export declare class APIGuildRolePanel {
131
131
  guildId: string;
132
132
  channelId: string;
133
133
  messageId: string | null;
134
- webhookEnabled: boolean;
135
- webhookUsername: string | null;
136
- webhookAvatarUrl: string | null;
134
+ logChannelId: string | null;
137
135
  panelId: string;
138
136
  interactionType: import("@prisma/client").$Enums.RolePanelType;
139
137
  assignMode: import("@prisma/client").$Enums.RolePanelAssignMode;
140
138
  maxRoles: number | null;
141
- logChannelId: string | null;
139
+ webhookEnabled: boolean;
140
+ webhookUsername: string | null;
141
+ webhookAvatarUrl: string | null;
142
142
  requireAccountAgeDays: number | null;
143
143
  requireJoinAgeDays: number | null;
144
144
  requireMessageCount: number | null;
@@ -9,9 +9,9 @@ export declare class APIGuildStarboard {
9
9
  dbId: string;
10
10
  guildStarboardId: string;
11
11
  roles: string[];
12
+ channels: string[];
12
13
  roleMode: import("@prisma/client").$Enums.FilterEnum | null;
13
14
  channelMode: import("@prisma/client").$Enums.FilterEnum | null;
14
- channels: string[];
15
15
  } | null;
16
16
  } & {
17
17
  dbId: string;