![]() ![]() Why so drastic update?Īfter years of using Tunneler, the exact needs for it have become more clear. Slash commands will emerge after the Discord API matures a bit more. You can re-use the Discord application (id and token). It is highly recommended to remove the old Tunneler and everything related before using the new one. 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. This means that the backwards compatibility is broken. Tunneler has been 100% rewritten for this new release. Migrating from Tunneler 0.x to 1.x How to proceed? Use VS Code with ESLint and Prettier extensions.Tunneler doesn't react to its own messages.Using the given flags is a really handy way to make sure not everyone can execute mission critical commands.No need to double-check it in your function. Tunneler won't trigger your command if the command name wasn't mentioned.Create a dev.env file to specify development environment specific variables.The development build can be started with a npm start Other tips Run npm run dist to build production ready code. ![]() Enabling your command/middlewareĮnabling features is simple in Tunneler. Tip: see the flags interface (IFlags) to learn about utility variables that are in your disposal. Message holds the message that triggered the command.The function must have a default export.The given parameters are following: (client: Client, message: Message, flags: IFlags) => void.See or mw.antispam.ts to get an idea of the ideal end result. Js-files may also be supported, not tested and using ts is recommended. Name your index file with a following syntax.Create your command folder under src/commands.Just replace "command" with "middleware". Creating filesĪll of the following instructions apply to middleware as well. Commands are in src/commands and middleware in src/middleware. Middleware apply to all messages with a one deliberate restriction:Īll commands and middleware are under a specific folder structure. For example: ping where ping is the name of the command.The bot is either mentioned or the command is given in a direct channel.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.Ĭommands are something that always require two things: Instead clone this repository with Git and apply npm install to it. Important: Do not develop with a release build. Making custom commands and middleware for the bot If global setting is missing, a default value is used. env file.Īll settings missing from the guild settings file will be read from the global settings instead. settings or ttings is the naming syntax for the guild file. env file to set global settings and separate guild files for guild specific settings. You can either set global settings or guild specific settings. See their corresponding folder for a README file to learn more:įor example src/middleware/antispam/README.md ![]() Some commands and middleware do allow special configuration. The user can request a specific role with the role command.ĭetects and bans spammers. Useful for investigating what's going on with Discord. List of features cmd.pingĪ simple ping command that returns the current latency the bot experiences towards the Discord services. env-file:Ĭmd.ping=false ping command disabled. You can enable or disable these functionalities in your. A command is something that is given as a command to the bot. Commands and middleware What are they?Īll the functionality the bot has is based on commands and middleware. Make sure you give the bot suitable permissions to execute its tasks. You can run the bot now with a node tunneler command. You can use this same file to give default settings for the bot (see below, commands and middleware). Discord.token=Your bot's application token.ĭiscord.application_id=Your bot's application id.ĭiscord.owner_id=Your own Discord client id. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |