Fix files in private chats
This commit is contained in:
@@ -10,7 +10,7 @@ A Telegram chat will be created once the bridge is stable enough.
|
|||||||
### Setup
|
### Setup
|
||||||
0. Clone the repository
|
0. Clone the repository
|
||||||
1. Set up the virtual environment
|
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. Activate with `source .venv/bin/activate`
|
||||||
2. Install dependencies with `pip install -r requirements.txt`
|
2. Install dependencies with `pip install -r requirements.txt`
|
||||||
3. Create a copy of `example-config.yaml` and fill out the fields.
|
3. Create a copy of `example-config.yaml` and fill out the fields.
|
||||||
|
|||||||
@@ -244,12 +244,17 @@ class User:
|
|||||||
portal = po.Portal.get_by_tgid(update.chat_id, peer_type="chat")
|
portal = po.Portal.get_by_tgid(update.chat_id, peer_type="chat")
|
||||||
sender = pu.Puppet.get(update.from_id)
|
sender = pu.Puppet.get(update.from_id)
|
||||||
elif isinstance(update, UpdateShortMessage):
|
elif isinstance(update, UpdateShortMessage):
|
||||||
|
print(update)
|
||||||
portal = po.Portal.get_by_tgid(update.user_id, self.tgid, "user")
|
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)
|
sender = pu.Puppet.get(self.tgid if update.out else update.user_id)
|
||||||
elif isinstance(update, (UpdateNewMessage, UpdateNewChannelMessage)):
|
elif isinstance(update, (UpdateNewMessage, UpdateNewChannelMessage)):
|
||||||
update = update.message
|
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)
|
sender = pu.Puppet.get(update.from_id)
|
||||||
portal = po.Portal.get_by_entity(update.to_id, receiver_id=self.tgid)
|
|
||||||
return update, sender, portal
|
return update, sender, portal
|
||||||
|
|
||||||
def update_message(self, update):
|
def update_message(self, update):
|
||||||
|
|||||||
Reference in New Issue
Block a user