Giter Site home page Giter Site logo

telegramapi's Issues

Node.js

Consider Node.js support?

"CODE#400 CHANNEL_INVALID" for any request

hi there, there is code that always returns "CODE#400 CHANNEL_INVALID".

var ch={
		_:"inputPeerChannel",
		channel_id:1061287123,
		access_hash:18433795304401088453
	};
telegramApi.invokeApi('channels.readHistory', {
		  	channel:ch,
	                max_id:1000
	}).then(function(e) {
			console.log(e);		
});

invalid phone number.

image
image
I filled in the correct phone number and why I returned the invalid phone number.

ContainerModule is not defined

Hello!
I am use vue.js

import telegramApi from 'telegram-api-js/dist/telegramApi.js'
export default {
	,data() {return {}}
	,created(){
		telegramApi.setConfig({
			app: {
				id: 123456789, /* in App I am use real ID */
				hash: '123456789', /* in App I am use real hash */
				version: telegramApi.VERSION /* App version */
			},
			server: {
				test: [
					{
						id: 2, /* DC ID */
						host: '149.154.167.40', 
						port: 443
						}
				],
				production: [
					{
						id: 2, /* DC ID */
						host: 149.154.167.40', 
						port: 443
					}
				]
			}
		});

		telegramApi.getUserInfo().then(function(user) {
			if (user.id) {
				console.log(user);
			}
			else{
				// Log in
			}
		});
	}
}

and get error

telegramApi.js?1c95:5353 Uncaught ReferenceError: ContainerModule is not defined
    at eval (telegramApi.js?1c95:5353)
    at eval (telegramApi.js?1c95:5397)
    at Object../node_modules/telegram-api-js/dist/telegramApi.js (app.js:1936)
    at __webpack_require__ (app.js:725)
    at fn (app.js:102)
    at eval (cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/views/Chats.vue?vue&type=script&lang=js&:12)
    at Module../node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/views/Chats.vue?vue&type=script&lang=js& (app.js:907)
    at __webpack_require__ (app.js:725)
    at fn (app.js:102)
    at eval (Chats.vue?afc6:1)

Sign in problem : NETWORK_BAD_REQUEST and 404 (Not Found) error

