mirror of
https://github.com/the-draupnir-project/Draupnir.git
synced 2026-04-28 03:45:29 +00:00
Bump bot-sdk version to handle published aliases better
This commit is contained in:
+1
-1
@@ -27,6 +27,6 @@
|
||||
"config": "^3.3.1",
|
||||
"escape-html": "^1.0.3",
|
||||
"js-yaml": "^3.13.1",
|
||||
"matrix-bot-sdk": "^0.5.3"
|
||||
"matrix-bot-sdk": "^0.5.4"
|
||||
}
|
||||
}
|
||||
|
||||
+1
-16
@@ -187,7 +187,7 @@ export async function replaceRoomIdsWithPills(client: MatrixClient, text: string
|
||||
for (const roomId of roomIds) {
|
||||
let alias = roomId;
|
||||
try {
|
||||
alias = (await getRoomAlias(client, roomId)) || roomId;
|
||||
alias = (await client.getPublishedAlias(roomId)) || roomId;
|
||||
} catch (e) {
|
||||
// This is a recursive call, so tell the function not to try and call us
|
||||
await logMessage(LogLevel.WARN, "utils", `Failed to resolve room alias for ${roomId} - see console for details`, null, true);
|
||||
@@ -200,18 +200,3 @@ export async function replaceRoomIdsWithPills(client: MatrixClient, text: string
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
// TODO: Merge this function into js-bot-sdk
|
||||
export async function getRoomAlias(client: MatrixClient, roomId: string): Promise<string> {
|
||||
try {
|
||||
const event = await client.getRoomStateEvent(roomId, "m.room.canonical_alias", "");
|
||||
if (!event) return null;
|
||||
|
||||
const canonical = event['alias'];
|
||||
const alt = event['alt_aliases'] || [];
|
||||
|
||||
return canonical || alt[0];
|
||||
} catch (e) {
|
||||
return null; // assume none
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1704,10 +1704,10 @@ map-visit@^1.0.0:
|
||||
dependencies:
|
||||
object-visit "^1.0.0"
|
||||
|
||||
matrix-bot-sdk@^0.5.3:
|
||||
version "0.5.3"
|
||||
resolved "https://registry.yarnpkg.com/matrix-bot-sdk/-/matrix-bot-sdk-0.5.3.tgz#ec01a76a9ec9d120cee4461dda3b0db01e8a32de"
|
||||
integrity sha512-jmoU55HbJpvTopZrjMca5u7jmfW3j/Fc3vPExs+5RRqFNCChT/TYQxr7PXD9Ho96YbL7zJ3zynOZ3fXvHg4hYA==
|
||||
matrix-bot-sdk@^0.5.4:
|
||||
version "0.5.4"
|
||||
resolved "https://registry.yarnpkg.com/matrix-bot-sdk/-/matrix-bot-sdk-0.5.4.tgz#8c26bef826bd0b3fc9b693c8d07b52c30d843fd7"
|
||||
integrity sha512-nUAE1WW7ast+Xsfux1+qBPmKSY6OG0RoZfeh0WfMP42JW6GRnNiY3hq7aiifomnJAMASZ6EwkdHS3ChWpIRYzg==
|
||||
dependencies:
|
||||
"@types/express" "^4.17.2"
|
||||
chalk "^3.0.0"
|
||||
|
||||
Reference in New Issue
Block a user