Skip to content

ruancarllo/pirilampo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

This is a Brazilian educational bot for the Discord network, capable of answering several questions from students through ChatGPT, providing random and commented resolutions from the main entrance exams in the country coming from the Curso Objetivo, and organize the handouts of the study platform Plurall.

Pirilampo bot image

Setup

Here you will find a detailed walkthrough on how to sync this project with Discord and OpenAI credentials from scratch.

Discord application

To configure this application, go to the Dicord Developer Portal Applications, click the New Application button, type the name "Pirilampo", accept the terms and click Create.

In the General Information section, you define the App Icon as the image available in source/images/priilampo-icon.jpg, the Tags as "Education" and "ChatBOT" , and the Description with the following words:

🧬 Inteligência artificial do Grupo Paradoxo
🚀 Responde a perguntas em instantes
🏆 Explica as principais matérias

Ilustração por "Liam Moore" de "Ouch!"

Click the Save Changes button and go to the Bot section, found in the side menu. In this section, disable the Public Bot option and enable the Presence Intent, Server Members Intent, and Message Content Intent options. Get the application token from the Reset Token button, and place it in the .env file as DISCORD_TOKEN.

Click once more on Save Changes and go to OAuth2 in the URL Generator subsection. In this subsection, enable the bot option in the Scopes field, and the Read Messages/View Channels, Send Messages, Embed Links and Attach Files, Read Message History options in the Bot field Permissions.

Below, in the Generated URL field, there is a Copy button, which will copy the application's URL to your clipboard, so that it can be added to any existing servers on the social network.

This is possible as long as the bot has, in the desired channels, the following advanced permissions: View Channels, Send Messages, Embed Links, Attach Files, and Read Message History. You can enable this by right-clicking on the desired channel, going to Edit Channel and Permissions, where you will find the Add members or roles button for "Pirilampo" to the channel.

It is advisable to leave the name of the bot in green. To do so, enter the server's initial menu, click on its name and go to Server Settings and Roles. You can also reset the bot's job title to something like "Robô". Don't forget to click Save Changes after that.

Discord trusted channels

Put your trusted Discord channels ids in the .env DISCORD_TRUSTED_CHANNEL_IDS variable, separated by commas. They an be found in the end of a Discord channel URL, as the last path segment.

OpenAI ChatGPT

Access the OpenAI API Keys Center and click the Create new secret key button to create the token that you must put in .env as OPENAI_TOKEN.

Plurall bookshelf

Save the Plurall platform handout information in the source/assets/plurall-bookshelf.yaml file in a format similar to This one:

embedInfo:
  mainTitle: Biblioteca virtual do Plurall
  platformHref: https://maestro.plurall.net/bookshelf
  faviconUrl: <PLATFORM FAVICON URL>
  accentColor: 7611610 # Purple color in decimal

sections:
  - <SECTION NAME>:
    - <AREA NAME>:
      - <SUBJECT NAME>:
          PDF: <PDF BOOK URL>
          HTML: <HTML BOOK URL>
          spaceLine: false
  # Other sections, areas and subjects...

Run

To install this project's dependencies, you need to have NodeJS v20.5 and NPM v9.8 installed on your computer and their binaries available in the $PATH from your computer.

Therefore, open a terminal in the folder of a clone of this source code, and run the following command:

npm install --package-lock=false

To register the global slash commands (/) for this application, run:

npm run register-commands

Finally, to turn on the bot, let the following command run:

npm run initialize-client

Credits

Made with ❤️ by R.

About

An educational chatbot for the future

Topics

Resources

Stars

Watchers

Forks