Version 1 now released!
A super lightweight and robust Discord bot platform for your various Discord-needs.
Forget session handling, message handling, permissions and such. Focus on your core feature needs.
Comes with several ready-to-use commands and middleware. Like a role assigner and an antispam guard. Use as-is or build your dream bot.
npm install
in the extraction folder.discord.token=Your bot's application token.
discord.application_id=Your bot's application id.
discord.owner_id=Your own Discord client id.
You can use this same file to give default settings for the bot (see below, commands and middleware).
You are all set. You can run the bot now with a node tunneler
command. Make sure you give the bot suitable permissions to execute its tasks.
All the functionality the bot has is based on commands and middleware. A command is something that is given as a command to the bot. A middleware is applied to all messages.
You can enable or disable these functionalities in your .env-file:
cmd.ping=true
ping command enabled.
cmd.ping=false
ping command disabled.
A simple ping command that returns the current latency the bot experiences towards the Discord services. Useful for investigating what's going on with Discord.
Usage: @Tunneler ping
The user can request a specific role with the role command.
Usage: @Tunneler role example
Detects and bans spammers. Makes moderator's day a lot nicer.
Some commands and middleware do allow special configuration. See their corresponding folder for a README file to learn more:
For example src/middleware/antispam/README.md
You can either set global settings or guild specific settings. Use the .env file to set global settings and separate guild files for guild specific settings.
<guild id>.settings
or 123456789.settings
is the naming syntax for the guild file. It must be in the same folder as the .env file.
All settings missing from the guild settings file will be read from the global settings instead. If global setting is missing, a default value is used.
Important: Do not develop with a release build. Instead clone this repository with Git and apply npm install
to it.
Tunneler will give you a fast access to developing your own commands and middleware by allowing you to skip all the "how to connect Discord, handle messages, etc." hurdles.
Commands are something that always require two things:
@tunneler ping
where ping is the name of the command.Middleware apply to all messages with a one deliberate restriction:
All commands and middleware are under a specific folder structure. Commands are in src/commands
and middleware in src/middleware
.
All of the following instructions apply to middleware as well. Just replace "command" with "middleware".
src/commands
<cmd/mw>.<name>.ts
, for example cmd.ping.ts
. Js-files may also be supported, not tested and using ts is recommended.See cmd.ping.ts
or mw.antispam.ts
to get an idea of the ideal end result.
(client: Client, message: Message, flags: IFlags) => void
export default ping
Tip: see the flags interface (IFlags) to learn about utility variables that are in your disposal.
Enabling features is simple in Tunneler. Just add <cmd/mw>.<name>=true
into your .env-file. For example: cmd.ping=true
Run npm run dist
to build production ready code. The development build can be started with a npm start
dev.env
file to specify development environment specific variables.Tunneler has been 100% rewritten for this new release. This means that the backwards compatibility is broken. If you have your own custom commands made, see the chapter above about making your own commands to migrate your custom commands and middleware to 1.x and above.
It is highly recommended to remove the old Tunneler and everything related before using the new one.
You can re-use the Discord application (id and token).
Slash commands will emerge after the Discord API matures a bit more.
After years of using Tunneler, the exact needs for it have become more clear. The original Tunneler was way over-engineered and had tons of easy pitfalls. It was coded fast to serve a specific purpose and the end result wasn't as well thought as one'd desire. The new 1.x is basically an "how it should've been made" update.