Skip to content

$(user)

TwitchKick
Syntax
$(user [username])
Arguments
Optional

The $(user) variable in StreamElements Chatbot allows you to access and display various user-related information in your chat messages and commands. These variables provide data such as usernames, loyalty points, ranks, and activity timestamps.

!command add !watchtime $(user) has been watching the stream for $(user.time_online) and is rank $(user.time_online_rank) on the leaderboard
Example chat
ViewerName:!watchtime
partner badgemoderator badgeStreamElements:ViewerName has been watching the stream for 2 hours 30 mins and is rank 5/283 on the leaderboard

To use the $(user) variable, include it in your chat message or command response using the $() syntax. For example, $(user) will display the user’s display name.

  • Without argument: $(user) refers to the first username typed after the command, or the command sender if none was given
  • With argument: $(user username) refers to the specified user

Every variable below accepts the same optional username argument, e.g. $(user.points ModUser).

Variable Description Notes
$(user) User’s display name
$(user.name) User’s login name in lowercase letters This is the account’s login name, not the display name
$(user.twitchid) User’s platform user ID
$(user.points) User’s loyalty currency owned
$(user.points_rank) User’s rank on the loyalty currency leaderboard Returned as rank/total, e.g. 5/283; <error> if the lookup fails
$(user.points_alltime_rank) User’s rank on the all-time loyalty currency leaderboard Returned as rank/total, e.g. 5/283; <error> if the lookup fails
$(user.level) User’s access level as a number See access levels below
$(user.lastmessage) User’s last typed message in the chat Outputs a single space if no message is stored
$(user.lastseen) Time since the user was most recently seen in the viewer list or chat Returned as a duration, e.g. 5 mins 30 secs; <not found> if never recorded
$(user.lastactive) Time since the user most recently typed a message in the chat Returned as a duration, e.g. 5 mins 30 secs; <not found> if never recorded
$(user.time_online) The user’s total watchtime — time spent watching the stream Returned as a duration, e.g. 2 hours 30 mins
$(user.time_online_rank) User’s rank on the leaderboard for online time watched Returned as rank/total, e.g. 5/283; <error> if the lookup fails
$(user.time_offline) Total time the user has spent in chat while the stream is offline Returned as a duration, e.g. 2 hours 30 mins
$(user.time_offline_rank) User’s rank on the leaderboard for offline time watched Returned as rank/total, e.g. 5/283; <error> if the lookup fails

Durations are written out in full words: secs, mins, hours, days, months, and years — for example 1 day 4 hours or 27 mins 16 secs. Smaller units are dropped as larger ones appear.

$(user.level) returns the user’s access level as a number:

Level Role
100 Everyone
250 Subscriber
300 Regular
400 VIP
500 Moderator
1000 Super Moderator
1500 Broadcaster

Querying another user by name

$(user ModUser) was last seen $(user.lastseen ModUser) ago and last typed: $(user.lastmessage ModUser)
Example chat
partner badgemoderator badgeStreamElements:ModUser was last seen 5 mins 30 secs ago and last typed: Hello everyone!

A points command that lets viewers check anyone’s balance

!command add !points $(user) has $(user.points) points and is rank $(user.points_rank) on the leaderboard
Example chat
ViewerName:!points ModUser
partner badgemoderator badgeStreamElements:ModUser has 100 points and is rank 5/283 on the leaderboard
  • $(sender): Information specifically about the command sender.