Automate replit
is an async api wrapper for replit. It currently features:
- A working replit client
- A User object wrapper
- A Presence update function
- Basic notification collection
- A raw gql interface
Installation
pip install automate-replit -U
Docs
Docs can be found here
Examples
The ethan getter:
from autoreplit import ReplitClient
client = ReplitClient()
async def getEthan():
ethan = await client.getUserByName("not-ethan")
print(f"Ethan's id: {ethan.id}")
print(f"Ethan's follower count: {ethan.followerCount}")
if ethan.isOnline:
print("Ethan is online!")
else:
print(f"Ethan was last seen {ethan.lastSeen}")
print(f"Ethan's roles: {ethan.roles}")
print(f"All of ethan: {ethan}")
client.run(getEthan())
And, because it is async, it also works with discord.py:
from discord.ext import commands
import discord
from autoreplit import ReplitClient
from os import getenv
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix=commands.when_mentioned_or("mybot"), intents=intents)
client = ReplitClient(getenv("sid"))
@bot.event
async def on_ready():
await client.start()
@bot.event
async def on_close():
await client.close()
bot.run(getenv("TOKEN"))
A full discord.py bot example can be found here
Feedback
Feedback is very much appreciated, but here are some notes
- Queries will be prioritized over mutations
- I am already planning on making an easy comment bot module
- I am already planning on wrapping repl getting