WatonAPI is an API used to connect to spigot servers with the WatonPlugin to communicate.

Overview

WatonAPI

WatonAPI Logo

Python API for WatonPlugin

WatonAPI is an API used to connect to spigot servers with the WatonPlugin to communicate. You can send messages to the server and read messages, making it useful for cross-chat programs.

Some examples of possible use cases are:

  • Minecraft Chat CLI
  • Cross Chat Discord Bot

And many more

Installation

WatonAPI is available on PyPi, so you can install it with pip

pip install watonapi

How to use

Documentation will be released soon

WatonAPI is an async library, meaning that it has to be run with asyncio. You can look in the examples directory to find example programs using the WatonAPI.

CLI Example

{packet['content']}") elif packet["type"] == "player_join": print(f"{packet['user']} joined the game!") elif packet["type"] == "player_leave": print(f"{packet['user']} left the game!") input_handler.cancel() # If it gets to here, the connection was lost print("Lost Connection") server = Server(server_ip) # Create a server object using the server ip asyncio.run(main(server)) # Run the main function ">
from watonapi.server import *
import asyncio

server_ip = ""
token = ""

async def async_input():
    return await asyncio.get_event_loop().run_in_executor(None, input)

async def take_input(server):
    while True:
        msg = await async_input()
        await server.send_msg('Waton CLI', msg) # When input is received, send it to the server

async def main(server):
    await server.add_listener("minecraft_msg") # Begin listening for a "minecraft_msg" packet
    await server.add_listener("player_join") # Begin listening for a "player_join" packet
    await server.add_listener("player_leave") # Begin listening for a "player_leave" packet
    
    authorized = False
    try:
        # If this doesn't fail, the token was correct and the connection authorized
        authorized = await server.connect(token)
    except Exception as e:
        print(f"Couldn't connect to server ( ERROR: {e} )")
    
    if authorized:
        input_handler = asyncio.create_task(take_input(server)) # Start an async task to get user input
        async for packet in server.get_listeners(): # Get all of the packets that we are listening for
            if packet["type"] == "minecraft_msg":
                print(f"<{packet['user']}> {packet['content']}")
            elif packet["type"] == "player_join":
                print(f"{packet['user']} joined the game!")
            elif packet["type"] == "player_leave":
                print(f"{packet['user']} left the game!")
        input_handler.cancel() # If it gets to here, the connection was lost
        print("Lost Connection")

server = Server(server_ip) # Create a server object using the server ip
asyncio.run(main(server)) # Run the main function
You might also like...
Telegram Bot to Connect Strangers

Telegram Bot to Connect Strangers How to Run Set your telegram bot token as environment variable TELEGRAM_BOT_TOKEN: export TELEGRAM_BOT_TOKEN=your_t

A collection of automation aids to connect various database systems into Lookout for Metrics
A collection of automation aids to connect various database systems into Lookout for Metrics

A collection of automation aids to connect various database systems into Lookout for Metrics

Connect your Nintendo Switch playing status to Discord!
Connect your Nintendo Switch playing status to Discord!

Disclaimer: Unfortunately, it appears that Nintendo has removed returning self-Presence in their API as of recently, making this project near obsolete

A Serverless Application Model stack that persists the $XRP price to the XRPL every minute as a TrustLine. There are no servers, it is effectively a "smart contract" in Python for the XRPL.

xrpl-price-persist-oracle-sam This is a XRPL Oracle that publishes external data into the XRPL. This Oracle was inspired by XRPL-Labs/XRPL-Persist-Pri

Discord bot to administer IITD Study Servers (unofficial)

IITD-Bot Discord bot to administer IITD'20 Acad Server Commands hello to check if bot is online ?help to display this message ?set kerberos to set y

A discord bot for tracking Iranian Minecraft servers and showing the statistics of them

A discord bot for tracking Iranian Minecraft servers and showing the statistics of them

Barbot is a discord bot made from discord.py and python, barbot is most to fun and roleplay for servers!
Barbot is a discord bot made from discord.py and python, barbot is most to fun and roleplay for servers!

BarBot Main source of barbot Overview Barbot is a discord bot made from discord.py and python, barbot is most to fun and roleplay for servers! Links i

πŸ’€ The first raid tool of its kind. Inject Deadcord and raid servers directly from the Discord client.
πŸ’€ The first raid tool of its kind. Inject Deadcord and raid servers directly from the Discord client.

πŸ’€ Deadcord The next upcoming Discord raid tool, the best for free. πŸŽ‰ Early Beta Released We have released an early version of Deadcord, please keep

Migration Manager (MM) is a very small utility that can list source servers in a target account and apply mass launch template modifications.

Migration Manager Migration Manager (MM) is a very small utility that can list source servers in a target account and apply mass launch template modif

Releases(v0.1)
Owner
Waton
Waton
A Python implementation of a Youtube Subscription manager & feed viewer, also does thumbnails

