Comments (21)
@Metalingus Do you have any idea to workaround for this case ?
For now I implemented an ugly solution. I created 3 sessions that disconnect reconnect every 5 seconds. As mentioned earlier, this is related to DC4, I created a new account there and the same thing happened. I also tried telethon and it's happening too unless I keep interacting with the channel.
from gramjs.
I got the same issue
from gramjs.
I wonder if it's telegram restricting the account because I have another account that works just fine with the same code. However when I check with the spam bot, it tells me that there are no restrictions applied to my account.
from gramjs.
Try to change DC: client.session.setDC(dcId: number, serverAddress: string, port: number); https://docs.pyrogram.org/faq/what-are-the-ip-addresses-of-telegram-data-centers I have a problem with DC4
Whenever I use the setDC it either freezes my current session or when I use it for a new session I get "Phone Migrated to DC 4"
from gramjs.
@Metalingus
Do you have any idea to workaround for this case ?
from gramjs.
@Metalingus Do you have any idea to workaround for this case ?
For now I implemented an ugly solution. I created 3 sessions that disconnect reconnect every 5 seconds. As mentioned earlier, this is related to DC4, I created a new account there and the same thing happened. I also tried telethon and it's happening too unless I keep interacting with the channel.
It happened with me in 2022 and the solution was to update the gramjs library. This time it didn't fix it. I am also having the same issue.
from gramjs.
Hi guys, so this is an official telegram api issue? This issue is seriously hampering my development of telegram-forwarder, the listen function is very important to me, but so far the test result is that after 2 minutes I don't receive any new messages anymore!
from gramjs.
Hi guys, so this is an official telegram api issue? This issue is seriously hampering my development of telegram-forwarder, the listen function is very important to me, but so far the test result is that after 2 minutes I don't receive any new messages anymore!
I am also having the same issues with my telegram-forwarder. Did you find any solution yet?
from gramjs.
Same issue for me in DC4. Change DC doesn't help: I've created a new account in DC5 but it has the same issue.
from gramjs.
Hi guys, so this is an official telegram api issue? This issue is seriously hampering my development of telegram-forwarder, the listen function is very important to me, but so far the test result is that after 2 minutes I don't receive any new messages anymore!
I fixed it by calling getDialogs on an interval of 30 seconds. It has been more than 24 hours already and it seems to be working fine for me.
from gramjs.
@mominak47 Hi, Have you tested any methods other than getDialogs()? Like getMe() method or something like that. It seems that you have to call a specific method periodically during the listening process to maintain contact, am I correct in my understanding? Thank you for your reply.
from gramjs.
@mominak47 Which version of the package are you running?
from gramjs.
@awdr74100 Yeah, you have to call getMe() once after client.connect() . I was using the same way for more than an year and somehow it recently stopped working. I managed to run it again after calling getDialogs on every 30 seconds.
from gramjs.
@mominak47 Thank you for your immediate reply!
I'm still not sure if this is some kind of official limitation of the telegram api, where monitoring can be kept running 24 hours a day with infrequent channel updates, whereas with frequent channel updates, monitoring can only be kept running for 2 minutes, and then no more updates can be received, which means that the callback of the addEventHandler will never be invoked.
I've tried gramjs, tgsnake, mtkruto and all have the same problem.
I suspect the problem may be related to calls like UpdatesTooLong
getDifference
.
from gramjs.
I experience the same: NewMessage event is not triggered, BUT only for some "specific" groups. I don't know yet what makes those groups different. Appearantly even official app is working like that: I receive push notifications, but I can not see any chat updates on listing until I actually visit that channel/group (which makes me believe instead of NewMessage event triggered it's just getDifference
that makes recent messages visible there).
from gramjs.
сообщения из reciver иногда приходят, иногда не приходят.
использую node-red-node-telegrambot 0.1.6
https://flows.nodered.org/node/node-red-node-telegrambot
from gramjs.
I experience the same: NewMessage event is not triggered, BUT only for some "specific" groups. I don't know yet what makes those groups different. Appearantly even official app is working like that: I receive push notifications, but I can not see any chat updates on listing until I actually visit that channel/group (which makes me believe instead of NewMessage event triggered it's just
getDifference
that makes recent messages visible there).
What version are you using?
from gramjs.
What version are you using?
recent (2.20.10) even though when you start the app it shows Running GramJS version 2.20.9
in logs. I downgraded back to 2.17.10 and had the same.
from gramjs.
Versions:
"telegram": "^2.20.10"
Curious if this issue would occur in a telegram python package, though i wouldn't want to switch from nodejs...
This also occurs for me.
async function listenToNewMessage(event: NewMessageEvent) {
const message = event.message;
if (
message.isChannel &&
(Number(message.chatId) == channels_id.CHANNEL_I_WANT_TO_LISTEN_TO ||
Number(message.chatId) == channels_id.CHANNEL_I_WANT_TO_LISTEN_TO_2 ||
Number(message.chatId) == channels_id.MY_TESTING_CHANNEL)
) {
try {
const translated = await gpt_translate(message.message);
console.log("Translated message: ", translated);
message.message = translated;
await client.sendMessage(channel_name, {
message: message.message,
});
} catch (e) {
console.log(e);
}
}
}
// ...
client.addEventHandler(listenToNewMessage, new NewMessage({}));
My listener does work when the channel is channels_id.MY_TESTING_CHANNEL
, but for the two others it doesn't even get called, like something is blocking the eventHandler when it's some specific channels, even though the config seems to be the same on the three channels (it is a public channel; I have joined the three channels).
Something i did pay attention is that on my local environment the eventHandler does work for the three channels, but when it's on my deployed EC2 server it never does.
NOTE:
I just saw that my local node version is v19.0.0 whereas my EC2 has 21.7.0 installed.
Checking now if downgrading to 19 will make a change, will update here :)
from gramjs.
After downgrading to 19.0.0, it still doesn't work on production, and work time to times in local, but most of the time it doesn't work
Versions:
"telegram": "^2.20.10"
Curious if this issue would occur in a telegram python package, though i wouldn't want to switch from nodejs... This also occurs for me.
async function listenToNewMessage(event: NewMessageEvent) { const message = event.message; if ( message.isChannel && (Number(message.chatId) == channels_id.CHANNEL_I_WANT_TO_LISTEN_TO || Number(message.chatId) == channels_id.CHANNEL_I_WANT_TO_LISTEN_TO_2 || Number(message.chatId) == channels_id.MY_TESTING_CHANNEL) ) { try { const translated = await gpt_translate(message.message); console.log("Translated message: ", translated); message.message = translated; await client.sendMessage(channel_name, { message: message.message, }); } catch (e) { console.log(e); } } } // ... client.addEventHandler(listenToNewMessage, new NewMessage({}));My listener does work when the channel is
channels_id.MY_TESTING_CHANNEL
, but for the two others it doesn't even get called, like something is blocking the eventHandler when it's some specific channels, even though the config seems to be the same on the three channels (it is a public channel; I have joined the three channels).Something i did pay attention is that on my local environment the eventHandler does work for the three channels, but when it's on my deployed EC2 server it never does.
NOTE: I just saw that my local node version is v19.0.0 whereas my EC2 has 21.7.0 installed. Checking now if downgrading to 19 will make a change, will update here :)
from gramjs.
I have the same problem. Has anyone found a solution?
from gramjs.
Related Issues (20)
- TIME_INVALID and other time_ms related errors returned for InputGroupCallStream HOT 1
- How to reduce inbound or outbound data transfer
- RPCError: 400: FILTER_ID_INVALID (caused by messages.UpdateDialogFilter) HOT 1
- [Disconnecting...] multiple times??
- How to get the information of the telegram group using name? HOT 1
- How to create a public group using this? HOT 1
- How to kick a user from a group. HOT 1
- NewMessage event not working for majority of channels all of a sudden HOT 7
- How to open webview app HOT 1
- Can't connect via ipv6 proxy
- NewMessage event not working for some channels. HOT 2
- RequestWebView missing parameters HOT 1
- Wrong returned type for createForumTopic
- Argument of Api.account.UpdateNotifySettings is wrongly typed
- Telegram Client Hangs Up on Connect HOT 1
- Empty properties in event user
- AsyncQueue reconnect
- Stops getting updates of new Messages
- Add ESM entry points
- Standardize event handling methods
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.
from gramjs.