Support Alconna to GraiaProject
Reason this release was yanked:
bugs
Project description
Alconna Graia
������������ Alconna
��� GraiaProject
������������������������
������������������Dispatcher���SayaSchema ��� ������������
������������
���������
from arclet.alconna.graia import AlconnaDispatcher, Match, AlconnaProperty
from arclet.alconna import Alconna, Args
...
app = Ariadne(...)
alc = Alconna("!jrrp", Args["sth", str, 1123])
@app.broadcast.receiver(
GroupMessage,
dispatchers=[AlconnaDispatcher(alc, send_flag='stay')]
)
async def test2(
group: Group,
result: AlconnaProperty[GroupMessage],
sth: Match[str]
):
print("sign:", result.result)
print("sender:", group)
print("match", sth.available, sth.result)
������ Saya
in module.py:
from arclet.alconna.graia import AlconnaDispatcher, Match, AlconnaProperty, AlconnaSchema
from arclet.alconna import Alconna, Args
...
channel = Channel.current()
alc = Alconna("!jrrp", Args["sth", str, 1123])
@channel.use(AlconnaSchema(AlconnaDispatcher(alc)))
@channel.use(ListenerSchema([GroupMessage]))
async def test2(group: Group, result: AlconnaProperty[GroupMessage], sth: Match[str]):
print("sign:", result.result)
print("sender:", group)
print("match", sth.available, sth.result)
in main.py:
from arclet.alconna.graia import AlconnaBehaviour
from creart import create
...
saya = create(Saya)
create(AlconnaBehaviour)
with saya.module_context():
saya.require("module")
������ Saya Util
in module.py:
from arclet.alconna.graia import Match, command, from_command
from arclet.alconna import Alconna, Args, Arpamar
...
@command(Alconna("!jrrp", Args["sth", str, 1123]), private=False)
async def test2(group: Group, result: Arpamar, sth: Match[str]):
print("sign:", result)
print("sender:", group)
print("match", sth.available, sth.result)
@from_command("foo bar {baz}")
async def test2(baz: int):
print("baz", baz)
in main.py:
from creart import create
...
saya = create(Saya)
with saya.module_context():
saya.require("module")
AlconnaDispatcher ������������
class AlconnaDispatcher(BaseDispatcher):
def __init__(
self,
command: Union[Alconna, AlconnaGroup],
*,
send_flag: Literal["reply", "post", "stay"] = "stay",
skip_for_unmatch: bool = True,
send_handler: Optional[Callable[[str], MessageChain]] = None,
allow_quote: bool = False
): ...
command
: ��������� Alconna ������
send_flag
: ���������������������������������������
- reply: ������������������������������
- post: ��������������� Broadcast ������
- stay: ������ AlconnaProperty ������������������������
skip_for_unmatch
: ���������������������������, ��������������������� send_flag ������
send_handler
: send_flag ��� reply ��� ���������������������������
allow_quote
: ������������������������������������������
������������
Query
Match
������������
from arclet.alconna.graia import Alc, Match
...
app = Ariadne(...)
@app.broadcast.receiver(
GroupMessage, dispatchers=[Alc.from_format("foo bar {baz:int}")]
)
async def test2(group: Group, baz: Match[int]):
print("sender:", group)
print("match", baz.available, baz.result)
������
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
arclet-alconna-graia-0.4.7.tar.gz
(16.9 kB
view hashes)
Built Distribution
Close
Hashes for arclet-alconna-graia-0.4.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7d5398d768a980750761c69c7baff2d018be58b16c344e353761e9b8e61d91f |
|
MD5 | 6759f2486edca3e455151fd6136cd946 |
|
BLAKE2b-256 | 7d4f1c01c4ea8cfce25c9ac147ba975b577e473b72ec4c6d8523e50ec61ea924 |
Close
Hashes for arclet_alconna_graia-0.4.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ef32e8d4732cd941560894c2d969639ad98473b22ecae222d74c024fc7e213c |
|
MD5 | 56a320250ddacd18e7a882680dca032d |
|
BLAKE2b-256 | 5e668582262e4901e58e7c41a2516526473a94f1d8ab0aabd85c5e0605fe9dee |