A Twitter plugin for Sopel
Project description
sopel-twitter
A Twitter plugin for Sopel.
Installation
Releases are hosted on PyPI, so after installing Sopel, all you need is pip:
$ pip install sopel-twitter
If you want to use the development version, simply clone the repository and use
pip install path/to/sopel-twitter
Newer library versions
sopel-twitter relies on a third-party library to access data,
which does not always publish its latest code to PyPI. If you run into problems
with this plugin, install the latest library code and
see if that solves your issue.
Please also feel free to submit pull requests updating this plugin's version constraints if you have tested a newer library release than what is currently allowed. Thanks for your help!
Configuring
Twitter account required to use this plugin as of 1 July 2023. You probably want to minimize the potential impact of adverse action by using a throwaway login instead of your real profile. New accounts can (as of 19 July 2023) be verified using only an email address.
The easiest way to configure sopel-twitter is via Sopel's configuration
wizard – simply run sopel-plugins configure twitter and enter the values
for which it prompts you.
Otherwise, you can edit your bot's configuration file:
[twitter]
username = mybotaccount
password = s3cretb0tp@ss
# Both Required
show_quoted_tweets = True
# Optional: For quote-tweets, send a second message showing the quoted tweet?
# Default: True
alternate_domains =
fxtwitter.com
vxtwitter.com
nitter.net
# Optional: What other domains should we treat like twitter domains?
# Default: fxtwitter.com, vxtwitter.com, nitter.net
Important housekeeping notes
The library this plugin uses for Twitter data access previously stored its
login session data in the current working directory. For Sopel, that was
the directory from which the sopel command was run.
As of sopel-twitter 1.3.1, a newer library version became available with
support for storing session data in Sopel's homedir instead. You can clean
up the old session files left behind by sopel-twitter 1.3.0 by running e.g.
find / -type f -name 'sopel-twitter*.json' 2>/dev/null. (Running find on
/ tends to output numerous "Permission denied" errors, so suppressing stderr
is recommended.)
Prior to the release of sopel-twitter 1.3.2, the session data filename changed
upstream from .json to .tw_session. This plugin will attempt to rename the
old session file if it exists, but if that fails you might want to clean up the
leftover config_name.sopel-twitter.json file.
Usage
Just send a link to a tweet or profile!
You can also retrieve a user's info with the .twitinfo command:
< Wiz> .twitinfo NASA
< Sopel> [Twitter] NASA (@NASA) ✔️ | Pale Blue Dot | http://www.nasa.gov/
| 204 friends, 46,602,251 followers | 65,377 tweets, 13,040 ♥s
| Joined: 2007-12-19 - 20:20:32UTC | There's space for everybody. ✨
Changelog
1.4.0
Changed:
- Updated
tweety-nslibrary to 2.x (#70) - Require Sopel 8
- Require Python 3.9+; tweety's code raises errors on 3.8 even though Sopel 8 still supports it
Meta:
- Updated packaging & upload workflow
- Cleaned up unused imports & Python 2 era cruft
- Updated plugin file header (licensing)
- Reformatted changelog with cleaner headings and an actual entry for 0.1.0
1.3.9
Fixed:
- Regression that removed "Quoting" indicator from quoted tweets (#67)
- Poor setup logic that did not correctly handle expired login sessions (#68)
1.3.8
Added:
- Handle more exception types when fetching tweets (#66)
Changed:
- Upgrade minimum
tweety-nsversion to 1.1.4 (#65) - Check public session state property instead of internal value (#65)
1.3.7
Added:
- Gracefully truncate long tweet text (#61)
Changed:
- Upgrade to newer
tweety-nslibrary: 1.1.* >= 1.1.2 (#63)
Meta:
- Add automatic package publishing
- Clean up unused source files
1.3.6
Added:
- Handle
fixvx.comlinks by default (#60) - Better documentation about keeping the upstream library updated
1.3.5
Changed:
- Upgrade to newer
tweety-nslibrary: any 1.0.* version (#59)
1.3.4
Fixed:
- Handle
intfields ofUserthat can beNone, again (#57)
1.3.3
Added:
- Handle
x.comlinks (#55)
Fixed:
- Handle
intfields ofUserthat can beNone(#54) - Correctly escape extra domains when lazily building URL patterns (#56)
1.3.2
Changed:
- Use updated
tweety-ns0.9.9 with updated session storage filename (#53).jsonhas become.tw_sessionsopel-twitterwill automatically rename the old.jsonfile(s) if present, unless the correspondingtw_sessionfile already exists (i.e.tweety-nswas updated prior to installingsopel-twitter1.3.2)
Fixed:
- Handle new
ActionRequiredexception type (#53)- Just a graceful failure message, for now; open an issue if you actually run into this, to help gauge how important more comprehensive handling might be.
1.3.1
Changed:
- Use updated
tweety-nswith option to specify session JSON storage location (#51)- Now stored in Sopel's
homedir - See README for shell commands suggested for cleaning up the old ones
- Now stored in Sopel's
Fixed:
- Handle new
DeniedLoginexception (#52)
1.3.0
Breaking:
- Login with username/password is now required
- Creating a throwaway Twitter account is recommended
Changed:
- Updated to
tweety-ns0.9 (#50)
1.2.0
Breaking:
- Twitter cookies are now required
Changed:
- Updated to
tweety-ns0.8 (#48)
1.1.0
Changed:
- Updated to
tweety-ns0.7, including revamped exceptions (#46)
1.0.1
Fixed:
- Don't cache Tweety object; it stops working after some hours (#43)
1.0.0
Important: Package name is now sopel-twitter
Added:
- Option to specify additional domains that can be treated as Twitter links (#34, #37)
Changed:
- Use
BooleanAttributesetting type where appropriate (#27) - Use future-proof
plugindecorators (#30) - Migrate from namespace package to entry point (#41)
- Migrate to Tweety library for data access; no more API keys (#42)
- Minimum Sopel version raised to 7.1 (#27)
Fixed:
/i/web/statuslinks (#33)- Collapse consecutive newlines (#36)
- Properly set up logger (#38)
0.4.1
Fixed:
- Detecting user profile links with trailing slash or query params (#28)
- Error when quoted tweet has been deleted (#31)
0.4.0
Added:
.twitinfocommand for user lookup (#20)- Support for mobile links (#21)
Changed:
- Updated documentation for configuration (#25) and setup of Twitter API account
Fixed:
- Media link output when quoted tweets are involved (#24)
0.3.2
Fixed:
- Regression in profile link handling (#16)
0.3.1
Fixed:
- Stricter
/i/URL matching (#15)
0.3.0
Changed:
- Tweet output includes a timestamp now (#13)
- Improved media link handling (#5, #12)
Added:
- Handling for profile/user links (#7)
- Handling for less common
/i/web/statusstyle links (#11)
Fixed:
- Decode HTML entities before output (#14)
0.2.1
Fixed:
- Some quoted tweets would cause
KeyError: 'text'(#9)
0.2.0
Changed:
- Now requires Sopel 7.x (#8)
- Newlines in tweet text will be replaced with a carriage return symbol, to indicate author intention (#4)
Added:
- Handling of 280-character tweets (#4)
- More graceful handling of API errors (#6)
Meta:
- Package metadata updated (new maintainer, HTTPS links)
0.1.2
Added:
- Tweet link handling
0.1.1
Fixed:
- Unicode on Python 3
0.1.0
Initial release, dated November 5, 2016.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sopel_twitter-1.4.0.tar.gz.
File metadata
- Download URL: sopel_twitter-1.4.0.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
553362e1fe07698115ccaeec79d769d0c098cb92eb304a1feae7bed1655ae254
|
|
| MD5 |
c8190a286d3815ac481cda6fe7bd5f59
|
|
| BLAKE2b-256 |
f8111f842f1b60cd5780c9697f6e60ec615cc65cd0a2540ef85a8b99e5b9e861
|
Provenance
The following attestation bundles were made for sopel_twitter-1.4.0.tar.gz:
Publisher:
trusted-publishing.yml on sopel-irc/sopel-twitter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sopel_twitter-1.4.0.tar.gz -
Subject digest:
553362e1fe07698115ccaeec79d769d0c098cb92eb304a1feae7bed1655ae254 - Sigstore transparency entry: 201116513
- Sigstore integration time:
-
Permalink:
sopel-irc/sopel-twitter@3650ee3d52ed08628dd62a310696d823a01325a8 -
Branch / Tag:
refs/tags/v1.4.0 - Owner: https://github.com/sopel-irc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
trusted-publishing.yml@3650ee3d52ed08628dd62a310696d823a01325a8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file sopel_twitter-1.4.0-py3-none-any.whl.
File metadata
- Download URL: sopel_twitter-1.4.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c415b5da81cf18581669b4e305951decb906dba38c00c1c8732748b87bc6d3d7
|
|
| MD5 |
90863a170fcac9c3e3856e8d15b9e261
|
|
| BLAKE2b-256 |
b47fd5cddb992675175d6e8f5143fb5f51f22c93086ece6283b019a1e96c1c26
|
Provenance
The following attestation bundles were made for sopel_twitter-1.4.0-py3-none-any.whl:
Publisher:
trusted-publishing.yml on sopel-irc/sopel-twitter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sopel_twitter-1.4.0-py3-none-any.whl -
Subject digest:
c415b5da81cf18581669b4e305951decb906dba38c00c1c8732748b87bc6d3d7 - Sigstore transparency entry: 201116516
- Sigstore integration time:
-
Permalink:
sopel-irc/sopel-twitter@3650ee3d52ed08628dd62a310696d823a01325a8 -
Branch / Tag:
refs/tags/v1.4.0 - Owner: https://github.com/sopel-irc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
trusted-publishing.yml@3650ee3d52ed08628dd62a310696d823a01325a8 -
Trigger Event:
release
-
Statement type: