I make telegram Bot using Telethon.
How to apply it on pipedream?
Copy paste to Python?
But Python cannot be added at Trigger
Anyone know?
Hello @uyin_85,
First off, welcome to Pipedream! Happy to have you!
Yes you’re correct that currently we couldn’t create source in Python, it is only Node.js for now. Depending on your bot usecase, I think you can use Pipedream’s pre-built actions such as:
- Telegram Bot - New Message Updates
- Telegram Bot - New Bot Command
Then port your logic in Python to Pipedream using Pipedream’s Python action
how to make bot await user response and reply user?
Hi @uyin_85
The pd.flow.suspend
function might be helpful here. You can suspend the workflow until Discord fires a webhook when the user responds:
There is telethon
library in Python environment of Python step. So, I could from telethon import TelegramClient, events, sync
. But the code line client = TelegramClient('session_name', api_id, api_hash)
throws exception:
Traceback (most recent call last):
File "/nano-py/pipedream/worker.py", line 118, in execute
user_retval = handler(pd)
File "/tmp/__pdg__/dist/code/38572d516c4cf5d6d227b4df01038eb292471cea51535fa33232388c9f2d1a00/code.py", line 9, in handler
client = TelegramClient('session_name', api_id, api_hash)
File "/tmp/__pdg__/dist/python/telethon/client/telegrambaseclient.py", line 289, in __init__
session = SQLiteSession(session)
File "/tmp/__pdg__/dist/python/telethon/sessions/sqlite.py", line 47, in __init__
c = self._cursor()
File "/tmp/__pdg__/dist/python/telethon/sessions/sqlite.py", line 242, in _cursor
self._conn = sqlite3.connect(self.filename,
sqlite3.OperationalError: unable to open database file
How to make it work?
I need Telethon because bot has limited functionality.
Hi @ycomb
That error message is because the package is attempting to set up a SQLite database outside of /tmp
.
Only the /tmp
directory in your Pipedream workflows has write & read access. All other directories are read only.
So you’ll need to configure your TelegramClient
to set up this local database in /tmp
instead of the default.
Please review the package’s documentation for instructions on how to do that.