What is a Snippet
A Snippet is a function that you can use which will run in the entire framework. It is basically a global function that applies to your entire code.
You can get a list of all the Snippets that there are. In addition, you can choose to disable a Snippet easily.
Below you will find out how to create a Snippet, as well as the methods that may be used to help you with creating a Snippet file.
Constructor
To create a Snippet, you will need to create a new ".js" file inside the functions/snippets folder.
Below is an example of how a default Snippet file is structured:
var Spark = require("sparkbots") const Snippet = Spark.snippet("Snippet-name") Snippet.code = () => { // Execute Code Here } module.exports = Snippet;
Methods
-
.disable()
-
client.snippets.list()
Provides a list of all the Snippets that there are.
-
.
()