Hi, i'm having troubles making this running... I made all the required steps and i still get theses errors:
{
"DISCORD_BOT_TOKEN": "MTA2OTY4MDQ3NjQ5MjY3NzEyMA.GGN4Qc.**********************",
"DISCORD_BOT_CLIENT_ID": "10696804***********",
"OPENAI_API_KEY": "sk-DNDM3CQUlM0K4HyBR3vNT3BlbkFJTo****************",
"ALLOWED_SERVER_IDS": [
"1069008854811164693",
"1069008854811164693"
]
}
*/
if (!DISCORD_BOT_CLIENT_ID) {
throw "DISCORD_BOT_CLIENT_ID must be set in env or config";
}
if (!DISCORD_BOT_TOKEN) {
throw "DISCORD_BOT_TOKEN must be set in env or config";
}
if (!OPENAI_API_KEY) {
throw "OPENAI_API_KEY must be set in env or config";
}
export const MAX_IMAGES = 4; // the API supports 1 to 10 images per request
export const DEFAULT_IMAGES = 2; // This is used when no number is given
export const IMAGE_SIZE: number = 256;
export const EXPAND_ACTION_PADDING = 120; // How many pixels the Expand action adds on each side
export const EXPAND_ACTION_NUM_IMAGES = 2; // how many images to show for an expand action
export const LOG_ERRORS = true;
if (DEFAULT_IMAGES > MAX_IMAGES) {
throw `DEFAULT_IMAGES must not be greater than MAX_IMAGES`;
}
// The API only supports these
if (![256, 512, 1024].includes(IMAGE_SIZE)) {
throw `Invalid IMAGE_SIZE ${IMAGE_SIZE}`;
}
import * as config from "./config.json";
export const DISCORD_BOT_TOKEN = MTA2OTY4MDQ3NjQ5MjY3NzEyMA.GGN4Qc.LQX9ycHT9wZfpJKzGXsQIdXB9LBo1jT0Jg9iks
process.env.DISCORD_BOT_TOKEN ?? config.DISCORD_BOT_TOKEN;
export const DISCORD_BOT_CLIENT_ID = 1069680476492677120
process.env.DISCORD_BOT_CLIENT_ID ?? config.DISCORD_BOT_CLIENT_ID;
export const OPENAI_API_KEY = sk-DNDM3CQUlM0K4HyBR3vNT3BlbkFJToEgfnSocbkNfil2****
alfred@pictocube:~/DALL-E/dallify-discord-bot-main$ npm run start
> [email protected] start
> ts-node src/Bot.ts
/home/alfred/DALL-E/dallify-discord-bot-main/node_modules/ts-node/src/index.ts:859
return new TSError(diagnosticText, diagnosticCodes, diagnostics);
^
TSError: ⨯ Unable to compile TypeScript:
src/utils/constants.ts:2:34 - error TS2304: Cannot find name 'MTA2OTY4MDQ3NjQ5MjY3NzEyMA'.
2 export const DISCORD_BOT_TOKEN = MTA2OTY4MDQ3NjQ5MjY3NzEyMA.GGN4Qc.LQX9ycHT9wZfpJKzGXsQIdXB9LBo1jT0Jg9iks
~~~~~~~~~~~~~~~~~~~~~~~~~~
src/utils/constants.ts:3:43 - error TS2339: Property 'DISCORD_BOT_TOKEN' does not exist on type '({ DISCORD_BOT_TOKEN: string; DISCORD_BOT_CLIENT_ID: string; OPENAI_API_KEY: string; ALLOWED
_SERVER_IDS: string[]; const?: undefined; number?: undefined; throw?: undefined; } | { if(: any, DISCORD_BOT_CLIENT_ID: any): never; if(DEFAULT_IMAGES: any, MAX_IMAGES: any): never; ... 6 m
ore ...; ALLOWED_SERVER_IDS?: undefi...'.
3 process.env.DISCORD_BOT_TOKEN ?? config.DISCORD_BOT_TOKEN;
src/utils/constants.ts:5:47 - error TS2339: Property 'DISCORD_BOT_CLIENT_ID' does not exist on type '({ DISCORD_BOT_TOKEN: string; DISCORD_BOT_CLIENT_ID: string; OPENAI_API_KEY: string; ALLOWED_SERVER_IDS: string[]; const?: undefined; number?: undefined; throw?: undefined; } | { if(: any, DISCORD_BOT_CLIENT_ID: any): never; if(DEFAULT_IMAGES: any, MAX_IMAGES: any): never; ... 6 more ...; ALLOWED_SERVER_IDS?: undefi...'.
5 process.env.DISCORD_BOT_CLIENT_ID ?? config.DISCORD_BOT_CLIENT_ID;
~~~~~~~~~~~~~~~~~~~~~
src/utils/constants.ts:7:31 - error TS2304: Cannot find name 'sk'.
7 export const OPENAI_API_KEY = sk-DNDM3CQUlM0K4HyBR3vNT3BlbkFJToEgfnSocbkNfil2****
~~
src/utils/constants.ts:7:34 - error TS2304: Cannot find name 'DNDM3CQUlM0K4HyBR3vNT3BlbkFJToEgfnSocbkNfil2UW25'.
7 export const OPENAI_API_KEY = sk-DNDM3CQUlM0K4HyBR3vNT3BlbkFJToEgfnSocbkNfil2****
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/utils/constants.ts:8:40 - error TS2339: Property 'OPENAI_API_KEY' does not exist on type '({ DISCORD_BOT_TOKEN: string; DISCORD_BOT_CLIENT_ID: string; OPENAI_API_KEY: string; ALLOWED_SERVER_IDS: string[]; const?: undefined; number?: undefined; throw?: undefined; } | { if(: any, DISCORD_BOT_CLIENT_ID: any): never; if(DEFAULT_IMAGES: any, MAX_IMAGES: any): never; ... 6 more ...; ALLOWED_SERVER_IDS?: undefi...'.
8 process.env.OPENAI_API_KEY ?? config.OPENAI_API_KEY;
~~~~~~~~~~~~~~
src/utils/constants.ts:9:129 - error TS2339: Property 'ALLOWED_SERVER_IDS' does not exist on type '({ DISCORD_BOT_TOKEN: string; DISCORD_BOT_CLIENT_ID: string; OPENAI_API_KEY: string; ALLOWED_SERVER_IDS: string[]; const?: undefined; number?: undefined; throw?: undefined; } | { if(: any, DISCORD_BOT_CLIENT_ID: any): never; if(DEFAULT_IMAGES: any, MAX_IMAGES: any): never; ... 6 more ...; ALLOWED_SERVER_IDS?: undefi...'.
9 export const ALLOWED_SERVER_IDS: string[] = process.env.ALLOWED_SERVER_IDS ? process.env.ALLOWED_SERVER_IDS.split(",") : config.ALLOWED_SERVER_IDS ?? []; // only servers with these ids can use the bot
~~~~~~~~~~~~~~~~~~
at createTSError (/home/alfred/DALL-E/dallify-discord-bot-main/node_modules/ts-node/src/index.ts:859:12)
at reportTSError (/home/alfred/DALL-E/dallify-discord-bot-main/node_modules/ts-node/src/index.ts:863:19)
at getOutput (/home/alfred/DALL-E/dallify-discord-bot-main/node_modules/ts-node/src/index.ts:1077:36)
at Object.compile (/home/alfred/DALL-E/dallify-discord-bot-main/node_modules/ts-node/src/index.ts:1433:41)
at Module.m._compile (/home/alfred/DALL-E/dallify-discord-bot-main/node_modules/ts-node/src/index.ts:1617:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1300:10)
at Object.require.extensions.<computed> [as .ts] (/home/alfred/DALL-E/dallify-discord-bot-main/node_modules/ts-node/src/index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1103:32)
at Function.Module._load (node:internal/modules/cjs/loader:942:12)
at Module.require (node:internal/modules/cjs/loader:1127:19) {
diagnosticCodes: [
2304, 2339,
2339, 2304,
2304, 2339,
2339
]
}