Giter Site home page Giter Site logo

Comments (11)

Lonami avatar Lonami commented on July 16, 2024

Note to newcomers: things have evolved since this issue was first posted, and Telethon now makes it just as easy to write bots as it does to write scripts that control user accounts (although that could be seen further below). So yes, Telethon can be used to make bots too.

Below follow the original comments.


If I understood correctly, no. Telethon is for using Telegram as a normal client would, not for bots. You can build a bot with this and it would seem to be a normal use, but you can't control Telegram bots per se with Telethon. You can, however, manage them by talking to the @BotFather, in the same way you can do with any client.

from telethon.

Lonami avatar Lonami commented on July 16, 2024

By the way, if you want to build a bot, maybe Lonabot is a good start, if you're looking for something that I made. There are tons of other libraries out there.

from telethon.

exzhawk avatar exzhawk commented on July 16, 2024

I want to access full MTProto method rather than normal vanilla bot API. What I need is a bot token login method like Telegram-CLI --bot (https://github.com/vysheng/tg/wiki/Telegram-CLI-Arguments).
I believe if Telegram-CLI can do it, all MTProto lib can do it as well. I think it's just about auth staff. If you have no plan of this feature, I'll try to implement.

from telethon.

Lonami avatar Lonami commented on July 16, 2024

What I need is a bot token login method like Telegram-CLI --bot

But there's no bot token, is there? It's just a normal user, and it would need a phone (even if it is just a virtual one), as far as I know.

If you have no plan of this feature

I don't know if it's possible to use a bot token to access the full list of methods as a normal user would, but if you manage to succeed, I'd be glad to merge!

from telethon.

exzhawk avatar exzhawk commented on July 16, 2024

@XyLoNaMiyX if you use Telegram-CLI --bot to start it, it will ask you a bot token instead of phone number and code. Then the client works like a normal one but you are a bot. You can chat with others like normal user. But bot limitations are still there, like you can't initiate a new chat.

from telethon.

Lonami avatar Lonami commented on July 16, 2024

I see… Pretty cool. Maybe we could make a different class, TelegramBotClient, which behaved just like the normal TelegramClient but was a bot.

from telethon.

Lonami avatar Lonami commented on July 16, 2024

I have more questions. What are we supposed to implement for the bot? Should we parse the bot methods just like we parsed the original .tl methods? Is this only for the interactive client, or as another client (TelegramBotClient)? Thing is a bot works quite differently than how a normal user does. Perhaps this should be a completely separate project?

from telethon.

JuanPotato avatar JuanPotato commented on July 16, 2024

you dont need to implement anything other than the authorize
auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization;
then everything else works like a normal user, but some methods are disabled and others are limited. Like adding users to group etc

from telethon.

Lonami avatar Lonami commented on July 16, 2024

I didn't know that was a thing @JuanPotato, thanks for pointing us in the right direction!

from telethon.

Lonami avatar Lonami commented on July 16, 2024

Usage: client.sign_in(bot_token='your hash').

from telethon.

mktcockpit avatar mktcockpit commented on July 16, 2024

Can this works on the telegram desktop application?

from telethon.

Related Issues (20)

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.