Closed HosseyNJF closed 4 years ago
Hello @HosseyNJF! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
django_telegrambot/apps.py
:Line 56:13: E265 block comment should start with '# ' Line 66:13: E265 block comment should start with '# ' Line 83:80: E501 line too long (92 > 79 characters) Line 88:80: E501 line too long (100 > 79 characters) Line 91:80: E501 line too long (112 > 79 characters) Line 98:5: E303 too many blank lines (2) Line 192:80: E501 line too long (196 > 79 characters) Line 192:193: E231 missing whitespace after ',' Line 195:80: E501 line too long (82 > 79 characters) Line 199:80: E501 line too long (135 > 79 characters) Line 200:80: E501 line too long (85 > 79 characters) Line 202:80: E501 line too long (107 > 79 characters) Line 203:80: E501 line too long (83 > 79 characters) Line 204:80: E501 line too long (91 > 79 characters) Line 206:80: E501 line too long (181 > 79 characters) Line 208:80: E501 line too long (112 > 79 characters) Line 210:80: E501 line too long (276 > 79 characters) Line 212:80: E501 line too long (94 > 79 characters) Line 230:80: E501 line too long (83 > 79 characters) Line 231:80: E501 line too long (117 > 79 characters) Line 239:80: E501 line too long (135 > 79 characters) Line 240:80: E501 line too long (85 > 79 characters) Line 241:80: E501 line too long (111 > 79 characters) Line 261:80: E501 line too long (100 > 79 characters) Line 263:80: E501 line too long (136 > 79 characters)
Thank you very much for contribution. I faced the Issue with changing bot names and/or tokens too, but I have to look at your ID approach and think about it before I'm going to merge it. The webhook setup delay was not a problem for me yet, but If the argument provides just an additional (and optional) feature, It's fine for me to add it too.
Yes, the DISABLE_SETUP is completely optional and none of my changes are breaking changes. The webhook problem appears when your production server is in a non-limited country but your local machine is located in a telegram-censored country like Iran, which makes the setWebhook command to timeout and wastes your time.
We neither have many useful tests nor I've time to test everything manually, so I'm going to merge this and we fix Issues as soon as they appear.
This PR will organize how this app stores bot data internally; adds an 'ID' attribute to each bot to identify bots with something other than username/token (this makes changing token and username bot easy without changes to the code).
This also adds the DISABLE_SETUP config option which disables setting webhook on each run, and it's useful when you're developing on your local machine and don't want to go through a 5-sec delay that setting webhook causes or when Telegram is blocked in your country.