Usage - Cowoding-Jams/Jambo Wiki

This page is divided into 2 big categories for two different groups of people.

  • The "Setup and Usage" section is mostly dedicated to people who may be new to all this and just want to use the bot we created on their own server.
  • The "Development" part is there to help other developers work on their own version of the bot and create truely amazing things.

Setup and Usage

First things first: to run the bot on your own you need the node.js framework installed on your system.

Configuring and running the bot

  1. Start by creating a bot on the Discord Developer Portal with the necessary scopes (bot, applications.commands) and permissions.
  2. Add the necessary informations from there to the .env_sample and rename it to .env.
  3. Edit the src/config.ts to your hearts content and configure the bot for your needs.
  4. Run npm install via the console in the directory to install all the required dependencies.
  5. Use npm run start to build the project and run it.

How to use the ...

If you already read the homepage you should have a brought overview of what each system is there for and what it can do in principal. Here we go over all the commands in detail. You probably won't really need it though. Most of the time the slash commands and the options with their descriptions will tell you everything you need to know.

LaTeX utilities

LaTeX is a system for rendering beautiful mathematical equations. The LaTeX utilities allow you to input LaTeX code and get a rendered image back.

Input (Syntax) Description
/latex equation <input> [transparent] Returns a single math equation. The input is the code that ends up in the block equation. The boolean option transparent changes the background.
/latex mixed <input> [transparent] [paper-size] Renders your LaTeX code (input) like a normal LaTeX document with your code ending up in the document enviroment. The transparent mode does the same as above and also defaults to true. You can use inline equations and block equations like always. The paper-size defaults to a5.

To see which packages are included and can be used see the template.tex

Country info system

In general the autocompletion will help you a lot to figure out what your options are. Just follow it when you're unsure.

Input (Syntax) Description
/country overview <country> Gives you an overview over a country which its most important infos.
/country random Gives you an overview over a randomly picked country.
/country specific <info> <country> Gives you a specific piece of data you want for a specified country.
/country query <sort-criteria> <order> <scale> <filter-criteria> <relation> <filter-value> [include-data - default: true] Lets you query the country data with lots of options. You will see which option each parameter has when you test it. When you only want one of the things (sorting or filtering) pick none as the criteria. When sorting and filtering the included data will automatically pick the best option to show.

Development

Working with our system

This should give you an overview over the important things to know to use our codebasis.

Scripts

Currently there are 4 scripts definied for this project.
You can run them by using npm run [script name]

  • prettify to let eslint and prettier look over the code and enforce the specified beauty standards
  • build to compile the TypeScript to JavaScript code with the tsconfig.json
  • run to run the main script (start.js)
  • start as a shorthand for build and then run

Logging

We're using winston as logger to log all the important infos instead of the typical console.log("").
This gives us a lot more clearity and order.

To use it just import the logger from the logger.ts in the src folder and use logger.debug("xy") (or with any other loglevel).
(for example importing from one of the command files looks like this: import logger from "../logger")

You can set the level of detail you want in the your src/config.ts file to be for example error, warn, info or debug (in order of importance). All the other levels can be found here. The error messages will also be stored in the logs folder.

⚠️ **GitHub.com Fallback** ⚠️