Comments (14)
Since version 0.1.20
you can provide your own axios
instance with custom options:
import axios from 'axios'
import * as https from 'https'
import { ag, Airgram, TYPES } from 'airgram'
import MtpNetwork from 'airgram/base/MtpNetwork'
const airgram = new Airgram({ /* options */ })
airgram.bind<MtpNetwork>(TYPES.MtpNetwork).to(MtpNetwork).onActivation((context, network) => {
const httpsAgent = new https.Agent()
network.axios = axios.create({ httpsAgent })
return network
})
You can try this recipe to create socks5 https agent.
from airgram.
Try to import MtpNetwork
this way:
const MtpNetwork = require('airgram/base/MtpNetwork').default
from airgram.
Actually I did all of that but it did not work. I'll try to stick to using torify (it mostly works) and VPN for now until airgram
gets a built-in support for socks proxy.
Thanks.
from airgram.
Check whether it works with the 0.1.21
version or not. If not, please provide some more information about errors.
from airgram.
@airgram it throws error
Error: Missing required @Injectable annotation in: Anonymous function: [object Object].
from airgram.
I also confirm this feature does not work.
airgram version: 0.1.21
My code:
const airgram = new Airgram({id: conf.api_id, hash: conf.api_hash});
// Proxy
airgram.bind(TYPES.MtpNetwork).to(MtpNetwork).onActivation((context, network) => {
network.axios = axios.create({
httpsAgent: new https.Agent(),
});
return network;
});
After default timeout throw error:
Error: Request timeout exceeded.
at Timeout._onTimeout (tg\node_modules\airgram\base\Client.js:280:89)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)
from airgram.
@qwertvasilii, can you share your code?
@k0t0fey, I've just checked your code. It works for me. If you are in Russia or in some other banned area, try to use proxy as described here.
from airgram.
Yep, I'am from Russia, but I use vpn on my router, so all banned services working for me.
For example, if I disable part with network.axios
and request any tg-method, then it work fine:
const dialogs = await airgram.client.messages.getDialogs({
// flags: 0,
limit: 100,
offset_date: last_date,
offset_id: 0,
offset_peer: { _: 'inputPeerEmpty' }
});
dialogs contains all actual data:
from airgram.
@k0t0fey, can you upload verbose
log with and without network settings? Don't forget to remove sensitive data
from airgram.
verbose_log_without_network_stg.log
verbose_log_with_network_stg.log
the same error as described by @qwertvasilii
airgram error 15:58:17.254 [MtpClient][1] sendScheduledRequest() "Missing required @injectable annotation in: Anonymous function: [object Object]." +3ms
from airgram.
Any ideas how to solve this problem?
from airgram.
I can't reproduce this error. Please can you clone this repo (test-network
branch) and check whether the example works for you or not.
from airgram.
Very likely the problem occurs with a projects based in a pure js.
from airgram.
Thx, now all works! =)
from airgram.
Related Issues (20)
- "const airgram = new Airgram();" gives an error on startup
- 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
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.