Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
Telegram Bot Talk
E V I L
Server replied with a wrong session ID
Any solution for this error ?
english
communication
bottalk
03:32 20.12.2021
2
ответов
শ্রীমাধব
姓氏(可選)
https://t.me/TelethonChat/166038
03:38 20.12.2021
E V I L
Автор вопроса
শ্রীমাধব 姓氏(可選)
https://t.me/TelethonChat/166038
Ops thank you !
03:39 20.12.2021
Похожие вопросы
Telegram Bot Talk
2 / 19
so if we talk here about our problems, anything will change or..?
communication
bottalk
english
2
сегодня в 00:49
Telegram Bot Talk
Euler
Is there a way to create a test account to interact with a bot? I only have one phone number.
communication
bottalk
english
1
01:28 07.02.2023
Telegram Bot Talk
𝖍𝖆𝖉𝖎
and one more question
what is request_id in KeyboardButtonRequestUser ?
i dont understand it
communication
bottalk
english
1
00:49 06.02.2023
Telegram Bot Talk
Devo
Swipes
yo can anyone of yall make telegram bots?
communication
bottalk
english
1
01:26 05.02.2023
Telegram Bot Talk
Devo
Swipes
what if i pay?
communication
bottalk
english
1
01:35 05.02.2023
Telegram Bot Talk
Zero
umm hey guys, so im making my own bot, some stupid stuff, im using python, soo i want to take input from users through inlinekeyboardbutton, and store into a python variable a…
communication
bottalk
english
1
22:53 05.02.2023
Telegram Bot Talk
Zero
and here at «bio» it stores the input from user?
communication
bottalk
english
1
23:32 05.02.2023
Telegram Bot Talk
Лифма
Hello, what other options are there? (like start=)
communication
bottalk
english
2
19:05 04.02.2023
Telegram Bot Talk
Gabriel
I’m trying to make an ad system, every X seconds the bot sends a phrase, does anyone have any tips on what I can use? I spent all day trying in different ways, but the bot doe…
communication
bottalk
english
4
02:45 03.02.2023
Telegram Bot Talk
Finik
My bot sends me the ID of my chat using message.chat.id which starts with «-100», and so on with everyone.
The fact is that I would like my bot to send me an identifier witho…
communication
bottalk
english
2
18:25 02.02.2023
Смотреть еще
If you send a message from WS to the chat, and then send a message from the chat, then Event is not deleted, if you send another message, it will be processed
Checklist
- [ ] The error is in the library’s code, and not in my own.
- [х] I have searched for this issue before posting it and there isn’t a duplicate.
- [ ] I ran
pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip
and triggered the bug in the latest version.
Code that causes the issue
from telethon import TelegramClient, events
from telethon.events import StopPropagation
import sys
import asyncio
import websockets
class TG(TelegramClient):
chat = 0
def __init__(self, session_user_id, api_id, api_hash):
super().__init__(
session_user_id, api_id, api_hash,
)
print('Connecting to Telegram servers...')
print(self)
async def get_dialog_id(self):
username = await self.get_entity('AoAnima')
self.chat = username.id
async def run(self):
await self.start()
print('connected Telegram servers...')
print(await self.is_user_authorized())
await self.get_dialog_id()
async def send_messages(self, message, ws):
await self.send_message(self.chat, message)
@self.on(events.NewMessage(chats=self.chat))
async def handler(event):
print("message", event)
# await ws.send(event.message.stringify())
delstat = await event.delete() # NOT WORK
print("self", self)
print("delstat", delstat[0])
print("event", event.delete)
raise StopPropagation
class WS():
tgclient = ''
def __init__(self, tg):
# super.__init__(self)
self.tgclient = tg
async def run(self):
async with websockets.serve(self.incomming_message_handler, "localhost", 8765):
await asyncio.Future()
async def incomming_message_handler(self, websocket):
print(websocket)
async for message in websocket:
# отправим сообщение в телеграм
await self.tgclient.send_messages(message, websocket)
# await websocket.send(message)
async def main():
api_id = 2222222
api_hash = 'xxxxxxxx'
client = TG('session_name', api_id, api_hash)
ws = WS(client)
a = await asyncio.gather(
client.run(),
ws.run(),
)
await asyncio.Future()
if __name__ == "__main__":
asyncio.run(main())
Traceback
Connecting to Telegram servers...
<__main__.TG object at 0x00000184192D3A90>
Соединение установленно to Telegram servers...
True
<websockets.legacy.server.WebSocketServerProtocol object at 0x00000184193A3650>
message NewMessage.Event(original_update=UpdateNewMessage(message=Message(id=83875, peer_id=PeerUser(user_id=495654811), date=datetime.datetime(2022, 12, 7, 13, 34, 59, tzinfo=datetime.timezone.utc), message='asd', out=True, mentioned=False, media_unread=False, silent=False, post=False, from_scheduled=False, legacy=False, edit_hide=False, pinned=False, noforwards=False, from_id=None, fwd_from=None, via_bot_id=None, reply_to=None, media=None, reply_markup=None, entities=[], views=None, forwards=None, replies=None, edit_date=None, post_author=None, grouped_id=None, reactions=None, restriction_reason=[], ttl_period=None), pts=199485, pts_count=1), pattern_match=None, message=Message(id=83875, peer_id=PeerUser(user_id=495654811), date=datetime.datetime(2022, 12, 7, 13, 34, 59, tzinfo=datetime.timezone.utc), message='asd', out=True, mentioned=False, media_unread=False, silent=False, post=False, from_scheduled=False, legacy=False, edit_hide=False, pinned=False, noforwards=False, from_id=None, fwd_from=None, via_bot_id=None, reply_to=None, media=None, reply_markup=None, entities=[], views=None, forwards=None, replies=None, edit_date=None, post_author=None, grouped_id=None, reactions=None, restriction_reason=[], ttl_period=None))
self <__main__.TG object at 0x00000184192D3A90>
delstat AffectedMessages(pts=199487, pts_count=1)
event <bound method Message.delete of <telethon.tl.patched.Message object at 0x0000018419401F10>>
message NewMessage.Event(original_update=UpdateNewMessage(message=Message(id=83876, peer_id=PeerUser(user_id=495654811), date=datetime.datetime(2022, 12, 7, 13, 35, 1, tzinfo=datetime.timezone.utc), message='asd', out=True, mentioned=False, media_unread=False, silent=False, post=False, from_scheduled=False, legacy=False, edit_hide=False, pinned=False, noforwards=False, from_id=None, fwd_from=None, via_bot_id=None, reply_to=None, media=None, reply_markup=None, entities=[], views=None, forwards=None, replies=None, edit_date=None, post_author=None, grouped_id=None, reactions=None, restriction_reason=[], ttl_period=None), pts=0, pts_count=0), pattern_match=None, message=Message(id=83876, peer_id=PeerUser(user_id=495654811), date=datetime.datetime(2022, 12, 7, 13, 35, 1, tzinfo=datetime.timezone.utc), message='asd', out=True, mentioned=False, media_unread=False, silent=False, post=False, from_scheduled=False, legacy=False, edit_hide=False, pinned=False, noforwards=False, from_id=None, fwd_from=None, via_bot_id=None, reply_to=None, media=None, reply_markup=None, entities=[], views=None, forwards=None, replies=None, edit_date=None, post_author=None, grouped_id=None, reactions=None, restriction_reason=[], ttl_period=None))
self <__main__.TG object at 0x00000184192D3A90>
delstat AffectedMessages(pts=199490, pts_count=1)
event <bound method Message.delete of <telethon.tl.patched.Message object at 0x0000018419400110>>
message NewMessage.Event(original_update=UpdateNewMessage(message=Message(id=83877, peer_id=PeerUser(user_id=495654811), date=datetime.datetime(2022, 12, 7, 13, 35, 3, tzinfo=datetime.timezone.utc), message='asd', out=True, mentioned=False, media_unread=False, silent=False, post=False, from_scheduled=False, legacy=False, edit_hide=False, pinned=False, noforwards=False, from_id=None, fwd_from=None, via_bot_id=None, reply_to=None, media=None, reply_markup=None, entities=[], views=None, forwards=None, replies=None, edit_date=None, post_author=None, grouped_id=None, reactions=None, restriction_reason=[], ttl_period=None), pts=0, pts_count=0), pattern_match=None, message=Message(id=83877, peer_id=PeerUser(user_id=495654811), date=datetime.datetime(2022, 12, 7, 13, 35, 3, tzinfo=datetime.timezone.utc), message='asd', out=True, mentioned=False, media_unread=False, silent=False, post=False, from_scheduled=False, legacy=False, edit_hide=False, pinned=False, noforwards=False, from_id=None, fwd_from=None, via_bot_id=None, reply_to=None, media=None, reply_markup=None, entities=[], views=None, forwards=None, replies=None, edit_date=None, post_author=None, grouped_id=None, reactions=None, restriction_reason=[], ttl_period=None))
self <__main__.TG object at 0x00000184192D3A90>
delstat AffectedMessages(pts=199493, pts_count=1)
event <bound method Message.delete of <telethon.tl.patched.Message object at 0x0000018419402CD0>>
Я работаю в телемарафоне по сбору данных из телеграммы. В большинстве случаев сервер занимает слишком много времени, продолжает выдавать ошибки и иногда возвращает данные с одним и тем же кодом. Я не знаю, в чем проблема. Мой код выглядит так, это код, в котором начинается проблема, или что это?
from telethon.sync import TelegramClient
import datetime
import pandas as pd
import pymongo
api_id = xxxxxxx
api_hash = 'mycorrect_api_hash'
chats = ['group-of-telegram-here']
clientd = pymongo.MongoClient("mongodb://localhost:27017")
db = clientd['xxxx']
collection = db['mycollection']
my_list = []
for chat in chats:
with TelegramClient('mysession', api_id, api_hash) as client:
for message in client.iter_messages(chat, offset_date=datetime.date(2023, 1, 11), reverse=True):
print(message)
my_list.append({"group": chat, "sender": message.sender_id, "text": message.text, "date": message.date})
collection.insert_many(my_list)
И ниже приведены ошибки, с которыми я обычно сталкиваюсь.
Request was unsuccessful 6 time(s)
А также
Security error while unpacking a received message: Server replied with a wrong session ID
1 ответ
Запрос был неудачным 6 раз(а)
Это означает, что библиотека повторила попытку сделать запрос (по умолчанию еще 5 раз, всего 6 раз) и каждый раз терпела неудачу. Это часто указывает на то, что на серверах Telegram возникли внутренние проблемы, и вам следует повторить попытку позже.
Ошибка безопасности при распаковке полученного сообщения: сервер ответил с неправильным идентификатором сеанса
Вероятно, это означает, что вы повторно используете сеанс. В этом случае может случиться так, что оба используются одновременно, и сервер заметит это. Эта проверка является функцией безопасности и не может быть отключена.
Обратите внимание, что злоупотребление Telegram может привести к удалению учетной записи или даже канала, поэтому обязательно играйте по правилам, чтобы избежать подобных проблем.
0
Lonami
18 Янв 2023 в 20:24