コード例 #1
0
def in_lab(bot, msg):
    """Check if a staffer is in the lab."""
    username = msg.match.group(1).strip()
    for session in staff_in_lab():
        if username == session.user:
            msg.respond(f'{username} is in the lab')
            break
    else:
        msg.respond(f'{username} is not in the lab')
コード例 #2
0
def who_is_in_lab(bot, msg):
    """Report on who is currently in the lab."""
    staff = {session.user for session in staff_in_lab()}
    total = users_in_lab_count()

    if total != 1:
        are_number_people = 'are {} people'.format(total)
    else:
        are_number_people = 'is 1 person'

    if staff:
        staff_list = ': {}'.format(', '.join(sorted(_prevent_ping(staffer) for staffer in staff)))
    else:
        staff_list = ''

    msg.respond('there {} in the lab, including {} staff{}'.format(
        are_number_people,
        len(staff),
        staff_list,
    ))
コード例 #3
0
ファイル: lab.py プロジェクト: strellic/api
async def lab_staff():
    return staff_in_lab()