Get Started - Learn How To Make Your Bot!
List of all currently Free Items
Added on version 23.1.0b14
get_users(self, starts_after: str = "", ends_before: str = "", sort_order: SORT_OPTION = "desc", limit: int = 20, username: str = "",) -> GetPublicUsersResponse:
Fetch a list of users, can be filtered, ordered, and paginated.
Parameters:
username
: The username you wish to search for. This will filter the results to only users who match the specified username.sort_order
: Determines the order in which results are returned. Can be either asc
for ascending order or desc
for descending order.starts_after
: The ID of the user from which to start the query. This is useful for paginating results.ends_before
: The ID of the user to end the query before. This is also useful for paginating results.limit
: The maximum number of users you want to retrieve per request.Returns:
GetPublicUsersResponse
: A list of public data of users.A simple example is that, when a user joins the room, you can make the bot print on the terminal the profile for the first 3 letters in the user’s name.
async def on_user_join(self, user: User) -> None:
three_letters = user.username[:3]
response = await self.webapi.get_users(username = three_letters,
limit = 3,
sort_order = "asc",
starts_after = None,
ends_before = None)
print(response)
Response:
GetPublicUsersResponse(
users=[
UserBasic(
user_id="55b00250296db2db1a006a65",
joined_at="None",
username="Its",
last_connect_at="2015-07-23T20:25:25.397000+00:00",
last_activity_at="2015-07-23T20:25:25.397000+00:00",
created_at="2015-07-22T20:51:29.630000+00:00",
banned_until="None",
banned=False,
)
],
total=1,
first_id="55b00250296db2db1a006a65",
last_id="55b00250296db2db1a006a65",
)