Fixed destination channel selection
This commit is contained in:
committed by
GitHub
parent
f118e50940
commit
ec14ba8eb3
@@ -516,11 +516,29 @@ class OptimizedTelegramScraper:
|
|||||||
if dest_input.startswith('@'):
|
if dest_input.startswith('@'):
|
||||||
dest_channel = dest_input
|
dest_channel = dest_input
|
||||||
else:
|
else:
|
||||||
|
# First try parsing as a channel from the tracked list
|
||||||
dest_channels = self.parse_channel_selection(dest_input)
|
dest_channels = self.parse_channel_selection(dest_input)
|
||||||
if not dest_channels:
|
if dest_channels:
|
||||||
print("❌ Invalid destination channel selection")
|
dest_channel = dest_channels[0]
|
||||||
return
|
else:
|
||||||
dest_channel = dest_channels[0]
|
# If not in tracked list, try as a raw channel ID (for destination-only channels)
|
||||||
|
try:
|
||||||
|
if dest_input.lstrip('-').isdigit():
|
||||||
|
test_id = int(dest_input)
|
||||||
|
# Try to resolve the channel via Telethon to verify it exists
|
||||||
|
try:
|
||||||
|
entity = await self.client.get_entity(PeerChannel(test_id))
|
||||||
|
dest_channel = dest_input
|
||||||
|
print(f"✅ Found channel: {getattr(entity, 'title', dest_input)}")
|
||||||
|
except Exception:
|
||||||
|
print(f"❌ Could not access channel ID {dest_input}. Make sure this account is a member.")
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
print("❌ Invalid destination channel selection")
|
||||||
|
return
|
||||||
|
except ValueError:
|
||||||
|
print("❌ Invalid destination channel selection")
|
||||||
|
return
|
||||||
|
|
||||||
print("\n3️⃣ Select content types to forward:")
|
print("\n3️⃣ Select content types to forward:")
|
||||||
print(" [1] Text messages")
|
print(" [1] Text messages")
|
||||||
|
|||||||
Reference in New Issue
Block a user