Giter Site home page Giter Site logo

forwardgram's People

Contributors

abdellahaski avatar magofoco avatar voidbar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

forwardgram's Issues

Override message

Is there a way to override (update) incoming messages before sending to my channel?

Feature Request (Non-Issue)

I am currently running this script and it seems to be working. Wanted to ask if you will allow the option to remove the text "forwarded from xxxxxx" so that it looks like a regular message submitted in the channel?

AttributeError: 'Chat' object has no attribute 'access_hash'

I have done everything correctly (i guess) but every time it throws this error.
Any clue what's wrong?

The console throws this error :

  File "forwardgram.py", line 49, in <module>
    start(config)
  File "forwardgram.py", line 24, in start
    output_channel_entities.append(InputChannel(d.entity.id, d.entity.access_hash))
AttributeError: 'Chat' object has no attribute 'access_hash'

Dockerize Forwardgram

Hey!

First of all, great job on Forwardgram! :)

I'm running Forwardgram on my Synology NAS right now with Docker :). The biggest reason for me being:

  • I don't want to clutter with python on my NAS
  • I want the container to restart automatically if my nas was down due to a power outage

However, when starting Forwardgram, you get this wizard thing that you have to do manually. Is there a way to work around this? I mean: it should be possible to just do this wizard once and reuse the credentials?

Kind regards,

Raf

SEND AN IMAGE

When the telegram channel sent an image, the bot didn't recognize that, how can i fix it?

if output Channel entity is none: here get a problem

"forwardgram.py", line 40, in
start(config)
File "forwardgram.py", line 24, in start
if output_channel_entity is None:
UnboundLocalError: local variable 'output_channel_entity' referenced before assignment

if d.name in config["input_channel_names"] or d.entity.i

python forwardgram.py config.yml
Traceback (most recent call last):
File "H:\Python\18\forwardgram.py", line 49, in
start(config)
File "H:\Python\18\forwardgram.py", line 21, in start
if d.name in config["input_channel_names"] or d.entity.i
TypeError: 'in ' requires string as left operand, no

i'm having the following problem, can someone help me?

Telegram blocked and deleted my account

Hello . I was using this robot until last year and there was no problem. But recently, every time I used this bot, Telegram blocked and deleted my account

Re-write messages to output channels ?

Hi, is there any way for the bot to "copy" the messages and send it to the output channels without having the "Forwarded message" included ? It's like anonymizing the source. Thank you !

Messages won't forward

C:\Users\Augusto\PycharmProjects\1stprogram\venv\Personal Programs\DBParser\Telegram>py forwardgram.py config.yml
forwardgram.py:43: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  config = yaml.load(f)
2020-02-20 16:16:14,759 - root - INFO - Listening on 3 channels. Forwarding messages to jAlertsFX.

It's listening to the 3 channels but whenever I get a message, it won't forward it to my other channel? Any solutions?

messages not forward in sequence

when the input channel put multi messages once
the message not forward in same sequence to output channel

example:

input channel send this multi messages once:
message then picture then file

output channel will be get like that:
message then file then picture
or
picture then file then message

is there a fix?

*this only happen if the input send multi messages once it's the same time

Work through a proxy

Good day! And what about the blocking of TG in Russia? how to register code through a proxy?

AttributeError: 'Chat' object has no attribute 'access_hash'

Hi..

When I run this repo..Igot error like this..

Traceback (most recent call last):
File "C:\PYTHON\forwardgram\forwardgram\forwardgram.py", line 49, in
start(config)
File "C:\PYTHON\forwardgram\forwardgram\forwardgram.py", line 22, in start
input_channels_entities.append(InputChannel(d.entity.id, d.entity.access_hash))
AttributeError: 'Chat' object has no attribute 'access_hash'

Below is My Config Sample configME.yml

api_id: 999999 # This has to be an integer. Read more here
api_hash: 87098fgsd4524353245gsdgdg546 # Long 32 characters hash identifier. Read more here
session_name: 'Tforward' # Session name. Only one session (with a unique session name) can run at a time

The channel names that you'd like to forward messages from.

The user running the client must have these channels present on it's dialogs.

input_channel_names:

  • 'Go-Telegram'

The output channel names that the messages will be forwarded to.

The user running the client must have a write access to those channels, and have the channels present on theirs dialogs.

output_channel_names:

  • 'Forward-Telegram'

The channel IDs that you'd like to forward messages from. (You can get a channel ID by forwarding any message from it to @userinfobot , and removing the -100 from the start )

input_channel_ids:

  • 595677791 # Input Channel ID without quotes ''

The output channel IDs that the messages will be forwarded to. (You can get a channel ID by forwarding any message from it to @userinfobot , and removing the -100 from the start )

output_channel_ids:

  • 595677305 # Output Channel ID without quotes ''

