Analytics (TS)
Welcome to your fresh Robo.js project!
Embark on a journey where your Discord projects transcend the ordinary. With Robo.js as your guide, you'll experience a seamless, file-based setup, an integrated database, TypeScript support, and a multitude of plugin-powered skills to unlock along the way.
Ready to embark on this adventure?
β π Documentation: Getting started
β π Community: Join our Discord server
Getting Startedβ
Create a project with this template, replacing <project-name>
with your desired name:
npx create-robo <project-name> --template discord-bots/analytics-ts
Then navigate into your project directory:
cd <project-name>
Run development mode:
npm run dev
β π Documentation: Exploring Different Run Modes
β π Documentation: Deploying for Free with 24/7 Uptime
Developing οΈβ
Create new slash commands by making a new file under the /src/commands
directory with an exported default function. The file's name becomes the command's name. You can either use the interaction
parameter or return the result to let Sage handle it for you. For more info on commands, see the Discord.js Documentation.
Commands will be automatically registered with Discord when needed, but you can force it by running npx robo build -f
.
To listen to new events, create a file named after the event in /src/events
. For example, typingStart.js
will notify you when someone starts typing. You can stack multiple files for the same event by making a directory named after the event. Files inside it can be named whatever you want. For example:
- src
- events
- typingStart
- your-file.js
- another.js
β π Documentation: Slash commands
β π Documentation: Events
β π Documentation: Context Menus
Debuggingβ
Got bugs? No biggie! Robo.js has your back with nifty built-in debugging magic. During dev mode, Robo will provide you with error information, stack traces, interactive logs, and even a sneak peek at the exact code that caused the issue!
To get started, set up a personal Discord server for your Robo to hang out in and add your server's ID as a DISCORD_GUILD_ID
env variable. Doing this unlocks the fab debugging features, plus the super-handy /dev
command that gives you quick access to logs, system info, and more.
β π Documentation: Debugging
Configuration οΈβ
Robo.js automatically handles creating your Discord.js Client
instance, but you can still configure what gets passed to it using the config/robo.mjs
file. Use it to add more intents or change the behavior of other Robo.js features such as Sage.
The .env
file contains your DISCORD_TOKEN
and DISCORD_CLIENT_ID
. Keep these secret. You can get these values from the Discord Developer Portal.
Pluginsβ
This Robo boasts an intuitive plugin system that grants new capabilities instantly!
npx robo add @robojs/ai
Swap out
@robojs/ai
with your chosen plugin's package name
With that, your Robo automatically equips itself with all the features the plugin offers. Want to revert? Simply use robo remove
to uninstall any plugin.
β π Documentation: Installing plugins
Crafting something unique in your Robo project? You can turn your innovations into plugins, be it specific functionalities or your entire Robo. Share your genius with the world!
β π Documentation: Creating plugins
Deploymentβ
Run the deploy
command to automatically deploy to RoboPlay once you're ready to keep your robo online 24/7.
npm run deploy
β π RoboPlay: Hosting your Robo
You can also self-host your robo anywhere that supports Node. Just make sure to run build
followed by start
:
npm run build
npm start
You can also run invite
(beta) to automatically generate a server invite to test it yourself or show it off! You can also use the Discord Developer Portal to generate an invite as usual.
npm run invite
Happy coding! π