GithubHelp home page GithubHelp logo

kevinnovak / discord-bot-typescript-template Goto Github PK

View Code? Open in Web Editor NEW
427.0 427.0 78.0 1.1 MB

Discord bot - A discord.js bot template written with TypeScript.

License: MIT License

TypeScript 99.78% Dockerfile 0.22%
boilerplate bot bot-framework bots discord discord-api discord-bot discord-bot-template discord-js discordbot discordjs example framework shard sharding starter template typescript

discord-bot-typescript-template's Introduction

KevinNovak's GitHub Stats

discord-bot-typescript-template's People

Contributors

djstompzone avatar kevinnovak avatar khernand avatar scottbucher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

discord-bot-typescript-template's Issues

Register Commands No Longer Working Due to Permission Changes

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

Maybe multiple branches for multiple variants?

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.

SyntaxError: Unexpected token '?'

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 :)

Can we have hot reload?

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?

Template Encourages too much Redundancy

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.