Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

Commit 5387243

Browse files
committed
Added flags for if a tweet is a retweet or a reply
1 parent d84542f commit 5387243

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

IreneAPIWrapper/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
__title__ = "IreneAPIWrapper"
44
__author__ = "MujyKun"
55
__license__ = "MIT"
6-
__version__ = "2.3"
6+
__version__ = "2.3.1"

IreneAPIWrapper/models/tweet.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@ def __init__(self, *args, **kwargs):
1414
self.id = args[0]
1515
self.text = args[1]
1616

17+
@property
18+
def is_retweet(self) -> bool:
19+
"""Whether the tweet is a retweet."""
20+
return self.text and self.text[:2] == 'RT'
21+
22+
@property
23+
def is_reply(self) -> bool:
24+
"""
25+
Whether the tweet is a reply (sometimes)
26+
27+
..Note:: Twitter sucks and doesn't let us know if it's a reply, so here we are filtering by if the user @ed
28+
someone at the start of their tweet...
29+
"""
30+
return self.text and self.text[:1] == '@'
31+
1732
def __eq__(self, other):
1833
return self.id == other.id
1934

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "IreneAPIWrapper"
3-
version = "2.3"
3+
version = "2.3.1"
44
description = "The Wrapper for the Websocket and REST API of Irene."
55
authors = ["MujyKun <[email protected]>"]
66
classifiers = [

0 commit comments

Comments
 (0)