https://github.com/aweirddev/maint-sdk
The Official Maint SDK for Python.
https://github.com/aweirddev/maint-sdk
Last synced: 4 months ago
JSON representation
The Official Maint SDK for Python.
- Host: GitHub
- URL: https://github.com/aweirddev/maint-sdk
- Owner: AWeirdDev
- License: mit
- Created: 2023-03-30T08:38:59.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-30T10:30:54.000Z (about 3 years ago)
- Last Synced: 2025-03-18T05:45:26.702Z (about 1 year ago)
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Building a OB Component
Building a Maint OB (OhBoy) is demonstrated as follows.
```py
# main.py
from maint import Client
from component import MyComponent # your component!
client = Client()
@client.event('message')
async def message(ctx):
if ctx.author.bot:
return # filter out bots
await ctx.send(
ob=[
MyComponent(id="hello-world")
]
)
@client.ohboy_autocomplete('hello-world')
async def my_component_handler(ctx, value):
return [
# note: awaits don't do anything here, but returns a valid action type
await ctx.validate(["some good option you can choose", "...or this one"]),
await ctx.reply("Hello, I'm very very smart 😈")
]
client.run()
```
```py
# component.py
from maint.ob import OBComponent, OB, Param
def MyComponent(id: str = "my-ob-component") -> OBComponent:
return OBComponent([
OB.Input(
type="text",
autocomplete=True
),
parameters=[
Param(type="input.value")
],
id=id
])
```