Salazar - a Discord bot that is easy to customize and configure, aiming at the possibility of customization for the user

Overview

Salazar, a customizable elegant bot for Discord

This is the BETA version, which uses the current version of Node.js (18.0.0) with the use and implementation of the "fetch" function to use together with API's. The purpose of this bot is to be fully customizable, easy to access, easy to implement and educational.


Salazar emerged as an alternative to the classic pre-customized BOT's offered on the internet today, in order to be intuitive so that anyone, regardless of their degree of programming experience, can customize and make it look their own. Salazar was the name given to the project that makes the source code available in TypeScript for further studies and pertinent customizations. The name was chosen due to the creator's personal tastes.

All updates will be notified and duly amended in this documentation for a complete reading of the full operation of this BOT. If you are interested in contributing, feel free, your point of view and your implementations are essential for the vital functioning of the project.

If you want to easily add this package to your project run:

npm i salazar-beta

Basic installation

The source code has a complete implementation of libraries responsible for connecting the code with the Discord platform. First of all, it is necessary that you create your personal bot, and thus, generate a token for its access. To access the "Discord Developer Portal" click here. To read a little more about specific functions of the "discord.js" used in this project click here.

The main file that will have the role as the "heart" of our project will be "index.ts", with imports referring to "discord.js" and "dotenv" (responsible for creating a ".env" configuration file that will contain our previously created BOT access token).

Before starting your implementations with the BOT, make sure your generated token is correct. To do this, change it by adding your token in the ".env" file and start your BOT with the command "ts-node index.ts" in the terminal. Test some Discord command in which your BOT was added, such as "!gato" to see a photo of a cat returned in the message field.

Now that you are sure that your BOT is working perfectly, we can move on to full customization and customization.

Code understanding

For any code study, it is vital that we have a full understanding of how the code works, and for that, this area is dedicated to a study of the source code.

Initially, we must emphasize the need for imports provided by other libraries, in order to facilitate our daily life in relation to the development of BOTs, so we have some imports seen at the beginning of our code, followed by a call of a function responsible for the validation of our token (the BOT token created with Discord). Until the first function export we have initial settings for validation of our platform. With this, as soon as the BOT is working properly, we will see a message in our chat alerting its correct operation and connection to the platform.

  • The export of this function named "http" will be responsible for validating commands and returns within Discord, so all code referring to the return with some message, reaction or something like that will be done within this function.

The "discord.js" library already provides functions related to the BOT's interaction with Discord, such as creating messages for verification, or returning messages through direct responses. We can see that when a message is created, it is checked with "client.on('messageCreate', (message))", and so we can assign a series of commands to return or reply.

The reply of some message can be done with "message.reply({content: reply})" in which "reply" is a variable with some specific content, as well as it could be a simple sentence too.

Finally, we have the BOT login with "client.login(process.env.TOKEN)" which verifies our previously provided token.

Now that we understand the basics of how our code works, initialization steps and first interactions with the user, we can start studying the use of web APIs, pre-defined commands or different functions.

Web API implementations

For each API used, a specialized file was created to better organize and compose our BOT. For this, I will cite as an example the file "quotes.ts", responsible for returning a user-friendly random phrase.

At the beginning we have the import of a library called "cross-fetch", which will be responsible for facilitating our verification process and returning an API, exporting an async function called "quote", which will return the content of a JSON via the web , that is, the JSON of our API that can be verified in the link by clicking here.

As soon as the return is done successfully, we will store the complete JSON content in a variable, which will later be "wrapped" and filtered so that we only have the content of a specific column or attribute, allowing for a more pleasant interface for the user.

This same variable will be returned, and this function will be called in our "index.ts" every time it is verified that the message "!frase" has been sent in our Discord.

  • It is important to point out that this version of Salazar uses the current version of Node.js, so the "fetch" function is already pre-implemented for using web APIs, so it is vital that if you use a configuration with the version LTS use the final official version of Salazar. The BETA version aims to make use of new features made available by the community.

Finally, in our "index.ts" we have the import and call of the "quote" function, with the creation of a "Waiter" class (essential for using async functions), and then the return of the message with its content being the variable that received the return from our web API.


Every command and every use of a web API can be easily verified, thus facilitating our customization. As time goes by, new updates will be released, so it's vital that you contribute to our community. Thank you very much, and good use 🧙 !


GitHub followers ⠀Twitch Status ⠀Twitter Follow

You might also like...

Service Installer for VMware Tanzu is a one-click automation solution that enables VMware field engineers to easily and rapidly install, configure, and operate VMware Tanzu services across a variety of cloud infrastructures.

