Error on Telegram Bot

Hello all. I finally figured out how to set up my own bot. It works for a burst of messages and then stops. This is what I’m seeing: Can anybody tell me what to look for or how to fix this?

(.venvs) nonsudo@debian-deltabot:~$ simplebot -a 1234@1234.com serve
2023-07-20 09:25:46,288 - simplebot - INFO - bot listening at: 1234@1234.com
2023-07-20 09:25:51,682 - simplebot - ERROR - Could not find the input entity for PeerChannel(channel_id=1329205465) (PeerChannel). Please read Entities — Telethon 1.28.5 documentation to find out more details.
Traceback (most recent call last):
File “/home/nonsudo/.venvs/lib/python3.9/site-packages/simplebot_tgchan/init.py”, line 197, in check_channels
await check_channel(bot, client, chan)
File “/home/nonsudo/.venvs/lib/python3.9/site-packages/simplebot_tgchan/init.py”, line 206, in check_channel
channel = await client.get_entity(PeerChannel(dbchan.id))
File “/home/nonsudo/.venvs/lib/python3.9/site-packages/telethon/client/users.py”, line 287, in get_entity
inputs.append(await self.get_input_entity(x))
File “/home/nonsudo/.venvs/lib/python3.9/site-packages/telethon/client/users.py”, line 461, in get_input_entity
raise ValueError(
ValueError: Could not find the input entity for PeerChannel(channel_id=1329205465) (PeerChannel). Please read Entities — Telethon 1.28.5 documentation to find out more details.
2023-07-20 09:30:52,282 - simplebot - ERROR - Could not find the input entity for PeerChannel(channel_id=1329205465) (PeerChannel). Please read Entities — Telethon 1.28.5 documentation to find out more details.
Traceback (most recent call last):
File “/home/nonsudo/.venvs/lib/python3.9/site-packages/simplebot_tgchan/init.py”, line 197, in check_channels
await check_channel(bot, client, chan)
File “/home/nonsudo/.venvs/lib/python3.9/site-packages/simplebot_tgchan/init.py”, line 206, in check_channel
channel = await client.get_entity(PeerChannel(dbchan.id))
File “/home/nonsudo/.venvs/lib/python3.9/site-packages/telethon/client/users.py”, line 287, in get_entity
inputs.append(await self.get_input_entity(x))
File “/home/nonsudo/.venvs/lib/python3.9/site-packages/telethon/client/users.py”, line 461, in get_input_entity
raise ValueError(
ValueError: Could not find the input entity for PeerChannel(channel_id=1329205465) (PeerChannel). Please read Entities — Telethon 1.28.5 documentation to find out more details.

“Telethon” seems to be the telegram library and it complains about not finding an entity, maybe your thing was blocked by telegram? I just have this wild guess for now.

So far I have not sorted out that error, but I did figure out why my Bot kept shutting down:

I created my bot on a VPS running on my sons server here in my house. I used SSH (Putty on Windows) to set it up. Every time I closed SSH, it would kill my bot. I literally had to keep the SSH instance open to keep the bot running. My son opened the console in ProxMox and ran the commands there which keeps the bot running now.

The errors are still there, but the bot runs properly now. So I’m still not sure how to get rid of them.

you can also use tmux or screen (terminal multiplexers) to keep the session open even if you disconnect from ssh. I personally use tmux at the moment, the first time you run:

tmux

then there you can run several bots creating “tabs” with one new terminal/shell session, you can use ctrl+b c to create a new tab, ctrl+b n to switch to the next tab etc.

then on re-connection run tmux a to attach the previous created “window” with all your tabs/shell sessions and their still running commands

1 Like

tip: when pasting logs it is better to use a three ``` at the start and end of the block, ex:

text containing **raw** __stuff__.py
1 Like

about the error you are having with simplebot_tgchan, it seems you left the channel with the account the bot is using? or otherwise the channel got removed or you got removed? is the channel not public?

I don’t know. I can’t figure out what channel it is. When I try to open it in Telegram Web it does not give me anything. Maybe I’ll try with my wife’s telegram account and see if it comes up. Maybe I’m blocked somehow?