Categories:

Commands for working with a bot with the Discord Bot Symbol-Protocol-Treasury:

  •   !treasury nem
  •   !treasury symbol
  •   !treasury all

Good day everyone, in this article I will talk about my experience in creating a discord bot that allows you to track the Symbol & NEM treasury. Here we will tell you what difficulties we encountered, since the team for creating a discord bot consists of three people:

– Fabrizio (Node Symbol: conrad.symbolnode.ninja)

– Klim (Node Symbol: NIS2.host)

– Angel (Node Symbol: XYM007.host)

Support our Symbol nodes!

The creation of the bot began with the creation of an open repository on GitHub:

https://github.com/klimgeran/Discord-symbol-trust-bot

We had to choose a programming language for our bot. When choosing a programming language, it was necessary to take into account the Discord API, as well as the Symbol SDK & NEM.

The Java code is structured as a maven project and we need to have the maven plugin installed in our pyCharm IDE, but since pyCharm does not support JAVA, we need to work in the Eclipse IDE, which was difficult for me and for Angel.

https://www.eclipse.org/downloads/packages/release/2022-03/r/eclipse-ide-enterprise-java-and-web-developers

Fabrizio created the foundation in the JAVA language, since he is quite familiar with the JAVA programming language, and at that time, together with Angel, I started creating a bot, through the discord developer site https://discord.com/developers

We also created infographics, maybe in the future we will change ICON, we will be glad to any ideas from the community.

Next, we needed to find out the exact addresses of the Symbol and NEM treasury. As a result, we got this:

We found a tutorial on creating a discord bot with Discord4J + Spring Boot https://www.baeldung.com/spring-discord4j-bot

 This guide said:

Discord4J is an open source Java library that can primarily be used to quickly access the Discord Bot API. This library integrates tightly with Project Reactor to provide a completely non-blocking API.

In this tutorial, we will be using Discord4J to create a simple Discord bot capable of responding to a predefined command.

At this stage, I finished creating the bot through the developers’ discord and received a new token. Fabrizio connected the bot via the API, this was a difficult task, as it seemed, but after 15 minutes, Fabrizio reported that the bot should issue the command hello world! when requesting !symbol:

Documentation we used for NEM and Symbol:

https://bob.nem.ninja/docs

https://docs.symbol.dev/guides/account/getting-account-information.html

Next, Fabrizio planned to run the Symbol Java sdk to get information from Symbol’s treasury account. Therefore, we needed help with Symbol and NEM documentation.

And at this time, Fabrizio had a problem with his Eclipse workspace.

Work on the creation of the bot was delayed for several days, but soon everything returned to normal.

To test the bot we had to add it to an unofficial discord server to test the bot:

And the main problem that was identified is the “reactive” API in Discord4J. Since when calling the Symbol SDK command for the Symbol Treasury, outside of the Discord message callback method, a positive response is received from the Treasury account, and when the call comes from the Symbol SDK, the “Mono” method in the “reactive” Discord4j, an error occurs. But Fabrizio, thanks to his knowledge of programming, managed to solve it.

A few days later, it was discovered that the key (token) of the bot was visible in the GitHub history, so it was no longer secure, so we generated a new key, in a few minutes.

While working with NEM Java sdk https://github.com/NEMPH/nem-apps-lib we had a problem with Maven JSON API code changed and upgraded to Git. The next step is testing by shutting down the running bot on the nis2.host VPS server, copying the new sources, and restarting.

It also came down to learning https://docs.discord4j.com

We had to decide what code to add to line 37 to 43 of the Java source file https://github.com/klimgeran/Protocol-Treasury/blob/main/src/main/java/com/github/klimgeran/symbol/discord/treasury/event/MessageListener.java . This is to add message.getContent().equalsIgnoreCase(“!nem”)), if we can add that line of code, we’re done. You can see the code that we added at the link above.

We decided to create the following commands to work with the bot:

  !treasury nem

  !treasury symbol

  !treasury all

  • Basically the problem is that nis2.host vps is running on Centos 8 and Git needed to be installed so that I could clone the repository from GitHub and compile the sources.
  • Since the centos 8 package installer gives an error, I had to copy the sources from Fabrizio’s VPS using the scp command.
  • After copying the sources, it was necessary to run “maven” to compile.
  • To compile Java sources, you need to install openjdk on vps nis2.host.
  • Again the Centos 8 package installer was throwing an error when “configuring the base repository”, so I had to change the Centos repositories according to this guide https://techglimpse.com/failed-metadata-repo-appstream-centos-8
  • Then it was possible to run
  • Update: update -y
  • This allowed docker to be updated, but caused symbol-bootstrap to break.
  • The next step was to install openjdk in order to compile and run the discord bot.
  • The Symbol nis2.host node was stopped, symbol-bootstrap had to be restarted. 

That’s all.

💜Let’s be honest that the idea of ​​creating a bot was proposed by Angel 👼🏻 she said the stars will converge so we will make a bot – puzzles 🧩 will add up and there will be a bot 🤖 for the community – we didn’t know where to start but we had a team, passion, Faith in Symbol. We talked with Fabrizio and he gladly agreed and Klim created a telegram group for communication! Of course, we are inspired by Jaguar, Hatchet, Gimre, and our entire community! We want to learn, contribute, and move forward together! There were moments when each of us was sad, but together we supported each other, special support was given by the Angel, he inspired us a lot! After all, it is always hard alone – but together we will always find a way and we are going the right way, supporting and learning new things, we become strong. Fabrizio and Klim also helped Me (the angel) by giving the necessary recommendations! We acted on the principles: Do not let your words diverge from actions. If your actions are not in line with your beliefs, you will always feel uncomfortable. We didn’t rush, we did, we made mistakes, we tried. Everyone makes mistakes, and how you deal with the consequences of your wrong decisions reflects your character. Admitting your mistakes is a sign of strength, not weakness. We have put together a strong team to make a difference for Symbol together.

It is absolutely normal to feel irritated in some situations. But patience and endurance can and should be trained. For example, if your friend (this is a pro (angel 👼🏻 ) doesn’t grasp information as quickly as you would like, think about it, maybe this is due to the fact that you don’t explain clearly enough? Or maybe he just doesn’t have your technical background and should you cut down on the use of technical terms?So we all didn’t jump to conclusions, but helped each other!A simple “thank you” or a detailed comment about how you appreciate the actions of another person helped us all to move forward!

We will be glad if you connect to our Symbol nodes:

  • Fabrizio (Node Symbol: conrad.symbolnode.ninja)
  • Klim (Node Symbol: NIS2.host)
  • Angel (Node Symbol: XYM007.host)

Tags:

One response

  1. Thanks Klim and Angel for your patience, especially for waiting me to come back from summer vacation in Sardinia!
    I’d like to add that Jaguar hints were so precious because helped to overcome not Just NEM and Symbol SDK questiona but also ti make simpler the bot source code.

Leave a Reply

Your email address will not be published. Required fields are marked *

You can delegate harvesting to our Symbol nodes:

– NIS2.host (Klim)

– XYM007.host (Angel)

Symbol wallet address:

KLIM:

SYMBOL (XYM)

NA4VOOQBORIWLTVHQOX43EZY2N3TUNLJ4SORKPA

_______

ANGEL:

SYMBOL (XYM)

NCRVIE26GXZG7JCKPRGGSA2WBHBBDRDC4V2GDHA