Skip to content
Snippets Groups Projects
Commit 0ad47ea6 authored by Tulir Asokan's avatar Tulir Asokan :cat2:
Browse files

Add reconnect as alias to connect command

parent 18f4139e
No related branches found
No related tags found
No related merge requests found
...@@ -38,7 +38,7 @@ async def disconnect(evt: CommandEvent) -> None: ...@@ -38,7 +38,7 @@ async def disconnect(evt: CommandEvent) -> None:
@command_handler(needs_auth=True, management_only=True, help_section=SECTION_CONNECTION, @command_handler(needs_auth=True, management_only=True, help_section=SECTION_CONNECTION,
help_text="Connect to Facebook Messenger") help_text="Connect to Facebook Messenger", aliases=["reconnect"])
async def connect(evt: CommandEvent) -> None: async def connect(evt: CommandEvent) -> None:
if evt.sender.listen_task and not evt.sender.listen_task.done(): if evt.sender.listen_task and not evt.sender.listen_task.done():
await evt.reply("You already have a Messenger MQTT connection") await evt.reply("You already have a Messenger MQTT connection")
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# #
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
from typing import Awaitable, Callable, Dict, Optional, NamedTuple from typing import Awaitable, Callable, Dict, Optional, NamedTuple, List
from mautrix.bridge.commands import (HelpSection, CommandEvent as BaseCommandEvent, from mautrix.bridge.commands import (HelpSection, CommandEvent as BaseCommandEvent,
command_handler as base_command_handler, command_handler as base_command_handler,
...@@ -67,12 +67,13 @@ class CommandHandler(BaseCommandHandler): ...@@ -67,12 +67,13 @@ class CommandHandler(BaseCommandHandler):
def command_handler(_func: Optional[Callable[[CommandEvent], Awaitable[Dict]]] = None, *, def command_handler(_func: Optional[Callable[[CommandEvent], Awaitable[Dict]]] = None, *,
needs_auth: bool = True, needs_admin: bool = False, needs_auth: bool = True, needs_admin: bool = False,
management_only: bool = False, name: Optional[str] = None, management_only: bool = False, name: Optional[str] = None,
help_text: str = "", help_args: str = "", help_section: HelpSection = None help_text: str = "", help_args: str = "", help_section: HelpSection = None,
aliases: Optional[List[str]] = None
) -> Callable[[Callable[[CommandEvent], Awaitable[Optional[Dict]]]], ) -> Callable[[Callable[[CommandEvent], Awaitable[Optional[Dict]]]],
CommandHandler]: CommandHandler]:
return base_command_handler(_func, management_only=management_only, name=name, return base_command_handler(_func, management_only=management_only, name=name, aliases=aliases,
help_text=help_text, help_args=help_args, help_section=help_section, help_text=help_text, help_args=help_args, needs_admin=needs_admin,
needs_auth=needs_auth, needs_admin=needs_admin, help_section=help_section, needs_auth=needs_auth,
_handler_class=CommandHandler) _handler_class=CommandHandler)
......
...@@ -4,5 +4,5 @@ alembic>=1,<2 ...@@ -4,5 +4,5 @@ alembic>=1,<2
ruamel.yaml>=0.15.94,<0.17 ruamel.yaml>=0.15.94,<0.17
commonmark>=0.8,<0.10 commonmark>=0.8,<0.10
python-magic>=0.4,<0.5 python-magic>=0.4,<0.5
mautrix>=0.5.5,<0.6 mautrix>=0.5.6,<0.6
fbchat-asyncio>=0.6.1,<0.7 fbchat-asyncio>=0.6.1,<0.7
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment