From b9251019bf2ad92542fde24b5d06059068455a1e Mon Sep 17 00:00:00 2001 From: MatthieuCoder Date: Thu, 5 Jan 2023 21:34:34 +0400 Subject: [PATCH] change user depending on the rest token in the rest component --- src/register.ts | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/register.ts b/src/register.ts index 303f4d8..1758957 100644 --- a/src/register.ts +++ b/src/register.ts @@ -1,14 +1,18 @@ -import 'source-map-support'; -import {REST} from '@discordjs/rest'; -import {commands} from './commands'; -import {registerCommands} from './sys/handler'; +import "source-map-support"; +import { REST } from "@discordjs/rest"; +import { commands } from "./commands"; +import { registerCommands } from "./sys/handler"; +import { RESTGetAPIUserResult, Routes } from "discord-api-types/v10"; const rest = new REST({ - version: '10', - api: 'http://localhost:8090/api', -}).setToken('_'); + version: "10", + api: "http://localhost:8090/api", +}).setToken("_"); /** * We register the commands with discord */ -(async () => registerCommands(commands, rest, '807188335717384212'))(); +(async () => { + let self = (await rest.get(Routes.user("@me"))) as RESTGetAPIUserResult; + registerCommands(commands, rest, self.id); +})(); -- 2.39.5