A Python Bot library with an API like nextcord or discord.py, but instead of discord, it is made for the FOSS Social media Meower
Installing
pip install MeowerBot
Examples
from MeowerBot import Bot, CallBackIds
from MeowerBot.context import Context, Post
from MeowerBot.cog import Cog
from MeowerBot.command import command
import logging
from dotenv import load_dotenv # type: ignore
load_dotenv() # type: ignore
from os import environ as env
from MeowerBot.ext.help import Help as HelpExt
logging.basicConfig(
level=logging.DEBUG,
handlers=[
logging.FileHandler("debug.log", encoding='utf8'),
logging.StreamHandler()
]
)
logging.getLogger("websockets.client").setLevel(logging.INFO)
bot = Bot()
@bot.event
async def login(_token):
print("Logged in!")
@bot.command(name="ping")
async def ping(ctx: Context):
await ctx.send_msg("Pong!\n My latency is: " + str(bot.latency))
# noinspection PyIncorrectDocstring
@bot.command(name="logs")
async def get_logs(ctx: Context, *args):
"""
Arguments:
start: Optional[int]
end: Optional[int]
Formated like this:
start=...
@prefix get_logs start=-200 end=-1
"""
# start=...
# end=...
start = -10
end = -1
arg: str
for arg in args:
if arg.startswith("start"):
start = int(arg.split("=")[1])
elif arg.startswith("end"):
end = int(arg.split("=")[1])
with open("debug.log") as logfile:
logs = logfile.readlines()
message = await ctx.send_msg("".join(logs[start: end]))
if not message:
await ctx.reply("Error: Logs to big for current env")
@bot.command(name="bots")
async def get_bots(ctx: Context):
await ctx.reply(f"\n {" ".join(list(bot.cache.bots.keys()))}")
@ping.subcommand(name="pong")
async def pong(ctx: Context, *message: str):
await ctx.send_msg(f"Pong!{" ".join(message)}")
class Ping(Cog):
def __init__(self, bot: Bot):
super().__init__()
self.bot = bot
@command()
async def cog_ping(self, ctx: Context):
await ctx.send_msg("Pong!\n My latency is: " + str(self.bot.latency))
print(bot.api.headers.get("token"))
@cog_ping.subcommand()
async def ping(self, ctx: Context):
await ctx.send_msg("Pong!\n My latency is: " + str(self.bot.latency))
bot.register_cog(Ping(bot))
bot.register_cog(HelpExt(bot, disable_command_newlines=True))
bot.run(env["uname"], env["pswd"])
That example may be outdated.
(Updated as of 1/8/2024 CT)
If it is outdated, the place where it is taken from is the login test
Extra links
There are extra examples in the intergration tests The docs are located on my domain made with sphinx. They are located here MeowerBot.py's MIT LICENSE
Metadata
Release files for MeowerBot 3.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| meowerbot-3.3.2.tar.gz | 30.6 kB | Without provenance | Details for meowerbot-3.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| meowerbot-3.3.2-py3-none-any.whl | Python 3 | none | any | Details for meowerbot-3.3.2-py3-none-any.whl |
Total release size: 50.5 kB
Release files / meowerbot-3.3.2.tar.gz
| Download URL | meowerbot-3.3.2.tar.gz |
|---|---|
| Size | 30.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e9fa4f0a6f17365a09219b1be5dce8af412de4003fd1d0ef1c76eca56171c401
|
|
BLAKE2b-256 checksum How to use checksums |
b54720385d0a4a82d497a7177f7fd8d7d115b29cb1fa3818edccd49cd15c6c8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.12.0 Windows/10
|
Release files / meowerbot-3.3.2-py3-none-any.whl
| Download URL | meowerbot-3.3.2-py3-none-any.whl |
|---|---|
| Size | 20.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
75c1c9d57e4ecf416e0687822d03fe05213fdb14244893d48f8e6d6501035944
|
|
BLAKE2b-256 checksum How to use checksums |
e3e782828a33c3b4d9f74d1d4c17d1efdd6a7a489cbabdc0300f0d2e3ae0015c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.12.0 Windows/10
|
Security for MeowerBot 3.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.