Skip to content

Commit b10265a

Browse files
committed
Add User.shoutout method
Add User.shoutout method
1 parent 93f56d5 commit b10265a

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

twitchio/http.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,3 +1122,11 @@ async def put_shield_mode_status(self, token: str, broadcaster_id: str, moderato
11221122

11231123
async def get_followed_streams(self, broadcaster_id: str, token: str):
11241124
return await self.request(Route("GET", "streams/followed", query=[("user_id", broadcaster_id)], token=token))
1125+
1126+
async def post_shoutout(self, token: str, broadcaster_id: str, moderator_id: str, to_broadcaster_id: str):
1127+
q = [
1128+
("from_broadcaster_id", broadcaster_id),
1129+
("moderator_id", moderator_id),
1130+
("to_broadcaster_id", to_broadcaster_id),
1131+
]
1132+
return await self.request(Route("POST", "chat/shoutouts", query=q, token=token))

twitchio/user.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,6 +1573,33 @@ async def fetch_followed_streams(self, token: str):
15731573

15741574
return [Stream(self._http, x) for x in data]
15751575

1576+
async def shoutout(self, token: str, to_broadcaster_id: int, moderator_id: int):
1577+
"""|coro|
1578+
Sends a Shoutout to the specified broadcaster.
1579+
``Rate Limits``: The broadcaster may send a Shoutout once every 2 minutes. They may send the same broadcaster a Shoutout once every 60 minutes.
1580+
Requires a user access token that includes the ``moderator:manage:shoutouts`` scope.
1581+
1582+
Parameters
1583+
-----------
1584+
token: :class:`str`
1585+
An oauth user token with the ``moderator:manage:shoutouts``scope.
1586+
to_broadcaster: :class:`int`
1587+
The ID of the broadcaster that is recieving the shoutout.
1588+
moderator_id: :class:`int`
1589+
The ID of the broadcaster or a user that is one of the broadcaster's moderators. This ID must match the user ID in the access token.
1590+
1591+
Returns
1592+
--------
1593+
None
1594+
"""
1595+
1596+
await self._http.post_shoutout(
1597+
token=token,
1598+
broadcaster_id=str(self.id),
1599+
to_broadcaster_id=str(to_broadcaster_id),
1600+
moderator_id=str(moderator_id),
1601+
)
1602+
15761603

15771604
class BitLeaderboardUser(PartialUser):
15781605

0 commit comments

Comments
 (0)