kevinnovak / discord-bot-typescript-template Goto Github PK
View Code? Open in Web Editor NEWDiscord bot - A discord.js bot template written with TypeScript.
License: MIT License
Discord bot - A discord.js bot template written with TypeScript.
License: MIT License
Using yarn run commands:register
returns a Discord API Error.
[2022-09-02 19:02:21.228] ERROR: An error occurred while running a command action.
err: {
"type": "DiscordAPIError",
"message": "Bots cannot use this endpoint",
"stack":
DiscordAPIError[20001]: Bots cannot use this endpoint
at SequentialHandler.runRequest (/Users/thepassivetrust/Desktop/Web3SocialCapital/Tally/tallyho-bot/node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:287:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at SequentialHandler.queueRequest (/Users/thepassivetrust/Desktop/Web3SocialCapital/Tally/tallyho-bot/node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:99:14)
at REST.request (/Users/thepassivetrust/Desktop/Web3SocialCapital/Tally/tallyho-bot/node_modules/@discordjs/rest/src/lib/REST.ts:50:22)
at CommandRegistrationService.process (/Users/thepassivetrust/Desktop/Web3SocialCapital/Tally/tallyho-bot/src/services/command-registration-service.ts:24:27)
at start (/Users/thepassivetrust/Desktop/Web3SocialCapital/Tally/tallyho-bot/src/start-bot.ts:104:13)
"rawError": {
"message": "Bots cannot use this endpoint",
"code": 20001
},
"code": 20001,
"status": 403,
"method": "GET",
"url": "https://discord.com/api/v10/applications/tallyho--bot#8186/commands",
"requestBody": {}
}
This is due to changes in the Permissions V2 on (April 27, 2022). A related article can be found here
Perhaps it's an idea, e.g. if you only want a minimal version without sharding there is a branch which gives a minimal version of the template.
This is only an idea perhaps is useful, perhaps not you can tell.
Hi! Im fairly new to typescript itself so forgive me if the issue is easy to solve.
I've followed the instructions and I've installed everything correctly, but once i run
npm run start:dev
i get this error
`> [email protected] start:dev /Discord-Bot-TypeScript-Template
ts-node-dev --watch src//*.ts,config//.json,lang/**/.json src/start.ts
[INFO] 00:48:23 ts-node-dev ver. 1.1.6 (using ts-node ver. 9.1.1, typescript ver. 4.2.4)
/Discord-Bot-TypeScript-Template/src/services/lang.ts:12
return (this.multilingualService.getEmbed(embedName, langCode, variables) ??
^
SyntaxError: Unexpected token '?'
at wrapSafe (internal/modules/cjs/loader.js:1053:16)
at Module._compile (internal/modules/cjs/loader.js:1101:27)
at Module._compile (Discord-Bot-TypeScript-Template/node_modules/source-map-support/source-map-support.js:547:25)
at Module.m._compile (/tmp/ts-node-dev-hook-6096756080016301.js:69:33)
at Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at require.extensions. (/tmp/ts-node-dev-hook-6096756080016301.js:71:20)
at Object.nodeDevHook [as .ts] (Discord-Bot-TypeScript-Template/node_modules/ts-node-dev/lib/hook.js:63:13)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
[ERROR] 00:48:28 SyntaxError: Unexpected token '?' `
I've looked around at the code but i feel like this isnt something i can solve or figure out. Sorry for bugging you :)
Hi.
First of all, thanks a lot for this template. It's excellent to have it.
Would it be possible to add a hot reload to it? Would be great if its re-build and re-started automatically.
I tried few implementations, but they wouldn't work:
"dev:hot0": "nodemon --watch src --exec \"npm run dev\"",
"dev:hot1": "concurrently \"npm run build\" \"nodemon --watch src dist/start-bot.js\"",
Both of them stuck after change event triggered. Any ideas what might be wrong?
start-bot.ts requires the importation of command classes through the index.ts.
then, there is a command array created:
let commands: Command[] = [
// Commands
// Chat Commands
// _Admin
new CreateRoleCommand(),
new DeleteRoleCommand(),
// _Info
new CreditsCommand(),
new AddBotCommand(),
// _Moderation
new AssignRoleCommand(),
new BanCommand(),
new HelpCommand(),
new StatusCommand(),
// Message Context Commands
new ViewDateSent(),
// User Context Commands
new ViewDateJoined(),
// TODO: Add new commands here
]
You can see the problem if we have over 100 commands, the file would turn into 400-500 lines easily.
Any future dynamic solution to this? It leaves our hands tied.
one more ! SendVoiceMessages
14.11
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.