An empty list should be set like this:

input_channel_ids: []

Could not find any output channels in the user's dialogs

Hi,

Just installed your appication as a test, but I can't get it working . No idea what i'm doing wrong here :-)

python3 forwardgram.py config.yml-sample
  File "forwardgram.py", line 27
    logger.error(f"Could not find any output channels in the user's dialogs")
                                                                           ^
SyntaxError: invalid syntax

I just did a copy/paste from a Telegram Channel/Group it's name. Or should I work with Channel/Group ID's ?

This is my config file:

api_id: xxxxxx # This has to be an integer. Read more [here](https://core.telegram.org/api/obtaining_api_id)
api_hash: 'xxxxxxxxxxxxx' # Long 32 characters hash identifier. Read more [here](https://core.telegram.org/api/obtaining_api_id)
session_name: 'forwardgram' # Session name. Only one session (with a unique session name) can run at a time

# The channel names that you'd like to forward messages from.
# The user running the client must have these channels present on it's dialogs.
input_channel_names:
  - 'Binance English'

# The output channel names that the messages will be forwarded to.
# The user running the client must have a write access to those channels, and have the channels present on theirs dialogs.
output_channel_names: 
  - 'test'

I don't even get to the point where I need to enter my phone number to authenticate against Telegram.

Any hint? Thanks!

Unify the message before sending out

Hi, thanks for providing this great script. Idon't want to forward all messages, just want to forward some messages with keyword "EURUSD" or "USDJPY", and because different channels has their own way to present the same thing, I have to unify the format before sending out. For example I got a message from channel A:
Sell EURUSD stoploss 1.123 takeprofit 1.223
And I got a message with different format from channel B:
SELL USDJPY STOPLOSS: 1.111 TAKEPROFIT 1.333
And I need to send the following message to the channel:
Sell EURUSD with stoploss at 1.123 and takeprofit at 1.223
Sell USDJPY with stoploss at 1.111 and takeprofit at 1.333
Where should I edit the code? Many thanks!

Update app to login?

Traceback (most recent call last):
File "C:\Users\victo\nova\forwardgram\forwardgram.py", line 49, in
start(config)
File "C:\Users\victo\nova\forwardgram\forwardgram.py", line 16, in start
client.start()
File "C:\Python39\lib\site-packages\telethon\client\auth.py", line 133, in start
else self.loop.run_until_complete(coro)
File "C:\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "C:\Python39\lib\site-packages\telethon\client\auth.py", line 207, in _start
me = await self.sign_in(phone, code=value)
File "C:\Python39\lib\site-packages\telethon\client\auth.py", line 368, in sign_in
result = await self(request)
File "C:\Python39\lib\site-packages\telethon\client\users.py", line 30, in call
return await self._call(self._sender, request, ordered=ordered)
File "C:\Python39\lib\site-packages\telethon\client\users.py", line 79, in _call
result = await future
telethon.errors.rpcbaseerrors.AuthKeyError: RPCError 406: UPDATE_APP_TO_LOGIN (caused by SignInRequest)

i don't know how to fix that, my telegram already at the last update. This return after i put the code to login

it doesn't work with API tokens

