conn.py 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # mautrix-signal - A Matrix-Signal puppeting bridge
  2. # Copyright (C) 2020 Tulir Asokan
  3. #
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU Affero General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU Affero General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU Affero General Public License
  15. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. from mautrix.bridge.commands import HelpSection, command_handler
  17. from .typehint import CommandEvent
  18. SECTION_CONNECTION = HelpSection("Connection management", 15, "")
  19. @command_handler(needs_auth=False, management_only=True, help_section=SECTION_CONNECTION,
  20. help_text="Mark this room as your bridge notice room")
  21. async def set_notice_room(evt: CommandEvent) -> None:
  22. evt.sender.notice_room = evt.room_id
  23. await evt.sender.update()
  24. await evt.reply("This room has been marked as your bridge notice room")
  25. # @command_handler(needs_auth=False, management_only=True, help_section=SECTION_CONNECTION,
  26. # help_text="Check if you're logged into Twitter")
  27. # async def ping(evt: CommandEvent) -> None:
  28. # if evt.sender.username:
  29. # await evt.reply("")
  30. # user_info = await evt.sender.get_info()
  31. # await evt.reply(f"You're logged in as {user_info.name} "
  32. # f"([@{evt.sender.username}](https://twitter.com/{evt.sender.username}), "
  33. # f"user ID: {evt.sender.twid})")
  34. # TODO request syncs or something
  35. # @command_handler(needs_auth=True, management_only=False, help_section=SECTION_CONNECTION,
  36. # help_text="Synchronize portals")
  37. # async def sync(evt: CommandEvent) -> None:
  38. # await evt.sender.sync()
  39. # await evt.reply("Synchronization complete")