Skip to content

Commit e6c6e68

Browse files
committed
Add Chatter.id as public property
Add Chatter.id as public property
1 parent eb4808f commit e6c6e68

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

docs/changelog.rst

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Master
55
- TwitchIO
66
- Bug fixes
77
- Fix :func:`~twitchio.Client.search_categories` due to :attr:`~twitchio.Game.igdb_id` being added to :class:`~twitchio.Game`
8+
- Made Chatter :attr:`~twitchio.Chatter.id` property public
89

910
2.6.0
1011
======

twitchio/chatter.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class Chatter(PartialChatter):
9595
"_badges",
9696
"_cached_badges",
9797
"_ws",
98-
"id",
98+
"_id",
9999
"_turbo",
100100
"_sub",
101101
"_mod",
@@ -113,7 +113,7 @@ def __init__(self, websocket: "WSConnection", **kwargs):
113113
self._cached_badges: Optional[Dict[str, str]] = None
114114

115115
if not self._tags:
116-
self.id = None
116+
self._id = None
117117
self._badges = None
118118
self._turbo = None
119119
self._sub = None
@@ -123,7 +123,7 @@ def __init__(self, websocket: "WSConnection", **kwargs):
123123
self._vip = None
124124
return
125125

126-
self.id = self._tags.get("user-id")
126+
self._id = int(self._tags.get("user-id"))
127127
self._badges = self._tags.get("badges")
128128
self._turbo = self._tags.get("turbo")
129129
self._sub = int(self._tags["subscriber"])
@@ -158,9 +158,14 @@ def badges(self) -> dict:
158158

159159
@property
160160
def display_name(self) -> str:
161-
"""The users display name."""
161+
"""The user's display name."""
162162
return self._display_name
163163

164+
@property
165+
def id(self) -> int:
166+
"""The user's id."""
167+
return self._id
168+
164169
@property
165170
def mention(self) -> str:
166171
"""Mentions the users display name by prefixing it with '@'"""

0 commit comments

Comments
 (0)