Zephyrnet Logo

Building a Discord Bot for ChatOps , Pentesting or Server Automation (Part 5)

Date:

Coding and debugging with Visual Studio Code

Open Visual Studio Code and press CTRL+Shift+P to enter the input window. Write “ssh” and select “Remote-SSH: Add New SSH Host…” for adding our server. It will ask you IP Address and the user of our Digital Ocean server

The app will show us the success message allowing us to connect directly

Once again press CTRL+Shift+P and enter “Remote-SSH: Connect to Host…” and select the connection

Now we will use the knowledge of the previous steps. Create the “.env” file with your secret constants, the “requirements.txt” file with the dependencies and the “bot.py” file with your existing bot’s code

To test it quickly we need a “.env” file with the “DISCORD_TOKEN” constant

A “requirements.txt” file like this one

And for the simplest bot code write this in the “bot.py” file

In summary

Go back to the terminal or use the integrated terminal in Visual Studio Code and install the requirements with the command

To test the bot write the command

You should see the “<Your bots name and id> is connected” message in the terminal and in Discord you should see the bot status as online

If you like to debug in Visual Studio Code to fix some bugs or to understand the logic, press F5 key in the IDE and select “Python File”

The IDE will enter debug mode allowing you to breakpoint the code and see the content of the variables

We are all set for this step.

If you encounter typos or something doesn’t work no more write me a comment and I will keep this guide updated. Last update June 28 2020.

Source: https://chatbotslife.com/building-a-discord-bot-for-chatops-pentesting-or-server-automation-part-5-feea1c09b2de?source=rss—-a49517e4c30b—4

spot_img

Latest Intelligence

spot_img