本文整理匯總了TypeScript中matrix-appservice-bridge.RoomBridgeStore.getEntriesByMatrixId方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript RoomBridgeStore.getEntriesByMatrixId方法的具體用法?TypeScript RoomBridgeStore.getEntriesByMatrixId怎麽用?TypeScript RoomBridgeStore.getEntriesByMatrixId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類matrix-appservice-bridge.RoomBridgeStore
的用法示例。
在下文中一共展示了RoomBridgeStore.getEntriesByMatrixId方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: ApplyStateToChannel
private async ApplyStateToChannel(channelsState: IChannelState) {
const intent = this.bridge.getIntent();
for (const channelState of channelsState.mxChannels) {
let roomUpdated = false;
const remoteRoom = (await this.roomStore.getEntriesByMatrixId(channelState.mxid))[0];
if (channelState.name !== null) {
log.verbose(`Updating channelname for ${channelState.mxid} to "${channelState.name}"`);
await intent.setRoomName(channelState.mxid, channelState.name);
remoteRoom.remote.set("discord_name", channelState.name);
roomUpdated = true;
}
if (channelState.topic !== null) {
log.verbose(`Updating channeltopic for ${channelState.mxid} to "${channelState.topic}"`);
await intent.setRoomTopic(channelState.mxid, channelState.topic);
remoteRoom.remote.set("discord_topic", channelState.topic);
roomUpdated = true;
}
if (channelState.iconUrl !== null && channelState.iconId !== null) {
log.verbose(`Updating icon_url for ${channelState.mxid} to "${channelState.iconUrl}"`);
if (channelsState.iconMxcUrl === null) {
const iconMxc = await Util.UploadContentFromUrl(
channelState.iconUrl,
intent,
channelState.iconId,
);
channelsState.iconMxcUrl = iconMxc.mxcUrl;
}
await intent.setRoomAvatar(channelState.mxid, channelsState.iconMxcUrl);
remoteRoom.remote.set("discord_iconurl", channelState.iconUrl);
remoteRoom.remote.set("discord_iconurl_mxc", channelsState.iconMxcUrl);
roomUpdated = true;
}
if (channelState.removeIcon) {
log.verbose(`Clearing icon_url for ${channelState.mxid}`);
await intent.setRoomAvatar(channelState.mxid, null);
remoteRoom.remote.set("discord_iconurl", null);
remoteRoom.remote.set("discord_iconurl_mxc", null);
roomUpdated = true;
}
if (roomUpdated) {
await this.roomStore.upsertEntry(remoteRoom);
}
}
}