feat: Data and client framework

This commit is contained in:
2026-05-31 05:05:01 +10:00
parent 19da69b3e8
commit b188abcad0
18 changed files with 643 additions and 313 deletions
+30
View File
@@ -0,0 +1,30 @@
import random
from typing import Optional
stuff = {}
def register_var(name: str | None = None):
def wrapper(coro):
varname = name or coro.__name__
stuff[varname] = coro
return coro
return wrapper
@register_var('random')
async def random_func(ctx, a: int, b: Optional[int] = None):
if b is not None:
low, high = a, b
else:
low, high = 0, a
return random.randint(low, high)
@register_var('user')
async def user_func(ctx, userstr: int | str):
"""
Attempt to turn the given userstr into a user.
Currently just looks up the user directly.
Some fuzzy matching may be appropriate in the future.
"""
...