BUILDING Building requires python3.10, and the build package, which can be installed via pip: python3.10 -m pip install build To install, run python3.

2 Feb 28, 2022
A project in order to analyze user's favorite musics, artists and genre

Spotify-Wrapped This is a project about Spotify Wrapped (which is an extra option for premium accounts, but you don't need to be premium here) This pr

Hossein Mohseni 19 Jan 04, 2023
This is a starter template of discord.py project

Template Discord.py This is a starter template of discord.py project (Supports Slash commands!). πŸ‘€ Getting Started First, you need to install Python

1 Dec 22, 2021
0-1 knapsack with an additional constraint of maximum number of items used

extended_knapsack 0-1 knapsack with an additional constraint of maximum number of items used. Usage pip3 install extended_knapsack from extended_knaps

Lion Ralfs 1 Jan 06, 2022
Source code from thenewboston Discord Bot with Python tutorial series.

Project Setup Follow the steps below to set up the project on your environment. Local Development Create a virtual environment with Python 3.7 or high

Bucky Roberts 24 Aug 19, 2022
Matrix trivia bot with python

Matrix-trivia-bot Getting started See SETUP.md for how to setup and run the template project. Project structure A reference of each file included in t

1 Nov 16, 2021
asyncio client for Deta Cloud

aiodeta Unofficial client for Deta Clound Install pip install aiodeta Supported functionality Deta Base Deta Drive Decorator for cron tasks Examples i

Andrii Leitsius 19 Feb 14, 2022
Tools used by Ada Health's internal IT team to deploy and manage a serverless Munki setup.

Serverless Munki This repository contains cross platform code to deploy a production ready Munki service, complete with AutoPkg, that runs entirely fr

Ada Health 17 Dec 05, 2022
A bot i made for a dead com server lol it gets updated daily etc

6ix-Bot-Source A bot i made for a dead com server lol it gets updated daily etc For The UserAgent CMD https://developers.whatismybrowser.com/ thats a

Swiper 9 Mar 10, 2022
πŸ’° Import your ING Germany bank statements via FinTS into YNAB.

Import your ING Germany bank statements via FinTS into YNAB. Setup Before setting this up, please register your FinTS product – it's free and takes on

Arne Bahlo 23 Jan 21, 2022
🚧 finCLI's own News API. No more limited API calls. Unlimited credible and latest information on BTC, Ethereum, Indian and Global Finance.

🚧 finCLI's own News API. No more limited API calls. Unlimited credible and latest information on BTC, Ethereum, Indian and Global Finance.

finCLI 5 Jun 16, 2022
Pydf: A modular Telegram Bot which provides Pdf Tools using PyPdf2

pyDF-Bot 🌍 Pydf - Pyrogram Document File Bot, a modular Telegram Bot which prov

HyDrix 2 Feb 18, 2022
πŸ–₯️ Python - P1 Monitor API Asynchronous Python Client

πŸ–₯️ Asynchronous Python client for the P1 Monitor

Klaas Schoute 9 Dec 12, 2022
Prometheus exporter for CNMC API

CNMC Prometheus exporter It needs a Prometheus Pushgateway Install requirements via pip install -r requirements.txt Export the following environment v

GISCE-TI 1 Oct 20, 2021
Die wichtigsten APIs Deutschlands in einem Python Paket.

Deutschland A python package that gives you easy access to the most valuable datasets of Germany. Installation pip install deutschland Geographic data

Bundesstelle fΓΌr Open Data 921 Jan 08, 2023
A telegram user and chat info extractor with pyrogram python module

Made with Python3 (C) @FayasNoushad Copyright permission under MIT License License - https://github.com/FayasNoushad/Telegram-Info/blob/main/LICENSE

Fayas Noushad 8 Dec 22, 2021
A pre-attack hacker tool which aims to find out sensitives comments in HTML comment tag and to help on reconnaissance process

Find Out in Comment Find sensetive comment out in HTML ⚈ About This is a pre-attack hacker tool that searches for sensitives words in HTML comments ta

Pablo EmΓ­dio S.S 8 Dec 31, 2022
πŸŽ„ JustaGrabber - A discord token grabber written in python3

πŸŽ„ JustaGrabber - A discord token grabber written in python3 πŸŽ‡ Made by kldiscord https://github.com/kldiscord 🌟 Please leave a star if you liked Jus

1 Dec 19, 2022
An Undertale RPG Discord bot to fight monsters, bosses, level up and duel with other players

UNDERTALE-RPG An Undertale RPG Discord bot to fight monsters, bosses, level up and duel with other players!. Explanation you can collect gold which is

2 Oct 21, 2021
SpotPlay2YouPlay - Converts new additions to a Spotify playlist to a matching Youtube playlist

SpotPlay2YouPlay - Converts new additions to a Spotify playlist to a matching Youtube playlist, can also be configured to converting whole playlists with the refresh fun

9 Mar 06, 2022