Won't run for some reason
Closed this issue ยท 12 comments
Hi
I have set up the python venv and edited the config.yml for my needs however when i go to run the app it fails to start and this is all i get from the logs so i hope it helps
2023-05-17 03:18:53,753 - Sports Lister - WARNING - Discord Client's internal cache is not ready
2023-05-17 03:18:53,915 - Sports Lister - ERROR - No input channels found, exiting
I am unsure why im getting this error as the config definitely has the channel ID i wish to forward too. Any ideas would get helpful before I pull the rest of my hair out trying to figure it out lol
Hey there, something is off in the telegram_forwarders section of your config file.
Would you be able to share that snippet of your configuration?
To give you more context, when the bridge tries registering your forwarders, it doesn't find one or more Telegram channels you've put in the config file:
if tg_channel_id in {dialog.name, dialog.entity.id}: # type: ignore
input_channels_entities.append(
InputChannel(dialog.entity.id, dialog.entity.access_hash)) # type: ignore
discord_channel_mappings[forwarder_name] = discord_channel_config
logger.info("Registered TG channel '%s' with ID %s with Discord channel config %s",
dialog.name, dialog.entity.id, discord_channel_config) # type: ignore
if not input_channels_entities:
logger.error("No input channels found, exiting")
sys.exit(1)
The config file in the forwarders section should look like the following:
- forwarder_name: "some name"
tg_channel_id: 123456789
discord_channel_id: 987654321012345678
mention_everyone: False
strip_off_links: False
forward_everything: True
forward_hashtags:
- name: "#ta"
- forwarder_name: "some other name"
tg_channel_id: 987654321
discord_channel_id: 876543210123456789
strip_off_links: False
mention_everyone: False
forward_everything: True
mention_override:
- tag: "#important"
roles: ["everyone"]
excluded_hashtags:
- name: "#sponsored"
- name: "#sponsor"
- name: "#news"
Hi mate here is my config i've removed personal info and tokens etc hopefully you can spot my error still lol
# Basic application configuration
application:
name: "Sports Lister"
version: "1.1.5"
description: "All about the sports listings"
debug: True
# healtcheck interval in seconds
healthcheck_interval: 60
# The time in seconds to wait before forwarding each missed message
recoverer_delay: 60
# logger setup
logger:
level: "DEBUG" # NOTSET, DEBUG, INFO, WARNING, ERROR, CRITICAL
file_max_bytes: 10485760 # 10MB
file_backup_count: 5
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
date_format: "%Y-%m-%d %H:%M:%S"
console: true # set to true to enable console logging and disable file based logging
# Telegram configuration
telegram:
# Your Telegram phone number | With quotes
phone: ""
# Your Telegram password (Two-step verification) | With quotes
password: ""
# This has to be an integer. Read more [here](https://core.telegram.org/api/obtaining_api_id) | No quotes
api_id:
# Long 32 characters hash identifier. Read more [here](https://core.telegram.org/api/obtaining_api_id) | With quotes
api_hash: ""
# Discord configuration
discord:
# Discord Bot Token. Go create a bridge on discord. | No quotes
bot_token:
# built-in roles in discord, they need special attention when parsing the name to mention
built_in_roles: []
#["everyone", "here", "@Admin"]
# Discord Client max tolerable latency
max_latency: 0.5
# OpenAI configuration
openai:
# OpenAI API Key and Organization. Read more [here](https://beta.openai.com/docs/api-reference)
api_key: "<your openai api key>"
organization: "<your openai organization>"
enabled: False
# The prompt to use for OpenAI, the #text_to_parse will be appended to this prompt
sentiment_analysis_prompt:
- "Analyze the following text to determine its sentiment: #text_to_parse.\n\n"
- "<add the rest of your prompt, if any, here>.\n\n"
- "<add the rest of your prompt, if any, here>.\n\n"
# The channels map to discord channels.
telegram_forwarders:
- forwarder_name: "Sports Listing"
tg_channel_id:
discord_channel_id:
strip_off_links: False # whether to strip off links from the message
mention_everyone: false
forward_everything: true # whether forwarding everything regardless the hashtag
Hello, the error you receive is expected because your config is wrong:
You're not providing the Telegram source tg_channel_id
and the Discord destination discord_channel_id
# The channels map to discord channels.
telegram_forwarders:
- forwarder_name: "Sports Listing"
tg_channel_id: # <<<< here you need to specify the ID of the Telegram channel you want to use as source
discord_channel_id: # <<< here you need to specify the ID of the Discord channel you want as destination
strip_off_links: False # whether to strip off links from the message
mention_everyone: false
forward_everything: true # whether forwarding everything regardless the hashtag
Hi
I do have both IDs in my config I've removed them when posting here
Hello again,
The error shows anyway that the Telegram channel was not found.
How did you fetch the ID of the channel?
I copied the id from the web version of the telegram client
e.g.
https://web.telegram.org/a/#6062540518
ID should then be 6062540518
Or does it also need the hashtag at the start?
It doesn't need the hashtag, nor the -
.
I've merged the development version into the main; it includes further diagnostics.
Please check all the changes; the breaking ones are listed in the README. Once you have adopted the configuration and changed the command you issue to start the bridge, execute it by setting the debug mode in the config.yml
.
At the start, in the logs, you will find all the available and excluded channels. If the one you're trying to hook is listed in the excluded, it is either an old channel or a conversation.
Let me know.
Thanks for the update I'll test that out soon and report back my findings ๐
Just tested the latest commit and turns out it was my telegram channel was getting excluded probably due to it being a bot channel so switched to a standard channel and my test messages/images sent correctly.
Now I'll make a systemd script to auto run in the event of a server crash ๐คฃ
Thanks for all your help it's been much appreciated.
Cool. I'm developing an API to handle the service as well. It is currently available but not ready for production. It lacks any auth.
Keep me posted if you use it. Any issue reported is much appreciated
Got it working on bootup so I will make a pull request with the changes etc.
Also is it possible to have an option that before messages etc are forwarded from telegram to discord that the channels in Discord have all the current messages deleted ready for the next batch being imported?