enable room creation

This commit is contained in:
HF 2022-01-14 01:57:47 +01:00
parent 884828e61f
commit c54dd6ce0b

View File

@ -186,11 +186,11 @@ class PPfunMatrixBridge {
room_id = await intent.resolveRoom(alias); room_id = await intent.resolveRoom(alias);
} catch { } catch {
console.log(`Matrix room ${alias} does not exist. Try to create it`); console.log(`Matrix room ${alias} does not exist. Try to create it`);
if (ppfun_name === 'es') { /*
/* * see https://spec.matrix.org/v1.1/client-server-api/
* see https://spec.matrix.org/v1.1/client-server-api/ * look for requestBody of createRoom
* look for requestBody of createRoom */
*/ try {
room_id = await intent.createRoom({ room_id = await intent.createRoom({
options: { options: {
name: `[${ppfun_name}] pixelplanet.fun`, name: `[${ppfun_name}] pixelplanet.fun`,
@ -202,6 +202,8 @@ class PPfunMatrixBridge {
}); });
room_id = room_id.room_id; room_id = room_id.room_id;
await intent.setRoomAvatar(room_id, 'mxc://pixelplanet.fun/cXJRbbaaqkzpOydGVxASpizK'); await intent.setRoomAvatar(room_id, 'mxc://pixelplanet.fun/cXJRbbaaqkzpOydGVxASpizK');
} catch (e) {
console.log(`Could not create new room for ${alias}: ${e}`);
} }
} }
if (room_id) { if (room_id) {