fix: socram code

This commit is contained in:
MARCROCK22 2024-03-26 15:17:44 -04:00
parent d119262f07
commit 4428330c07

View File

@ -35,38 +35,4 @@ export class UsersShorter extends BaseShorter {
async write(userId: string, body: MessageCreateBodyRequest) {
return (await this.client.users.createDM(userId)).messages.write(body);
}
get users() {
return {
createDM: async (userId: string, force = false) => {
if (!force) {
const dm = await this.client.cache.channels?.get(userId);
if (dm) return dm as DMChannel;
}
const data = await this.client.proxy.users('@me').channels.post({
body: { recipient_id: userId },
});
await this.client.cache.channels?.set(userId, '@me', data);
return new DMChannel(this.client, data);
},
deleteDM: async (userId: string, reason?: string) => {
const res = await this.client.proxy.channels(userId).delete({ reason });
await this.client.cache.channels?.removeIfNI(BaseChannel.__intent__('@me'), res.id, '@me');
return new DMChannel(this.client, res);
},
fetch: async (userId: string, force = false) => {
if (!force) {
const user = await this.client.cache.users?.get(userId);
if (user) return user;
}
const data = await this.client.proxy.users(userId).get();
await this.client.cache.users?.patch(userId, data);
return new User(this.client, data);
},
write: async (userId: string, body: MessageCreateBodyRequest) => {
return (await this.client.users.createDM(userId)).messages.write(body);
},
};
}
}