Service Installer for VMware Tanzu Service Installer for VMware Tanzu seeks to provide a one-click automation solution to enable our VMware engineers

Dec 1, 2022

A Meme generator website where you can change and customize images to create great memes😎.

A Meme generator website where you can change and customize images to create great memes😎.

App Screenshot: Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory,

Dec 21, 2022

For this workshop, we're going to learn more about cloud computing by exploring how to use Pulumi to build, configure, and deploy a real-life, modern application using Docker

For this workshop, we're going to learn more about cloud computing by exploring how to use Pulumi to build, configure, and deploy a real-life, modern application using Docker. We will create a frontend, a backend, and a database to deploy the Pulumipus Boba Tea Shop. Along the way, we'll learn more about how Pulumi works.

Dec 29, 2022

Easily open daily notes and periodic notes in new pane; customize periodic notes background; quick append new line to daily notes.

Easily open daily notes and periodic notes in new pane; customize periodic notes background; quick append new line to daily notes.

Obsidian daily notes opener This plugin adds a command for opening daily notes in a new pane (so that a keyboard shortcut could be used!) and gives ex

Dec 26, 2022

local docker-compose environment to deploy and configure backoffice

backoffice-local local docker-compose environment to deploy and configure backoffice How to install To install the repo dependencies yarn install be s

Dec 15, 2022

Serialize arbitrary NodeJS closures and customize serialization behavior.

Closure Serializer This is a fork of the Pulumi Closure Serializer. @pulumi/pulumi. Motivation Functionless allows developers to write cloud applicati

Jul 19, 2022

A monorepo that uses the AWS Cloud Development Kit to deploy and configure nanomdm on AWS lambda.

NanoMDM on AWS This repo builds and configures a nanomdm server to run on AWS lambda. It uses the Cloud Development Kit and tries to follow best pract

May 26, 2022

Custom alert box using javaScript and css. This plugin will provide the functionality to customize the default JavaScript alert box.

customAlertBoxPlugin Custom Alert Box Plugin Using JavaScript and CSS Author: Suraj Aswal Must Include CSS Code/Default Custom Alert Box Class: /* mus

Sep 10, 2022
Releases(0.1)
  • 0.1(May 16, 2022)

    This is the first version of the beginning of the Salazar project, in order to facilitate studies regarding the creation of high functionality BOTs for Discord!

    Source code(tar.gz)
    Source code(zip)
Owner
guto
Meu nome é João Augusto Lissoni Lanjoni, cursando Bacharelado em Sistemas de Informação e Técnico em Informåtica pelo IFSP!
guto
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
The /r/place Atlas is a project aiming to catalog all the artworks created during Reddit's 2022 /r/place event.

The 2022 Place Atlas The /r/place Atlas is a project aiming to catalog all the artworks created during Reddit's 2022 /r/place event. This project was

Place Atlas 397 Dec 28, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till mÀnniskor pÄ flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Lazy evaluation list with high tree-shaking affinity and easy customization.

Lazy evaluation list with high tree-shaking affinity and easy customization. Features ?? Lazy Evaluation: The collections are only enumerated to the m

Masanori Onoue 22 Dec 28, 2022
Forked from hayes0724/shopify-packer Modern development tool for Shopify using Webpack 5. Easy to extend and customize, zero build config, compatible with Slate and existing websites.

Shopify Packer Modern development tool for Shopify using Webpack 5. Easy to extend and customize, zero build config, comes with starter themes and com

Web & Mobile | eCommerce | Full-Stack Developer 4 Nov 24, 2022
A starter and demo project for Keycloakify v6 - Component level customization.

A starter/demo project for Keycloakify ⚠ Please read the two following notices ⚠ This starter is for Component-level customization, if you only want

Joseph Garrone 12 Dec 26, 2022
Project to manage multiple emails at once with lots of customization. You can send and receive emails. Desktop notifications can be modified.

Technologies Used React Redux Tailwind CSS Features Admin dashboard User settings and or user dashboard send emails recive emails Connections through

Multi Email 9 Dec 17, 2022
A non-overflowing `console.table` alternative with customization options.

nice-table A non-overflowing console.table alternative with customization options. Usage import { createTable } from 'nice-table'; type Person = {

Tim van Dam 5 Aug 4, 2022
This is a template for a peripheral customization PWA.

Peripheral Customization PWA This repository contains a template Progressive Web App (PWA) that can be used to customize peripherals. The template was

Google 3 Sep 30, 2022