René's URL Explorer Experiment


Title: Refactor handling of shortcut-bots · Issue #2505 · python-telegram-bot/python-telegram-bot · GitHub

Open Graph Title: Refactor handling of shortcut-bots · Issue #2505 · python-telegram-bot/python-telegram-bot

X Title: Refactor handling of shortcut-bots · Issue #2505 · python-telegram-bot/python-telegram-bot

Description: A bunch of TG-Objects have bot attribute that is used for the shortcuts, e.g. self.bot.send_message(…), which is dangerous in the rare edge cases where users manually instantiate those objects and forget to pass the bot. This will then l...

Open Graph Description: A bunch of TG-Objects have bot attribute that is used for the shortcuts, e.g. self.bot.send_message(…), which is dangerous in the rare edge cases where users manually instantiate those objects and ...

X Description: A bunch of TG-Objects have bot attribute that is used for the shortcuts, e.g. self.bot.send_message(…), which is dangerous in the rare edge cases where users manually instantiate those objects and ...

Opengraph URL: https://github.com/python-telegram-bot/python-telegram-bot/issues/2505

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Refactor handling of shortcut-bots","articleBody":"A bunch of TG-Objects have `bot` attribute that is used for the shortcuts, e.g. `self.bot.send_message(…)`, which is dangerous in the rare edge cases where users manually instantiate those objects and forget to pass the `bot`. This will then lead to somewhat unprecise error messages `NoneType has no attribute 'send_message'`.\r\nMoreover, `Message.bot` is undocumented, but not private, so people relying on auto-complete may be using it without knowing that it's not really intended for external use.\r\n\r\n## Proposal:\r\n\r\nDo something like\r\n\r\n```python\r\nTGObject:\r\n    self._bot: Optional[Bot] = None\r\n\r\n    def get_bot(self) -> Bot:\r\n        if self._bot is None:\r\n            raise RuntimeError('This object has no bot and shortcuts cant be used')\r\n        return self._bot\r\n\r\n    def set_bot(self, bot: Bot) -> None:\r\n        self._bot = bot\r\n```\r\n\r\nThis way we have helpful error messages without having to check `if self.bot is None` in every shortcut.\r\n\r\nAn alternate solution would be to make `TGObject.bot` a property that raises the error if `_bot is None`. But explicitly calling a method makes it more clear that something *could* go wrong, IMO.\r\n\r\n---\r\nNote: We briefly discussed this in dev-chat on 04-05-2021, see https://t.me/c/1494805131/15168","author":{"url":"https://github.com/Bibo-Joshi","@type":"Person","name":"Bibo-Joshi"},"datePublished":"2021-05-05T06:32:04Z","url":"https://github.com/python-telegram-bot/python-telegram-bot/issues/2505"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:7c60b415-c48e-a311-d528-3006c41533f9
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idED50:153FFA:D27FA4:1146199:6B02755F
html-safe-nonce27833498eaae0f5c67e69fa550987d5457f4da4f96e98ad184c93170c76402eb
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRDUwOjE1M0ZGQTpEMjdGQTQ6MTE0NjE5OTo2QjAyNzU1RiIsInZpc2l0b3JfaWQiOiI2ODQ2NjA5OTU4MjE0MjAyNzIwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacfc9db2dfa5f1268227f77c8ac2f2a50800869dfbdf0d87f4a469e0a5e47baa9a
hovercard-subject-tagissue:876108931
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-telegram-bot/python-telegram-bot/2505/issue_layout
twitter:imagehttps://opengraph.githubassets.com/4a5eeb461c681cf6e5a5087bb21b993dc8c9a365d0fea10462e335585c47e5f2/python-telegram-bot/python-telegram-bot/issues/2505
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/4a5eeb461c681cf6e5a5087bb21b993dc8c9a365d0fea10462e335585c47e5f2/python-telegram-bot/python-telegram-bot/issues/2505
og:image:altA bunch of TG-Objects have bot attribute that is used for the shortcuts, e.g. self.bot.send_message(…), which is dangerous in the rare edge cases where users manually instantiate those objects and ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameBibo-Joshi
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
go-importgithub.com/python-telegram-bot/python-telegram-bot git https://github.com/python-telegram-bot/python-telegram-bot.git
octolytics-dimension-user_id16178365
octolytics-dimension-user_loginpython-telegram-bot
octolytics-dimension-repository_id38696925
octolytics-dimension-repository_nwopython-telegram-bot/python-telegram-bot
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id38696925
octolytics-dimension-repository_network_root_nwopython-telegram-bot/python-telegram-bot
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python-telegram-bot/python-telegram-bot/issues/2505#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-telegram-bot%2Fpython-telegram-bot%2Fissues%2F2505
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-telegram-bot%2Fpython-telegram-bot%2Fissues%2F2505
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python-telegram-bot%2Fpython-telegram-bot
Reloadhttps://github.com/python-telegram-bot/python-telegram-bot/issues/2505
Reloadhttps://github.com/python-telegram-bot/python-telegram-bot/issues/2505
Reloadhttps://github.com/python-telegram-bot/python-telegram-bot/issues/2505
python-telegram-bothttps://github.com/python-telegram-bot
python-telegram-bothttps://github.com/python-telegram-bot/python-telegram-bot
Codehttps://github.com/python-telegram-bot/python-telegram-bot
Issues23 (23)https://github.com/python-telegram-bot/python-telegram-bot/issues
Pull requests19 (19)https://github.com/python-telegram-bot/python-telegram-bot/pulls
Discussionshttps://github.com/python-telegram-bot/python-telegram-bot/discussions
Actionshttps://github.com/python-telegram-bot/python-telegram-bot/actions
Projectshttps://github.com/python-telegram-bot/python-telegram-bot/projects
Wikihttps://github.com/python-telegram-bot/python-telegram-bot/wiki
Security and qualityhttps://github.com/python-telegram-bot/python-telegram-bot/security
Insightshttps://github.com/python-telegram-bot/python-telegram-bot/insights
https://github.com/python-telegram-bot/python-telegram-bot
New issuehttps://github.com/login?return_to=https://github.com/python-telegram-bot/python-telegram-bot/issues/2505
New issuehttps://github.com/login?return_to=https://github.com/python-telegram-bot/python-telegram-bot/issues/2505
Refactor handling of shortcut-botshttps://github.com/python-telegram-bot/python-telegram-bot/issues/2505#top
https://github.com/zpavloudis
ℹ️ good-first-issueinformation: good-first-issuehttps://github.com/python-telegram-bot/python-telegram-bot/issues?q=state%3Aopen%20label%3A%22%E2%84%B9%EF%B8%8F%20good-first-issue%22
🛠 breakingchange type: breakinghttps://github.com/python-telegram-bot/python-telegram-bot/issues?q=state%3Aopen%20label%3A%22%F0%9F%9B%A0%20breaking%22
🛠 refactorchange type: refactorhttps://github.com/python-telegram-bot/python-telegram-bot/issues?q=state%3Aopen%20label%3A%22%F0%9F%9B%A0%20refactor%22
v20.0a0https://github.com/python-telegram-bot/python-telegram-bot/milestone/22
https://github.com/Bibo-Joshi
Bibo-Joshihttps://github.com/Bibo-Joshi
on May 5, 2021https://github.com/python-telegram-bot/python-telegram-bot/issues/2505#issue-876108931
https://t.me/c/1494805131/15168https://t.me/c/1494805131/15168
Bibo-Joshihttps://github.com/Bibo-Joshi
🛠 refactorchange type: refactorhttps://github.com/python-telegram-bot/python-telegram-bot/issues?q=state%3Aopen%20label%3A%22%F0%9F%9B%A0%20refactor%22
🛠 breakingchange type: breakinghttps://github.com/python-telegram-bot/python-telegram-bot/issues?q=state%3Aopen%20label%3A%22%F0%9F%9B%A0%20breaking%22
on May 5, 2021https://github.com/python-telegram-bot/python-telegram-bot/issues/2505#event-4687028826
Bibo-Joshihttps://github.com/Bibo-Joshi
v14https://github.com/python-telegram-bot/python-telegram-bot/milestone/22
on May 5, 2021https://github.com/python-telegram-bot/python-telegram-bot/issues/2505#event-4687028837
https://github.com/Poolitzer
Poolitzerhttps://github.com/Poolitzer
on May 5, 2021https://github.com/python-telegram-bot/python-telegram-bot/issues/2505#issuecomment-832490888
https://github.com/Bibo-Joshi
Bibo-Joshihttps://github.com/Bibo-Joshi
on May 5, 2021https://github.com/python-telegram-bot/python-telegram-bot/issues/2505#issuecomment-832501426
https://github.com/Poolitzer
Poolitzerhttps://github.com/Poolitzer
on May 5, 2021https://github.com/python-telegram-bot/python-telegram-bot/issues/2505#issuecomment-832505086
https://github.com/Bibo-Joshi
Bibo-Joshihttps://github.com/Bibo-Joshi
on May 5, 2021https://github.com/python-telegram-bot/python-telegram-bot/issues/2505#issuecomment-832514820
Bibo-Joshihttps://github.com/Bibo-Joshi
ℹ️ good-first-issueinformation: good-first-issuehttps://github.com/python-telegram-bot/python-telegram-bot/issues?q=state%3Aopen%20label%3A%22%E2%84%B9%EF%B8%8F%20good-first-issue%22
hacktoberfesthttps://github.com/python-telegram-bot/python-telegram-bot/issues?q=state%3Aopen%20label%3A%22hacktoberfest%22
on Sep 17, 2021https://github.com/python-telegram-bot/python-telegram-bot/issues/2505#event-5320310537
https://github.com/zpavloudis
zpavloudishttps://github.com/zpavloudis
on Oct 5, 2021https://github.com/python-telegram-bot/python-telegram-bot/issues/2505#issuecomment-934616655
@Poolitzerhttps://github.com/Poolitzer
zpavloudis/python-telegram-bot/commit/b980e7https://github.com/zpavloudis/python-telegram-bot/commit/b980e7c84aaff9fa62d0f22ede6e72a5207f7e94
https://github.com/Bibo-Joshi
Bibo-Joshihttps://github.com/Bibo-Joshi
on Oct 5, 2021https://github.com/python-telegram-bot/python-telegram-bot/issues/2505#issuecomment-934653789
this linehttps://github.com/zpavloudis/python-telegram-bot/blob/b980e7c84aaff9fa62d0f22ede6e72a5207f7e94/telegram/message.py#L550
this linehttps://github.com/zpavloudis/python-telegram-bot/blob/b980e7c84aaff9fa62d0f22ede6e72a5207f7e94/tests/test_message.py#L1169
herehttps://github.com/python-telegram-bot/python-telegram-bot/blob/bc7c422a11a60a3064601aac3fd5a26fd9b45ae9/tests/test_message.py#L240
https://github.com/zpavloudis
zpavloudishttps://github.com/zpavloudis
on Oct 6, 2021https://github.com/python-telegram-bot/python-telegram-bot/issues/2505#issuecomment-937308236
@Bibo-Joshihttps://github.com/Bibo-Joshi
herehttps://github.com/zpavloudis/python-telegram-bot/commit/2ca1530904cfcf274e28f2ba45c6029ae9c329fc
thishttps://github.com/zpavloudis/python-telegram-bot/commit/2ca1530904cfcf274e28f2ba45c6029ae9c329fc#diff-be3d7005552140cd68194b1935e34cd461f3d7a3fdfa5a435bac1f9bfa83ae05L732
https://github.com/Bibo-Joshi
Bibo-Joshihttps://github.com/Bibo-Joshi
on Oct 7, 2021https://github.com/python-telegram-bot/python-telegram-bot/issues/2505#issuecomment-937502593
https://github.com/zpavloudis
zpavloudishttps://github.com/zpavloudis
on Oct 7, 2021https://github.com/python-telegram-bot/python-telegram-bot/issues/2505#issuecomment-937584042
Bibo-Joshihttps://github.com/Bibo-Joshi
zpavloudishttps://github.com/zpavloudis
on Oct 7, 2021https://github.com/python-telegram-bot/python-telegram-bot/issues/2505#event-5427200600
https://github.com/Bibo-Joshi
Bibo-Joshihttps://github.com/Bibo-Joshi
on Oct 7, 2021https://github.com/python-telegram-bot/python-telegram-bot/issues/2505#issuecomment-937619375
Bibo-Joshihttps://github.com/Bibo-Joshi
completedhttps://github.com/python-telegram-bot/python-telegram-bot/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Oct 21, 2021https://github.com/python-telegram-bot/python-telegram-bot/issues/2505#event-5497115046
github-actionshttps://github.com/apps/github-actions
on Oct 22, 2021https://github.com/python-telegram-bot/python-telegram-bot/issues/2505#event-5506329605
Sign up for freehttps://github.com/signup?return_to=https://github.com/python-telegram-bot/python-telegram-bot/issues/2505
Sign in to commenthttps://github.com/login?return_to=https://github.com/python-telegram-bot/python-telegram-bot/issues/2505
zpavloudishttps://github.com/zpavloudis
ℹ️ good-first-issueinformation: good-first-issuehttps://github.com/python-telegram-bot/python-telegram-bot/issues?q=state%3Aopen%20label%3A%22%E2%84%B9%EF%B8%8F%20good-first-issue%22
🛠 breakingchange type: breakinghttps://github.com/python-telegram-bot/python-telegram-bot/issues?q=state%3Aopen%20label%3A%22%F0%9F%9B%A0%20breaking%22
🛠 refactorchange type: refactorhttps://github.com/python-telegram-bot/python-telegram-bot/issues?q=state%3Aopen%20label%3A%22%F0%9F%9B%A0%20refactor%22
v20.0a0https://github.com/python-telegram-bot/python-telegram-bot/milestone/22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.