mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 05:26:07 +00:00

* feat: permissible handlers Co-authored-by: MARCROCK22 <MARCROCK22@users.noreply.github.com> * feat: init handle command * feat: unifique interaction/message (not full tested) * fix: await * fix: components handler * fix: console.log * feat: init transformers * fix: xd * fix: check * chore: apply formatting * chore: frozen-lockfile * fix: use pnpm v9 * fix: use pnpm v9 * fix: guildCreate emits when bot has more than 1 shard * feat: update cache adapter * fix: types * fix: limitedAdapter messages and bans support * fix: yes * feat: transformers (huge update) * fix: pnpm * feat: transformers & handleCommand methods * feat(resolveCommandFromContent): for handle content of getCommandFrom Content and argsContent * fix: use raw * fix: consistency * fix: return await * chore: export transformers * fix: socram code * fix: handleCommand & types * fix: events --------- Co-authored-by: MARCROCK22 <MARCROCK22@users.noreply.github.com> Co-authored-by: MARCROCK22 <marcos22dev@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: douglas546899 <douglas546899@gmail.com> Co-authored-by: Aarón Rafael <69669283+Chewawi@users.noreply.github.com> Co-authored-by: MARCROCK22 <57925328+MARCROCK22@users.noreply.github.com>
59 lines
2.1 KiB
TypeScript
59 lines
2.1 KiB
TypeScript
import type {
|
|
APISticker,
|
|
RESTPatchAPIGuildStickerJSONBody,
|
|
RESTPostAPIGuildStickerFormDataBody,
|
|
} from 'discord-api-types/v10';
|
|
import type { RawFile, UsingClient } from '..';
|
|
import type { Attachment, AttachmentBuilder } from '../builders';
|
|
import type { MethodContext, ObjectToLower } from '../common';
|
|
import { DiscordBase } from './extra/DiscordBase';
|
|
import { Transformers, type UserStructure } from '../client/transformers';
|
|
|
|
export interface Sticker extends DiscordBase, ObjectToLower<Omit<APISticker, 'user'>> {}
|
|
|
|
export class Sticker extends DiscordBase {
|
|
user?: UserStructure;
|
|
constructor(client: UsingClient, data: APISticker) {
|
|
super(client, data);
|
|
if (data.user) {
|
|
this.user = Transformers.User(this.client, data.user);
|
|
}
|
|
}
|
|
|
|
guild(force = false) {
|
|
if (!this.guildId) return;
|
|
return this.client.guilds.fetch(this.id, force);
|
|
}
|
|
|
|
edit(body: RESTPatchAPIGuildStickerJSONBody, reason?: string) {
|
|
if (!this.guildId) return;
|
|
return this.client.guilds.stickers.edit(this.guildId, this.id, body, reason);
|
|
}
|
|
|
|
fetch(force = false) {
|
|
if (!this.guildId) return;
|
|
return this.client.guilds.stickers.fetch(this.guildId, this.id, force);
|
|
}
|
|
|
|
delete(reason?: string) {
|
|
if (!this.guildId) return;
|
|
return this.client.guilds.stickers.delete(this.guildId, this.id, reason);
|
|
}
|
|
|
|
static methods({ client, guildId }: MethodContext<{ guildId: string }>) {
|
|
return {
|
|
list: () => client.guilds.stickers.list(guildId),
|
|
create: (payload: CreateStickerBodyRequest, reason?: string) =>
|
|
client.guilds.stickers.create(guildId, payload, reason),
|
|
edit: (stickerId: string, body: RESTPatchAPIGuildStickerJSONBody, reason?: string) =>
|
|
client.guilds.stickers.edit(guildId, stickerId, body, reason),
|
|
fetch: (stickerId: string, force = false) => client.guilds.stickers.fetch(guildId, stickerId, force),
|
|
delete: (stickerId: string, reason?: string) => client.guilds.stickers.delete(guildId, stickerId, reason),
|
|
};
|
|
}
|
|
}
|
|
|
|
export interface CreateStickerBodyRequest extends Omit<RESTPostAPIGuildStickerFormDataBody, 'file'> {
|
|
file: Attachment | AttachmentBuilder | RawFile;
|
|
}
|