Skip to content

Instantly share code, notes, and snippets.

@Ruddernation-Designs
Last active October 9, 2022 21:36
Show Gist options
  • Save Ruddernation-Designs/c42a641ca1d48c6c8e3551f634c6963a to your computer and use it in GitHub Desktop.
Save Ruddernation-Designs/c42a641ca1d48c6c8e3551f634c6963a to your computer and use it in GitHub Desktop.
elif cmd == prefix + 'room':
threading.Thread(target=self.do_room_info, args=(cmd_arg,)).start()
def do_room_info(self, room):
"""
Shows info about a tinychat room.
:param room: str tinychat room.
"""
if self.is_client_mod:
if len(room) is 0:
self.send_undercover_msg(self.active_user.nick, 'Missing room to search for.')
else:
tc_usr = pinylib.apis.tinychat.room_info(room)
if tc_usr is None:
self.send_undercover_msg(self.active_user.nick, 'Could not find tinychat info for: ' + room)
else:
self.send_bot_msg('*Room ID:* ' + tc_usr['tinychat_id'])
//Add the below code to the tinychat.py file located in the apis folder.
def room_info(tc_room):
"""
Finds info for a given tinychat room name.
:param tc_room: str the room name.
:return: dict {'tinychat_id'} or None on error.
"""
url = 'https://tinychat.com/api/tcinfo?username=%s' % tc_room
response = util.web.http_get(url=url, json=True)
if response['json'] is not None:
if 'error' not in response['json']:
room_id = response['json']['id']
return {
'tinychat_id': room_id
}
else:
return None
@Ruddernation-Designs
Copy link
Author

it will output the room/users Tinychat ID

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment