@@ -368,6 +368,8 @@ async def fetch_bans(self, token: str, userids: List[Union[str, int]] = None) ->
368368 async def fetch_ban_events (self , token : str , userids : List [int ] = None ):
369369 """|coro|
370370
371+ This has been deprecated and will be removed in a future release.
372+
371373 Fetches ban/unban events from the User's channel.
372374
373375 Parameters
@@ -1301,6 +1303,128 @@ async def cancel_raid(self, token: str):
13011303
13021304 await self ._http .delete_raid (broadcaster_id = str (self .id ), token = token )
13031305
1306+ async def ban_user (self , token : str , moderator_id : int , user_id , reason : str ):
1307+ """|coro|
1308+
1309+ Bans a user from the channel/broadcaster.
1310+
1311+ Parameters
1312+ -----------
1313+ token: :class:`str`
1314+ An oauth user access token with the ``moderator:manage:banned_users`` scope
1315+ moderator_id: :class:`int`
1316+ The ID of a user that has permission to moderate the broadcaster's chat room.
1317+ If the broadcaster wants to ban the user set this parameter to the broadcaster's ID.
1318+ user_id: :class:`int`
1319+ The ID of the user to ban.
1320+ reason: :class:`str`
1321+ The reason for the ban.
1322+
1323+ Returns
1324+ --------
1325+ :class:`twitchio.Ban`
1326+ """
1327+ from .models import Ban
1328+
1329+ data = await self ._http .post_ban_timeout_user (
1330+ broadcaster_id = str (self .id ),
1331+ moderator_id = str (moderator_id ),
1332+ user_id = str (user_id ),
1333+ reason = reason ,
1334+ token = token ,
1335+ )
1336+ return Ban (self ._http , data [0 ])
1337+
1338+ async def timeout_user (self , token : str , moderator_id : int , user_id : int , duration : int , reason : str ):
1339+ """|coro|
1340+
1341+ Timeouts a user from the channel/broadcaster.
1342+
1343+ Parameters
1344+ -----------
1345+ token: :class:`str`
1346+ An oauth user access token with the ``moderator:manage:banned_users`` scope
1347+ moderator_id: :class:`int`
1348+ The ID of a user that has permission to moderate the broadcaster's chat room.
1349+ If the broadcaster wants to timeout the user set this parameter to the broadcaster's ID.
1350+ duration: :class:`int`
1351+ The duration of the timeout in seconds.
1352+ The minimum timeout is 1 second and the maximum is 1,209,600 seconds (2 weeks).
1353+ To end a user's timeout early, set this field to 1, or send an Unban user request.
1354+ reason: :class:`str`
1355+ The reason for the timeout.
1356+
1357+ Returns
1358+ --------
1359+ :class:`twitchio.Timeout`
1360+ """
1361+ from .models import Timeout
1362+
1363+ data = await self ._http .post_ban_timeout_user (
1364+ broadcaster_id = str (self .id ),
1365+ moderator_id = str (moderator_id ),
1366+ user_id = str (user_id ),
1367+ duration = duration ,
1368+ reason = reason ,
1369+ token = token ,
1370+ )
1371+ return Timeout (self ._http , data [0 ])
1372+
1373+ async def unban_user (self , token : str , moderator_id : int , user_id ):
1374+ """|coro|
1375+
1376+ Unbans a user or removes a timeout from the channel/broadcaster.
1377+
1378+ Parameters
1379+ -----------
1380+ token: :class:`str`
1381+ An oauth user access token with the ``moderator:manage:banned_users`` scope
1382+ moderator_id: :class:`int`
1383+ The ID of a user that has permission to moderate the broadcaster's chat room.
1384+ If the broadcaster wants to ban the user set this parameter to the broadcaster's ID.
1385+ user_id: :class:`int`
1386+ The ID of the user to unban.
1387+
1388+ Returns
1389+ --------
1390+ None
1391+ """
1392+
1393+ await self ._http .delete_ban_timeout_user (
1394+ broadcaster_id = str (self .id ),
1395+ moderator_id = str (moderator_id ),
1396+ user_id = str (user_id ),
1397+ token = token ,
1398+ )
1399+
1400+ async def send_whisper (self , token : str , user_id : int , message : str ):
1401+ """|coro|
1402+
1403+ Sends a whisper to a user.
1404+ Important Notes:
1405+ - The user sending the whisper must have a verified phone number.
1406+ - The API may silently drop whispers that it suspects of violating Twitch policies.
1407+ - You may whisper to a maximum of 40 unique recipients per day. Within the per day limit.
1408+ - You may whisper a maximum of 3 whispers per second and a maximum of 100 whispers per minute.
1409+
1410+ Parameters
1411+ -----------
1412+ token: :class:`str`
1413+ An oauth user token with the ``user:manage:whispers`` scope.
1414+ user_id: :class:`int`
1415+ The ID of the user to send the whisper to.
1416+ message: :class:`str`
1417+ The message to send.
1418+ 500 characters if the user you're sending the message to hasn't whispered you before.
1419+ 10,000 characters if the user you're sending the message to has whispered you before.
1420+
1421+ Returns
1422+ --------
1423+ None
1424+ """
1425+
1426+ await self ._http .post_whisper (token = token , from_user_id = str (self .id ), to_user_id = str (user_id ), message = message )
1427+
13041428
13051429class BitLeaderboardUser (PartialUser ):
13061430
0 commit comments