Skip to content

A Discord.py bot for PloudOS Minecraft servers

License

Notifications You must be signed in to change notification settings

allmityapp/AllcraftBot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RedstoneBot

A Discord bot for interacting with Minecraft servers hosted by PloudOS, originally built for the SMP BR Discord community.

This bot was built with Python 3.8, AIOHTTP, BeautifulSoup and discord.py.

Want to add this bot to your Discord server? Now you can! Redstone is now hosted on AWS Lightsail and runs non-stop, 24/7.

Want to create you own clone of this bot? Head over to the USAGE section below.

More non-technical info available at RedstoneBot's official website.

Note: This bot was built for educational purposes.

Gallery

image

Folder Structure

DEPRECATED

.
├── code                    # source code
|   ├── bot.py              # Discord commands, Requests session
|   ├── credentials.py      # PloudOS credentials, Discord token
|   ├── urls.py             # list of URLs
|   ├── login.py            # logs in to ploudos.com
|   ├── functions.py        # main async function definitions
|   └── format.py           # formats Rich Embeds
|
├── experiments             # Python files for experiments
|   ├── api_request.py      # testing requests and API calls
|   ├── autostart.py        # automatically enters queue and starts server
|   ├── queuetime.py        # scrapes ploudos.com for queue waiting times
|   ├── credentials.py      # see 'code' folder above
|   └── format.py           # see 'code' folder above
|
├── api.json                # collection of API calls and JSON responses
├── requests.txt            # PloudOS network sniffing analysis report
├── requirements.txt        # pip packages
|
├── LICENSE                 # GNU GPL v3.0 License
└── README.md               # you're reading this right now!

Usage (Ubuntu Linux)

Follow these steps to create a clone of RedstoneBot.

0. Register your bot app in the Discord Developers Portal

1. Make sure you have Python 3 and Pip installed on your machine

python3 --version

pip3 --version

If you don't, install them:

sudo apt update

sudo apt install python3

sudo apt install pip3

2. Clone this repo

git clone https://github.com/ChromeUniverse/RedstoneBot.git

3. Install and set up dependencies with Pip

pip3 install -r requirements.txt

5. Change directory

cd RedstoneBot/code/

6. Edit your credentials in credentials.py

nano credentials.py

# Change these placeholders with your actual PloudOS credentials
username = "ChromeUniverse"
password = "12345678"

# The secret bot token!
token = 'abcdefgh_12345678'

7. Run the Bash script with nohup

nohup bash script.sh

Progress

  • Created api_request.py to test the Requests module on PloudOS.com

    • Succesfully logs in
    • Gets response from internal PloudOS API
    • Decodes response using JSON
    • Can deal with "Currently in maintenance mode, check back later" errors/messages
  • Updated bot.py.

    • Now handles all actions with calls to internal PloudOS API
    • Async functions/API calls (needs refinement)
    • Added foolproofness - commands are only executed if server is in the appropriate state (i.e. the bot won't try to open the server once it's already online)
    • Auto-confirm on !redstone start
    • Server location selector
    • Displays queue waiting times
    • Add Discord to PloudOS server linking (only one PloudOS server per guild, currently)
    • Async requests with AIOHTTP
    • Separate files for most important functions
  • Credentials now stored in separate file

  • Added new project folder structure - Special thanks to Kriasoft and their Folder Structure Conventions

To-do List

  • Add instructions on how to add RedstoneBot to other servers
  • In bot.py:
    • Refine some stuff here and there - mostly Async code and auto-confirm
      • Async JSON parsing?
      • Async CSV/Database reading/writing?
    • Add multiple activation loops - one per Discord guild
  • Switch databases from CSV to SQLite3 (would this make sense?)
  • Scalability
  • Improve code robustness
  • Add a log file
  • Commands to add:
    • !redstone info - displays important server info, such as name, version, IP, port, resources and more.
    • !redstone reset - resets setup and clears database entry for the Discord guild
  • Prepare a Release to deploy RedstoneBot to AWS Lightsail

License

This open-source project is released under the GNU GPL v3.0 license. Check the LICENSE file for more details.

About

A Discord.py bot for PloudOS Minecraft servers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.9%
  • Shell 0.1%