Topic - Friendship Events
Description
This topic can be used to monitor changes to the friendship state of a specified user with others.
Possible friendship changes include:
- Requested
- Rejected
- Accepted
- Removed
- and self variants (i.e. when this account itself is responsible for the change rather than the other entity)
With all undocumented topics, use at your own risk.
danger
Twitch removed the friendship (and, by extension, presence) system in May 2022. As such, this topic is no longer usable.
Method Definition
Name | Type | Description |
---|---|---|
credential | OAuth2Credential | User Auth Token for the target user id, with the scope user_friends_read |
userId | String | Target User Id |
Code-Snippets
Subscribe to friendship events for user twitch4j and register a listener that prints all messages to console
- Java
- Kotlin
- Groovy
twitchClient.getPubSub().listenForFriendshipEvents(credential, "149223493");
twitchClient.getEventManager().onEvent(FriendshipEvent.class, System.out::println);
twitchClient.pubSub.listenForFriendshipEvents(credential, "149223493");
twitchClient.eventManager.onEvent(FriendshipEvent::class.java, System.out::println)
twitchClient.pubSub.listenForFriendshipEvents(credential, "149223493");
twitchClient.eventManager.onEvent(FriendshipEvent, System.out::println)