Fix files in private chats

This commit is contained in:
Tulir Asokan
2018-01-29 18:22:03 +02:00
parent ba0786ccc9
commit 02e3a07b0a
2 changed files with 7 additions and 2 deletions

View File

@@ -10,7 +10,7 @@ A Telegram chat will be created once the bridge is stable enough.
### Setup
0. Clone the repository
1. Set up the virtual environment
1. Create with `virtualenv -p /usr/bin/python3 .venv`
1. Create with `virtualenv -p /usr/bin/python3.6 .venv`
2. Activate with `source .venv/bin/activate`
2. Install dependencies with `pip install -r requirements.txt`
3. Create a copy of `example-config.yaml` and fill out the fields.

View File

@@ -244,12 +244,17 @@ class User:
portal = po.Portal.get_by_tgid(update.chat_id, peer_type="chat")
sender = pu.Puppet.get(update.from_id)
elif isinstance(update, UpdateShortMessage):
print(update)
portal = po.Portal.get_by_tgid(update.user_id, self.tgid, "user")
sender = pu.Puppet.get(self.tgid if update.out else update.user_id)
elif isinstance(update, (UpdateNewMessage, UpdateNewChannelMessage)):
update = update.message
if isinstance(update.to_id, PeerUser) and not update.out:
portal = po.Portal.get_by_tgid(update.from_id, peer_type="user",
tg_receiver=self.tgid)
else:
portal = po.Portal.get_by_entity(update.to_id, receiver_id=self.tgid)
sender = pu.Puppet.get(update.from_id)
portal = po.Portal.get_by_entity(update.to_id, receiver_id=self.tgid)
return update, sender, portal
def update_message(self, update):