Comments (8)
The CHANNEL_INVALID
error is not an Airgram error. It is coming from Telegram. If you are sure you have access to that channels, you should create an issue in tdlib repository.
You need to handle errors to avoid UnhandledPromiseRejectionWarning
or crashing server:
try {
const dialogs = await airgram.client.messages.getHistory({
// ...
})
} catch (error) {
// Something is wrong
console.error(error.message)
}
Also you can catch all unhandled exceptions to prevent of crashing server:
airgram.catch((error: Error) => {
if (error.name === 'TDLibError') {
console.error('TDLib error:', error)
} else {
console.log('Other error:', error)
}
})
from airgram.
check if you are using tdlib 1.4.0
from airgram.
This did not help, perhaps because I used the old version of airgram. I tried to run ts-example with the new version and try to get the chat history, but I get errors. Tell me how to get the history of the chat, which is not a member? There is only id in the parameters, access_hash is missing
What I am doing wrong?
airgram.api.getChatHistory({chatId: 1330724252, limit:10}).then((messages) => {
console.log(`[Mess] `, JSON.stringify(messages))
})
from airgram.
Hi, I have the same problem, trying to fetch the history via:
airgram.api.getChatHistory({
chatId: channel_id,
limit: 10,
offset: 0,
}).then((response) => {
assertResponse(response)
console.log(response)
}).catch(console.error)
And I get Error: RequestError
from airgram.
@valoricDe, what is your TDLib version? Can you provide log output please?
from airgram.
I use now 1.5.1 and logLevel 3 and the channel chat id -1001414757191
and the the following
...
[ 3][t 4][1575119222.229680300][Td.cpp:3548][#1][!Td][&td_requests] Receive request 4: getChatHistory {
chat_id = -1001414757191
from_message_id = 0
offset = 0
limit = 10
only_local = false
}
[ 3][t 0][1575119222.229859114][Client.cpp:270][&td_requests] Begin to wait for updates with timeout 10.000000
[ 3][t 0][1575119222.229868174][Client.cpp:276][&td_requests] End to wait for updates, returning object 0 0x102315530
...
[ 3][t 4][1575119222.230470896][Td.cpp:3548][#1][!Td][&td_requests] Receive request 5: getAuthorizationState {
}
[ 3][t 0][1575119222.230587006][Client.cpp:270][&td_requests] Begin to wait for updates with timeout 10.000000
[ 3][t 0][1575119222.230597258][Client.cpp:276][&td_requests] End to wait for updates, returning object 0 0x1026131a0
...
[ 3][t 4][1575119222.231589317][RequestActor.h:107][#1][!GetChatHistoryRequest]Receive error for query: [Error : 6 : Chat not found]
[ 3][t 4][1575119222.231620312][Td.cpp:4672][#1][!Td][&td_requests] Sending result for request 5: authorizationStateReady {
}
[ 3][t 4][1575119222.231651068][Td.cpp:3548][#1][!Td][&td_requests] Receive request 6: getAuthorizationState {
}
[ 3][t 0][1575119222.231690168][Client.cpp:276][&td_requests] End to wait for updates, returning object 5 0x102433090
[ 3][t 4][1575119222.231688976][Td.cpp:4687][#1][!Td][&td_requests] Sending error for request 4: error { code = 6 message = "Chat not found" }
[ 3][t 4][1575119222.231712103][Td.cpp:4672][#1][!Td][&td_requests] Sending result for request 6: authorizationStateReady {
}
[ 3][t 0][1575119222.231896162][Client.cpp:270][&td_requests] Begin to wait for updates with timeout 10.000000
[ 3][t 0][1575119222.231907129][Client.cpp:276][&td_requests] End to wait for updates, returning object 4 0x105000120
{ TDLibError: Chat not found
at toObject (/Users/velten/Entwicklung/telegram-app/node_modules/@airgram/core/utils.js:39:15)
at Object.<anonymous> (/Users/velten/Entwicklung/telegram-app/src/airgram/response.ts:5:19)
at step (/Users/velten/Entwicklung/telegram-app/src/airgram/response.ts:33:23)
at Object.next (/Users/velten/Entwicklung/telegram-app/src/airgram/response.ts:14:53)
at fulfilled (/Users/velten/Entwicklung/telegram-app/src/airgram/response.ts:5:58)
at <anonymous> name: 'TDLibError', code: 6 }
[ 3][t 0][1575119222.239633083][Client.cpp:270][&td_requests] Begin to wait for updates with timeout 10.000000
[ 3][t 0][1575119222.239653111][Client.cpp:276][&td_requests] End to wait for updates, returning object 6 0x1050001e0
[ 3][t 0][1575119222.239850998][Client.cpp:270][&td_requests] Begin to wait for updates with timeout 10.000000
[ 3][t 4][1575119222.287512064][ConfigManager.cpp:509][#1][!Recoverer][&config_recoverer] ON CONNECTING false
[ 3][t 4][1575119222.287546873][ConfigManager.cpp:689][#1][!Recoverer][&config_recoverer] Successfully connected
[ 3][t 4][1575119222.287559032][ConfigManager.cpp:753][#1][!Recoverer][&config_recoverer] Wakeup NEVER
...
from airgram.
You need to call getChats beforehand. But appearently limit 1 is enough, even if the chat is not the first:
airgram.api.getChats({
limit: 1,
offsetChatId: 0,
offsetOrder: '9223372036854775807' // 2^6
})
Related tdlib/td#791
from airgram.
Related to #65
from airgram.
Related Issues (20)
- error {code = 400 message = "Failed to parse JSON object as TDLib request: Can't parse "<bot_id_string>" as an integer"}
- failed authentication telegram when using self signed certificate
- check sending status
- how to import telegram web UI
- how to import telegram web UI
- Valid api_id must be provided. Can be obtained at HOT 10
- Chat info not found
- API object show empty {} and not working any api function
- Airgram JavaScript example not working HOT 1
- TdLib 1.8.6+ requires modified authorization object. HOT 1
- Example/how-to on how to access database (messages)?
- Reactions missing from MessageInteractionInfo
- is posible, create and manage bots with airgram?
- Enable `ignore_background_updates` in Airgram HOT 1
- spoilered message is unsupported
- "@airgram/web": "^5.0.0", cannot send images when running on the browser. No matter what value the Path is set to, it will display [sendMessage][400] Can't find real file path.
- Incompatible architecture [macOS]
- Auth Problem: Cant receive code
- Execute bot command in 1-1 personal chat instead of showing command text
- Is this project maintained? the current version is not compatible with the latest version of TDLib
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 airgram.