help.getNearestDc works correctly also I call help.getConfig and set ip address like this :
production: [
{id: 1, host: '149.154.175.50', port: 443},
{id: 2, host: '149.154.167.51', port: 443},
{id: 3, host: '149.154.175.100', port: 443},
{id: 4, host: '91.108.4.182', port: 443},
{id: 5, host: '91.108.56.165', port: 443}
]
but when calling sendCode I receive this error:
Rpc error
{code: 303, type: "PHONE_MIGRATE_4", description: "CODE#303 PHONE_MIGRATE_4"

POST http://91.108.4.182:443/apiw1 404 (Not Found)
Encrypted request failed
{code: 406, type: "NETWORK_BAD_REQUEST", url: "http://91.108.4.182:443/apiw1"
Check connection undefined

POST http://91.108.4.182:443/apiw1 404 (Not Found)
.
.
.
I checked different IP address and also port 80 and 433. IPs above are from help.getConfig
How to solve this issue?

Code:

    telegramApi.sendCode('+989142158375').then(function(sent_code) {
        if (!sent_code.phone_registered) {
            // New user
        }

        // phone_code_hash will need to sign in or sign up
        window.phone_code_hash = sent_code.phone_code_hash;
        alert(window.phone_code_hash);

    });

pq exception

When I open index.html with phantomjs I got these errors:
Pq leemon Exception ReferenceError: Can't find variable: str2bigInt
Pq long Exception ReferenceError: Can't find variable: goog

index.html opened in other browser normally. Can you help me?

messages.getDialogs deprecated?

It is defined in the .files/schema.txt as follows:
messages.getDialogs#6b47f94d offset_date:int offset_id:int offset_peer:InputPeer limit:int = messages.Dialogs;

And on the telegram API doc:
messages.getDialogs#eccf1df6 offset:int max_id:int limit:int = messages.Dialogs;

Seems like offset_date and offset_peer disappeared while offset_id changed name to max_id.
I'm trying to call this method from telegramApi.invokeAPI but i always get the:
Invalid object for type InputPeer at telegramApi.js:2032

Do you think that this could be the cause?

Thanks

Error on trying to init the project from the example

This is what i get in the console:
telegramApi.js:1172 Pq leemon Exception ReferenceError: str2bigInt is not defined(…)pqPrimeFactorization @ telegramApi.js:1172(anonymous function) @ telegramApi.js:575(anonymous function) @ telegramApi.js:146handleMessage @ telegramApi.js:1729 telegramApi.js:1180 Pq long Exception ReferenceError: goog is not defined(…)pqPrimeFactorization @ telegramApi.js:1180(anonymous function) @ telegramApi.js:575(anonymous function) @ telegramApi.js:146handleMessage @ telegramApi.js:1729 telegramApi.js:2989 [4.201] PQ factorization done 51447 telegramApi.js:3034 [4.206] Send req_DH_params telegramApi.js:3103 [4.733] Done decrypting answer telegramApi.js:4533 [4.734] Apply server time 1480535465 1480535465012 0 false telegramApi.js:1413 mod pow error ReferenceError: str2bigInt is not defined(…)bytesModPow @ telegramApi.js:1413(anonymous function) @ telegramApi.js:580(anonymous function) @ telegramApi.js:146handleMessage @ telegramApi.js:1729 telegramApi.js:3147 [4.869] Send set_client_DH_params telegramApi.js:1413 mod pow error ReferenceError: str2bigInt is not defined(…)bytesModPow @ telegramApi.js:1413(anonymous function) @ telegramApi.js:580(anonymous function) @ telegramApi.js:146handleMessage @ telegramApi.js:1729 telegramApi.js:3171 [5.334] Got Set_client_DH_params_answer dh_gen_ok telegramApi.js:3478 [5.337] Api call help.getNearestDc telegramApi.js:4257 [5.638] Rpc response nearestDc telegramApi.js:2723 Get networker error Error: No server found for dc 4(…) Error: No server found for dc 4 at Object.mtpAuth [as auth] (file:///Users/stasarshanski/Documents/telegram_test/js/telegramApi.js:3234:30) at Object.<anonymous> (file:///Users/stasarshanski/Documents/telegram_test/js/telegramApi.js:2715:34) at Object.<anonymous> (https://code.jquery.com/jquery-2.2.4.min.js:2:28469) at i (https://code.jquery.com/jquery-2.2.4.min.js:2:27151) at Object.add [as done] (https://code.jquery.com/jquery-2.2.4.min.js:2:27450) at Array.<anonymous> (https://code.jquery.com/jquery-2.2.4.min.js:2:28446) at Function.each (https://code.jquery.com/jquery-2.2.4.min.js:2:2861) at Object.<anonymous> (https://code.jquery.com/jquery-2.2.4.min.js:2:28387) at Function.Deferred (https://code.jquery.com/jquery-2.2.4.min.js:2:28973) at Object.then (https://code.jquery.com/jquery-2.2.4.min.js:2:28364) telegramApi.js:3478 [19.305] Api call auth.sendCode telegramApi.js:4240 [19.955] Rpc error Object {code: 303, type: "PHONE_MIGRATE_4", description: "CODE#303 PHONE_MIGRATE_4", originalError: Object} telegramApi.js:2772 [19.956] Error 303 PHONE_MIGRATE_4 false 2(anonymous function) @ telegramApi.js:2772(anonymous function) @ jquery-2.2.4.min.js:2i @ jquery-2.2.4.min.js:2fireWith @ jquery-2.2.4.min.js:2e.(anonymous function) @ jquery-2.2.4.min.js:2MtpNetworkerFactoryModule.MtpNetworker.processMessage @ telegramApi.js:4242(anonymous function) @ telegramApi.js:3810(anonymous function) @ jquery-2.2.4.min.js:2i @ jquery-2.2.4.min.js:2fireWith @ jquery-2.2.4.min.js:2e.(anonymous function) @ jquery-2.2.4.min.js:2i @ jquery-2.2.4.min.js:2fireWith @ jquery-2.2.4.min.js:2(anonymous function) @ jquery-2.2.4.min.js:2i @ jquery-2.2.4.min.js:2fireWith @ jquery-2.2.4.min.js:2e.(anonymous function) @ jquery-2.2.4.min.js:2(anonymous function) @ telegramApi.js:146handleMessage @ telegramApi.js:1729 telegramApi.js:2723 Get networker error Error: No server found for dc 4(…) Error: No server found for dc 4 at Object.mtpAuth [as auth] (file:///Users/stasarshanski/Documents/telegram_test/js/telegramApi.js:3234:30) at Object.<anonymous> (file:///Users/stasarshanski/Documents/telegram_test/js/telegramApi.js:2715:34) at Object.<anonymous> (https://code.jquery.com/jquery-2.2.4.min.js:2:28469) at i (https://code.jquery.com/jquery-2.2.4.min.js:2:27151) at Object.add [as done] (https://code.jquery.com/jquery-2.2.4.min.js:2:27450) at Array.<anonymous> (https://code.jquery.com/jquery-2.2.4.min.js:2:28446) at Function.each (https://code.jquery.com/jquery-2.2.4.min.js:2:2861) at Object.<anonymous> (https://code.jquery.com/jquery-2.2.4.min.js:2:28387) at Function.Deferred (https://code.jquery.com/jquery-2.2.4.min.js:2:28973) at Object.then (https://code.jquery.com/jquery-2.2.4.min.js:2:28364) script.js:54 Object {promise: Object, input: "auth.sendCode", stack: "Error↵ at Object.rejectPromise (file:///Users/s…ocuments/telegram_test/js/telegramApi.js:2813:63)", $$hashKey: "object:44", handled: true}$$hashKey: "object:44"always: ()done: ()fail: ()handled: trueinput: "auth.sendCode"notify: ()notifyWith: (a,c)pipe: ()progress: ()promise: Objectreject: ()rejectWith: (a,c)resolve: ()resolveWith: (a,c)stack: "Error↵ at Object.rejectPromise (file:///Users/stasarshanski/Documents/telegram_test/js/telegramApi.js:2743:103)↵ at Object.<anonymous> (https://code.jquery.com/jquery-2.2.4.min.js:2:28469)↵ at i (https://code.jquery.com/jquery-2.2.4.min.js:2:27151)↵ at Object.add [as fail] (https://code.jquery.com/jquery-2.2.4.min.js:2:27450)↵ at Array.<anonymous> (https://code.jquery.com/jquery-2.2.4.min.js:2:28446)↵ at Function.each (https://code.jquery.com/jquery-2.2.4.min.js:2:2861)↵ at Object.<anonymous> (https://code.jquery.com/jquery-2.2.4.min.js:2:28387)↵ at Function.Deferred (https://code.jquery.com/jquery-2.2.4.min.js:2:28973)↵ at Object.then (https://code.jquery.com/jquery-2.2.4.min.js:2:28364)↵ at Object.<anonymous> (file:///Users/stasarshanski/Documents/telegram_test/js/telegramApi.js:2813:63)"state: ()then: ()__proto__: Object script.js:54 Object {promise: Object, input: "auth.sendCode", stack: "Error↵ at Object.rejectPromise (file:///Users/s…ocuments/telegram_test/js/telegramApi.js:2813:63)", $$hashKey: "object:44", handled: true}

No server found for dc 4

Hi, When I call sendCode method, I got this error:

telegramApi.js:1182 [0.834] Error 303 PHONE_MIGRATE_4 false 2 ... Get networker error Error: No server found for dc 4(…) Error: No server found for dc 4 at Object.mtpAuth [as auth] (file:///home/misam/misam/node_modules/telegram-api-js/dist/telegramApi.js:1644:30) ....
Can you help me?!

Error Proper Connection

when use getUserPhoto it always returns {error_code: 303, error_message: "USER_MIGRATE_4" / "FILE_MIGRATE_4"} .

navigator is not defined.

Discord Token: AAAAAAAAAAAA
D:\discordjs\telegram_automessage\node_modules\telegram-api-js\dist\telegramApi.js:58
function BigInteger(a,b,c){null!=a&&("number"==typeof a?this.fromNumber(a,b,c):null==b&&"string"!=typeof a?this.fromString(a,256):this.fromString(a,b))}function nbi(){return new BigInteger(null)}function am1(a,b,c,d,e,f){for(;--f>=0;){var g=bthis[a++]+c[d]+e;e=Math.floor(g/67108864),c[d++]=67108863&g}return e}function am2(a,b,c,d,e,f){for(var g=32767&b,h=b>>15;--f>=0;){var i=32767&this[a],j=this[a++]>>15,k=hi+jg;i=gi+((32767&k)<<15)+c[d]+(1073741823&e),e=(i>>>30)+(k>>>15)+hj+(e>>>30),c[d++]=1073741823&i}return e}function am3(a,b,c,d,e,f){for(var g=16383&b,h=b>>14;--f>=0;){var i=16383&this[a],j=this[a++]>>14,k=hi+jg;i=gi+((16383&k)<<14)+c[d]+e,e=(i>>28)+(k>>14)+h*j,c[d++]=268435455&i}return e}function int2char(a){return BI_RM.charAt(a)}function intAt(a,b){var c=BI_RC[a.charCodeAt(b)];return null==c?-1:c}function bnpCopyTo(a){for(var b=this.t-1;b>=0;--b)a[b]=this[b];a.t=this.t,a.s=this.s}function bnpFromInt(a){this.t

ReferenceError: navigator is not defined
at D:\discordjs\telegram_automessage\node_modules\telegram-api-js\dist\telegramApi.js:58:17304
at Object. (D:\discordjs\telegram_automessage\node_modules\telegram-api-js\dist\telegramApi.js:5397:3)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object. (D:\discordjs\telegram_automessage\index.js:10:21)
[nodemon] app crashed - waiting for file changes before starting...

watch example

Hi
Thanks for your great work.
How can I watch the example? gulp watch or any commands?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.