Skip to main content

A Python wrapper for the Stoat API

Project description

A simple, flexible API wrapper for Stoat.

Key Features

  • Built on asyncio.

  • Sane rate limit handling that prevents 429s

  • Fast. Really faster than Revolt.py and voltage.

  • Low memory usage.

  • Customizable architecture. Build object parser in Rust to achieve high speeds.

  • Focuses on supporting both, bot and user accounts.

Installing

Python 3.10 or higher is required

To install the library, you can just run the following command:

# Linux/macOS
python3 -m pip install -U stoat.py

# Windows
py -3 -m pip install -U stoat.py

Or to install alpha master (with all new features):

# Linux/macOS
python3 -m pip install -U git+https://github.com/MCausc78/stoat.py@master

# Windows
py -3 -m pip install -U git+https://github.com/MCausc78/stoat.py@master

Quick Example

from stoat import Client

class MyClient(Client):
    async def on_ready(self, _, /):
        print('Logged on as', self.me)

    async def on_message(self, message, /):
        # don't respond to ourselves
        if message.author_id == self.me.id:
            return

        if message.content == 'ping':
            await message.channel.send('pong')

# You can pass `bot=False` to run as user account
client = MyClient(token='token')
client.run()

Bot Example

from stoat.ext import commands

# Pass `self_bot=True` to make your bot listen only to you
bot = commands.Bot(command_prefix='!')

@bot.command()
async def ping(ctx):
    await ctx.send('Pong!')

token = 'token'

# That's also allowed, just like in `discord.py`. Pass `bot=False` keyword argument if you want to run as user account.
bot.run(token)

Why Not

  • pyrevolt - Doesn’t follow PEP8 and does a ton of requests on startup (not member list).

  • voltage - Slow and simply copypasta from revolt.py.

  • revolt.py - Slow and unable to disable member list loading.

  • luster - Unmaintained library.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stoat_py-1.2.1.tar.gz (337.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stoat_py-1.2.1-py3-none-any.whl (380.2 kB view details)

Uploaded Python 3

File details

Details for the file stoat_py-1.2.1.tar.gz.

File metadata

  • Download URL: stoat_py-1.2.1.tar.gz
  • Upload date:
  • Size: 337.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for stoat_py-1.2.1.tar.gz
Algorithm Hash digest
SHA256 cc680a58c61f6e39b9cf29b36d1d0ddc8de03511379167bb8d4618514f770d4f
MD5 0c33d68e7022639db806288faea2ca16
BLAKE2b-256 c07e4482e46fe22a89ac8d603cc42c531bc6efa743b5a7f1db7f4ef9463dc3ee

See more details on using hashes here.

File details

Details for the file stoat_py-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: stoat_py-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 380.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for stoat_py-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 339a5e4cb8b3ad2fcd590672af5368076aab1298886e57ce5a5db51d989fda95
MD5 71eec05b30aca547fd94c2f4830c2a6a
BLAKE2b-256 f7d903b658ddb65f3c7e9f37b340be2beab5d191b39f81c4b773ba7b48583dc6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page