Marcos Susaña 026805bcb2
Seyfert 2.0 (#208)
* 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>
2024-06-20 20:59:55 -04:00

47 lines
1.5 KiB
TypeScript

import type { APIBan } from 'discord-api-types/v10';
import type { ReturnCache } from '../..';
import { fakePromise } from '../../common';
import { GuildBasedResource } from './default/guild-based';
import { type GuildBanStructure, Transformers } from '../../client/transformers';
export class Bans extends GuildBasedResource {
namespace = 'ban';
//@ts-expect-error
filter(data: APIBan, id: string, guild_id: string) {
return true;
}
override parse(data: any, key: string, guild_id: string) {
const { user, ...rest } = super.parse(data, data.user?.id ?? key, guild_id);
return rest;
}
override get(id: string, guild: string): ReturnCache<GuildBanStructure | undefined> {
return fakePromise(super.get(id, guild)).then(rawBan =>
rawBan ? Transformers.GuildBan(this.client, rawBan, guild) : undefined,
);
}
override bulk(ids: string[], guild: string): ReturnCache<GuildBanStructure[]> {
return fakePromise(super.bulk(ids, guild)).then(
bans =>
bans
.map(rawBan => {
return rawBan ? Transformers.GuildBan(this.client, rawBan, guild) : undefined;
})
.filter(Boolean) as GuildBanStructure[],
);
}
override values(guild: string): ReturnCache<GuildBanStructure[]> {
return fakePromise(super.values(guild)).then(
bans =>
bans
.map(rawBan => {
return rawBan ? Transformers.GuildBan(this.client, rawBan, guild) : undefined;
})
.filter(Boolean) as GuildBanStructure[],
);
}
}