コミットを比較

...

2 コミット

作成者 SHA1 メッセージ 日付
n9k eb8d3d55a2 Control socket: rename method 'exit' -> 'quit' 2022-07-31 23:11:32 +00:00
n9k cd2ba369ae Control socket: reload emotes 2022-07-31 23:11:32 +00:00
4個のファイルの変更41行の追加2行の削除

ファイルの表示

@ -5,18 +5,20 @@ from anonstream.control.spec import ParseException, Parsed
from anonstream.control.spec.common import Str
from anonstream.control.spec.methods.allowedness import SPEC as SPEC_ALLOWEDNESS
from anonstream.control.spec.methods.chat import SPEC as SPEC_CHAT
from anonstream.control.spec.methods.exit import SPEC as SPEC_EXIT
from anonstream.control.spec.methods.emote import SPEC as SPEC_EMOTE
from anonstream.control.spec.methods.help import SPEC as SPEC_HELP
from anonstream.control.spec.methods.quit import SPEC as SPEC_QUIT
from anonstream.control.spec.methods.title import SPEC as SPEC_TITLE
from anonstream.control.spec.methods.user import SPEC as SPEC_USER
SPEC = Str({
'help': SPEC_HELP,
'exit': SPEC_EXIT,
'quit': SPEC_QUIT,
'title': SPEC_TITLE,
'chat': SPEC_CHAT,
'user': SPEC_USER,
'allowednesss': SPEC_ALLOWEDNESS,
'emote': SPEC_EMOTE,
})
async def parse(request):

36
anonstream/control/spec/methods/emote.py ノーマルファイル
ファイルの表示

@ -0,0 +1,36 @@
# SPDX-FileCopyrightText: 2022 n9k <https://git.076.ne.jp/ninya9k>
# SPDX-License-Identifier: AGPL-3.0-or-later
from quart import current_app
from anonstream.emote import load_emote_schema, BadEmoteName
from anonstream.control.spec.common import Str, End
from anonstream.control.exceptions import CommandFailed
CONFIG = current_app.config
async def cmd_emote_help():
normal = ['emote', 'help']
response = (
'Usage: emote\n'
'Commands:\n'
' emote reload......try to reload the emote schema (existing messages are not modified)\n'
)
return normal, response
async def cmd_emote_reload():
try:
emotes = load_emote_schema(app.config['EMOTE_SCHEMA'])
except BadEmoteName as e:
error, *_ = e.args
raise CommandFailed(error) from e
normal = ['emote', 'reload']
response = ''
return normal, response
SPEC = Str({
None: End(cmd_emote_help),
'help': End(cmd_emote_help),
'reload': End(cmd_emote_reload),
})

ファイルの表示

@ -24,6 +24,7 @@ async def cmd_help():
' allowedness setdefault BOOLEAN.set the default allowedness\n'
' allowedness add SET STRING.....add to the blacklist/whitelist\n'
' allowedness remove SET STRING..remove from the blacklist/whitelist\n'
' emote reload...................try reloading the emote schema\n'
)
return normal, response