fix: patch user and invite routes

This commit is contained in:
Paul Makles
2022-03-12 23:09:27 +00:00
parent 50789aec52
commit eb19ee0e9e
3 changed files with 8 additions and 9 deletions
+4 -4
View File
@@ -10,7 +10,7 @@ import type {
SendableEmbed
} from "revolt-api/types/Channels";
import type { RevoltConfiguration } from "revolt-api/types/Core";
import type { RetrievedInvite, ServerInvite } from "revolt-api/types/Invites";
import type { Invite, RetrievedInvite, ServerInvite } from "revolt-api/types/Invites";
import type {
Ban,
Category,
@@ -210,7 +210,7 @@ type Routes =
| {
// Edit user.
method: "PATCH";
route: `/users/${Id}`;
route: `/users/@me`;
data: {
status?: Status;
profile?: {
@@ -225,7 +225,7 @@ type Routes =
| {
// Change username.
method: "PATCH";
route: `/users/${Id}/username`;
route: `/users/@me/username`;
data: {
username: string;
password: string;
@@ -373,7 +373,7 @@ type Routes =
method: "POST";
route: `/channels/${Id}/invites`;
data: undefined;
response: { code: string };
response: Invite;
}
| {
// Add member to group.
+1 -2
View File
@@ -566,11 +566,10 @@ export class Channel {
* @returns Newly created invite code
*/
async createInvite() {
const res = await this.client.req(
return await this.client.req(
"POST",
`/channels/${this._id}/invites` as "/channels/id/invites",
);
return res.code;
}
/**
+3 -3
View File
@@ -291,8 +291,8 @@ export default class Users extends Collection<string, User> {
* Edit the current user
* @param data User edit data object
*/
async edit(data: Route<"PATCH", "/users/id">["data"]) {
await this.client.req("PATCH", "/users/id", data);
async edit(data: Route<"PATCH", "/users/@me">["data"]) {
await this.client.req("PATCH", "/users/@me", data);
}
/**
@@ -301,7 +301,7 @@ export default class Users extends Collection<string, User> {
* @param password Current password
*/
async changeUsername(username: string, password: string) {
return await this.client.req("PATCH", "/users/id/username", {
return await this.client.req("PATCH", "/users/@me/username", {
username,
password,
});