37 行
999 B
Python
37 行
999 B
Python
# 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),
|
|
})
|
|
|