Skip to content

Question for "Event Setup" #71

Discussion options

You must be logged in to vote

Hello.

I'm a bit confused when you mention "immediately run". Do you want to:

  1. Have some code run without any event (including "ready") be triggered.
  2. Have some code run when the bot has started up.

Here's how you can achieve both of the above:

For 1:

To run code without any event being triggered (including "ready"), CommandKit doesn't really provide any way to handle this situation since it's out of the scope of handling commands/events with Discord.js. You can achieve this pretty easily however by placing your code anywhere before logging in to your client/bot.

// File: src/index.ts

// ... rest of your code

function main() {
  console.log('This will run immediately when the app starts…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@git-cameronbryce
Comment options

Answer selected by git-cameronbryce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants