mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-05 06:26:08 +00:00
fix: socram code
This commit is contained in:
parent
d119262f07
commit
4428330c07
@ -35,38 +35,4 @@ export class UsersShorter extends BaseShorter {
|
|||||||
async write(userId: string, body: MessageCreateBodyRequest) {
|
async write(userId: string, body: MessageCreateBodyRequest) {
|
||||||
return (await this.client.users.createDM(userId)).messages.write(body);
|
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);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user