add roomid command and fix workflow file
This commit is contained in:
@@ -26,4 +26,4 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
*.mbp
|
*.mbp
|
||||||
LICENSE
|
LICENSE*
|
||||||
|
|||||||
@@ -53,6 +53,13 @@ will attempt to sanitize the room name and assign a room alias automatically. th
|
|||||||
power level (1000) and set an admin power level (100) to plugin administrators. this ensures that the bot is still able
|
power level (1000) and set an admin power level (100) to plugin administrators. this ensures that the bot is still able
|
||||||
to manage room admins. the bot will also invite other users to these new rooms as configured.
|
to manage room admins. the bot will also invite other users to these new rooms as configured.
|
||||||
|
|
||||||
|
## get room ID
|
||||||
|
|
||||||
|
sometimes you need to know a rooms identifier, but if the room has an alias associated with it not all clients make it
|
||||||
|
easy (or possible) to find. this subcommand (`!community roomid`) can be used to return the room id that a room alias
|
||||||
|
points to. with no argument passed, it will return the current room's ID, or you can pass it an alias (e.g. `!community
|
||||||
|
roomid #whatisthisroom:myserver.tld`).
|
||||||
|
|
||||||
# installation
|
# installation
|
||||||
|
|
||||||
install this like any other maubot plugin: zip the contents of this repo into a file and upload via the web interface,
|
install this like any other maubot plugin: zip the contents of this repo into a file and upload via the web interface,
|
||||||
|
|||||||
@@ -488,6 +488,27 @@ class CommunityBot(Plugin):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
await evt.respond(f"something went wrong: {e}")
|
await evt.respond(f"something went wrong: {e}")
|
||||||
|
|
||||||
|
@community.subcommand("roomid", help="return the matrix room ID of this, or a given, room")
|
||||||
|
@command.argument("room", required=False)
|
||||||
|
async def get_roomid(self, evt: MessageEvent, room: str) -> None:
|
||||||
|
room_id = None
|
||||||
|
if room:
|
||||||
|
if room.startswith('#'):
|
||||||
|
try:
|
||||||
|
thatroom_id = await self.client.resolve_room_alias(room)
|
||||||
|
room_id = thatroom_id["room_id"]
|
||||||
|
except:
|
||||||
|
evt.reply("i don't recognize that room, sorry")
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
room_id = room
|
||||||
|
else:
|
||||||
|
room_id = evt.room_id
|
||||||
|
try:
|
||||||
|
await evt.reply(f"Room ID is: {room_id}")
|
||||||
|
except Exception as e:
|
||||||
|
await evt.respond(f"something went wrong: {e}")
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_db_upgrade_table(cls) -> None:
|
def get_db_upgrade_table(cls) -> None:
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
maubot: 0.1.0
|
maubot: 0.1.0
|
||||||
id: org.jobmachine.communitybot
|
id: org.jobmachine.communitybot
|
||||||
version: 0.1.0
|
version: 0.1.1
|
||||||
license: MIT
|
license: MIT
|
||||||
modules:
|
modules:
|
||||||
- community
|
- community
|
||||||
|
|||||||
Reference in New Issue
Block a user