Python上的Telethon和Telebot图书馆。他们一起工作吗?

发布于 2025-02-12 18:12:39 字数 470 浏览 1 评论 0 原文

我最近开始根据 telethon 编写脚本。它唯一要做的是 - 检索视频,来自频道/组的照片,将它们保存到文件夹中。

因此,我决定实际制作一个带有命令的机器人来运行Telethon脚本,该脚本将下载特定数量的文件并将其发送回用户。

听起来很简单,但是当尝试使用Telebot库编写一个机器人时,我遇到了很多问题,然后将运行Telethon脚本。我遇到的错误毫无意义,因为我尝试了太多事情并且遇到了太多不同的错误。

所以我的主要问题是Telebot可以运行Telethon作为一个是同步的,另一个是异步?? 如果可以的话 - 是否有任何模板/示例? 如果不能 - 是否有示例/可能仅在Telethon上使用命令编写机器人?

如果不可能,是否有任何建议可以给我我一开始就可以实现我所描述的想法。

感谢大家< 3

I have recently started writing a script based on telethon. The only thing it does is - retriving videos, photos from channel/group, saving them to folder.

So then I have decided to actually make a bot with command to run the telethon script which is going to download specific amount of files and send it back to user.

Sounds simple, however I ran to bunch of issues when tried to use telebot library to write a bot which then is going to run the telethon script. Makes no sense to post here errors I got, as I have tried too many things and got too many different errors.

So my main question is Can Telebot run Telethon function as one is sync and the other async?
If it can - are there any templates/example of such usage?
If it cannot - is there an example/possibility to write the bot with commands only on Telethon?

If non of the above is possible, are there any advices you can give me how can I implement the idea i described at first.

Thanks everyone <3

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最初的梦 2025-02-19 18:12:40

请参阅pyrogram库

我想您可以用pyrogram编写自己的代码。

pyrogram支持。异步,您可以将此库与 celery> celery 用于自动化任务,而且此库也很容易理解。

See pyrogram library

I think you can write your own code with Pyrogram.

Pyrogram supports asyncio and you can combine this library with celery for automation task and also this library is very easy to understand.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文