I need help :(

He has all admin rights and no restrictions have been made
It works via telephone number. but is very ugly

user@server:/path/to/telegram_bot$ python3 forwardgram.py config.yml
Please enter your phone (or bot token): HERE API Token
Traceback (most recent call last):
File "forwardgram.py", line 49, in
start(config)
File "forwardgram.py", line 20, in start
for d in client.iter_dialogs():
File "/home/user/.local/lib/python3.8/site-packages/telethon/requestiter.py", line 87, in next
return self.client.loop.run_until_complete(self.anext())
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/home/user/.local/lib/python3.8/site-packages/telethon/requestiter.py", line 74, in anext
if await self._load_next_chunk():
File "/home/user/.local/lib/python3.8/site-packages/telethon/client/dialogs.py", line 53, in _load_next_chunk
r = await self.client(self.request)
File "/home/user/.local/lib/python3.8/site-packages/telethon/client/users.py", line 30, in call
return await self._call(self._sender, request, ordered=ordered)
File "/home/user/.local/lib/python3.8/site-packages/telethon/client/users.py", line 79, in _call
result = await future
telethon.errors.rpcerrorlist.BotMethodInvalidError: The API access for bot users is restricted. The method you tried to invoke cannot be executed as a bot (caused by GetDialogsRequest)
user@server:/path/to/telegram_bot

Traceback

Logging in with the phone number and code is working, after that i get this:

Traceback (most recent call last):
File "forwardgram.py", line 40, in
start(config)
File "forwardgram.py", line 18, in start
for d in client.iter_dialogs():
File "C:\Users\Max\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telethon\requestiter.py", line 84, in next
return self.client.loop.run_until_complete(self.anext())
File "C:\Users\Max\AppData\Local\Programs\Python\Python37-32\lib\asyncio\base_events.py", line 584, in run_until_complete
return future.result()
File "C:\Users\Max\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telethon\requestiter.py", line 59, in anext
raise StopAsyncIteration
StopAsyncIteration

Use channel ID or link as input_channel

Hi there, thanks for providing this great script firstly.

I faced a problem when I use this script, some channels may change their names sometimes, and then I need to manually change that in the config file. So is that possible to use Channel Id or link in the config file as input channel.

Thanks for your helping.

Issue with photos and stickers

The code is running very well only with messages, if i send a photo or stick doesnt send on output channel, why? Can you help me?

Its only sending messagens, i'm need photos too.

iter_dialogs does not allow bots

Hi there!

Coming up against this error:
telethon.errors.rpcerrorlist.BotMethodInvalidError: The API access for bot users is restricted. The method you tried to invoke cannot be executed as a bot (caused by GetDialogsRequest)
My input_channel is a public channel and my output_channel is my bot.
I'm sure this used to work? Not used this in a while and i cant find any changelog that would stop this. Any ideas?
Thanks!

Clone a channel

Any idea on what i can modify if i want to forward all the messages including the old ones creating such a copy of that channel?

Help+

Hello, i'm noob with python can you help from start? what i need to do?

Application cant run

Is the Chinese group name not supported?
Below is the output

2020-03-11 08:57:28,282 - telethon.extensions.messagepacker - DEBUG - Assigned msg_id = 6802748226810135608 to InvokeWithLayerRequest (7f9d8ac93f60)
2020-03-11 08:57:28,282 - telethon.network.mtprotosender - DEBUG - Encrypting 1 message(s) in 96 bytes for sending
2020-03-11 08:57:28,283 - telethon.network.mtprotosender - DEBUG - Encrypted messages put in a queue to be sent
2020-03-11 08:57:28,283 - telethon.network.mtprotosender - DEBUG - Waiting for messages to send...
2020-03-11 08:57:28,283 - telethon.network.mtprotosender - DEBUG - Receiving items from the network...
2020-03-11 08:57:28,322 - telethon.network.mtprotosender - DEBUG - Handling bad salt for message 6802748226810135608
2020-03-11 08:57:28,322 - telethon.network.mtprotosender - DEBUG - 1 message(s) will be resent
2020-03-11 08:57:28,322 - telethon.network.mtprotosender - DEBUG - Receiving items from the network...
2020-03-11 08:57:28,323 - telethon.extensions.messagepacker - DEBUG - Assigned msg_id = 6802748226970848804 to InvokeWithLayerRequest (7f9d8ac93f60)
2020-03-11 08:57:28,323 - telethon.network.mtprotosender - DEBUG - Encrypting 1 message(s) in 96 bytes for sending
2020-03-11 08:57:28,323 - telethon.network.mtprotosender - DEBUG - Encrypted messages put in a queue to be sent
2020-03-11 08:57:28,323 - telethon.network.mtprotosender - DEBUG - Waiting for messages to send...
2020-03-11 08:57:28,323 - telethon.extensions.messagepacker - DEBUG - Assigned msg_id = 6802748226972458604 to MsgsAck (7f9d911ff978)
2020-03-11 08:57:28,323 - telethon.network.mtprotosender - DEBUG - Encrypting 1 message(s) in 36 bytes for sending
2020-03-11 08:57:28,323 - telethon.network.mtprotosender - DEBUG - Encrypted messages put in a queue to be sent
2020-03-11 08:57:28,323 - telethon.network.mtprotosender - DEBUG - Waiting for messages to send...
2020-03-11 08:57:28,362 - telethon.network.mtprotosender - DEBUG - Handling container
2020-03-11 08:57:28,362 - telethon.network.mtprotosender - DEBUG - Handling new session created
2020-03-11 08:57:28,362 - telethon.network.mtprotosender - DEBUG - Handling acknowledge for [6802748226970848804]
2020-03-11 08:57:28,363 - telethon.network.mtprotosender - DEBUG - Receiving items from the network...
2020-03-11 08:57:28,370 - telethon.network.mtprotosender - DEBUG - Handling RPC result for message 6802748226970848804
2020-03-11 08:57:28,371 - telethon.network.mtprotosender - DEBUG - Receiving items from the network...
2020-03-11 08:57:28,371 - telethon.extensions.messagepacker - DEBUG - Assigned msg_id = 6802748227165755036 to GetStateRequest (7f9d8ac93f28)
2020-03-11 08:57:28,371 - telethon.network.mtprotosender - DEBUG - Encrypting 1 message(s) in 20 bytes for sending
2020-03-11 08:57:28,372 - telethon.network.mtprotosender - DEBUG - Encrypted messages put in a queue to be sent
2020-03-11 08:57:28,372 - telethon.network.mtprotosender - DEBUG - Waiting for messages to send...
2020-03-11 08:57:28,372 - telethon.extensions.messagepacker - DEBUG - Assigned msg_id = 6802748227167873148 to MsgsAck (7f9d8acb89b0)
2020-03-11 08:57:28,372 - telethon.network.mtprotosender - DEBUG - Encrypting 1 message(s) in 60 bytes for sending
2020-03-11 08:57:28,372 - telethon.network.mtprotosender - DEBUG - Encrypted messages put in a queue to be sent
2020-03-11 08:57:28,372 - telethon.network.mtprotosender - DEBUG - Waiting for messages to send...
2020-03-11 08:57:28,447 - telethon.network.mtprotosender - DEBUG - Handling RPC result for message 6802748227165755036
2020-03-11 08:57:28,447 - telethon.network.mtprotosender - DEBUG - Receiving items from the network...
2020-03-11 08:57:28,448 - telethon.extensions.messagepacker - DEBUG - Assigned msg_id = 6802748227471258884 to GetDialogsRequest (7f9d8acb82e8)
2020-03-11 08:57:28,448 - telethon.network.mtprotosender - DEBUG - Encrypting 1 message(s) in 44 bytes for sending
2020-03-11 08:57:28,448 - telethon.network.mtprotosender - DEBUG - Encrypted messages put in a queue to be sent
2020-03-11 08:57:28,448 - telethon.network.mtprotosender - DEBUG - Waiting for messages to send...
2020-03-11 08:57:28,448 - telethon.extensions.messagepacker - DEBUG - Assigned msg_id = 6802748227472847704 to MsgsAck (7f9d8acb8470)
2020-03-11 08:57:28,448 - telethon.network.mtprotosender - DEBUG - Encrypting 1 message(s) in 36 bytes for sending
2020-03-11 08:57:28,448 - telethon.network.mtprotosender - DEBUG - Encrypted messages put in a queue to be sent
2020-03-11 08:57:28,448 - telethon.network.mtprotosender - DEBUG - Waiting for messages to send...
2020-03-11 08:57:28,860 - telethon.network.mtprotosender - DEBUG - Handling RPC result for message 6802748227471258884
2020-03-11 08:57:28,889 - telethon.network.mtprotosender - DEBUG - Receiving items from the network...
Traceback (most recent call last):
File "forwardgram.py", line 49, in
start(config)
File "forwardgram.py", line 23, in start
if d.name in config["output_channel_names"]:
KeyError: 'output_channel_names'

Forwarding to more than one channel!

Hi!

First I'll like to thank you. It has worked perfectly for me. I had used other ways of achieving automatic forwarding, but finally this one is suitable for my needs.

I wanted to ask if it would be possible to forward to multiple or different channels, e.g. I'm part of 4 channels 1, 2, 3 & 4. And forward to two channels from which I'm an admin separating the sources:
Forwarded channel 1: Channels 1 & 2.
Forwarded channel 2: Channels 3 & 4.

I'm sure that can be achievable by making some modifications and maybe using some identifiers for the different channels, but I'm not pretty sure where to start.

Filter Type of Message

Hello, i want to know if is possible to filter the message and only send movies or photos with out text...
Thank you

limit per minute to the Forwarding

Hello, first of all, thanks for a good script. Could you please add a limit per minute to the Forwarding? Telegram will temporarily limit your account if you make more than 200 forwarding requests per minute. So I would like to perform delivery at less than 200 per minute, and I am wondering if there is any way. Thank you.

input_channel_names with emoji

Sorry I have another problem.
I am forwarding message from channel with names consist of emoji. At input_channel_names I use CLDR short name (something like :grinning_face_with_big_eyes: or :winking_face_with_tongue:)to represent emoji but look like it didn't work. Any suggestions are welcome, thanks!

[Feature Request] is it possible to have session file in custom folder

Hi,
The config.yml can be placed in any location and the path provided at runtime by specifying on the command line
python3 forwardgram.py mypath/config.yml

Is it possible to also provide the session file path also as a parameter to the program? something like below?
python3 forwardgram.py mypath/config.yml anotherpath/customsess.session

what is the password?

I tried to start it and they asked me for a password, I can’t figure out what the password is, additionally I still can’t write in this line
image

chat id of a bot

i want to forward messages from a channel to a bot but when i put bot chat id in output then it does not recognize it and gives a error

unacceptable character!

Hi, when i paste groups with names like: 💎Kingdom
It says: "Unacceptable character" if i try to use the @Channelname doesn't find anything
it's possible to bypass this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.