async def reset_clock(bot): today = str(datetime.date.today()) clock = dataManage.read_clock() del_key = [] for group_id, clock_dict in clock.items(): if 'int' not in str(type(group_id)): del_key.append(group_id) continue member_list_origin = await bot.member_list(group_id) member_list = {} for member in member_list_origin.data: if not member_list.__contains__(member.id): member_list[member.id] = member.member_name for name, members in clock_dict.items(): del_member = [] at_member = [] for member in members['member']: if not member_list.__contains__(member['qq']): del_member.append(member) elif not Clock.is_yesterday(member['last']): at_member.append(member['qq']) message = [] if len(at_member) != 0: message.append(Plain('打卡<' + name + '>昨日未打卡的人公示:')) for qq in at_member: message.append(At(qq)) message.append(Plain('\n')) await bot.send_group_message(group_id, message) else: message.append(Plain('打卡<' + name + '>昨日所有人都完成了打卡')) await bot.send_group_message(group_id, message) for member in del_member: clock[group_id][name]['member'].remove(member) dataManage.save_clock(clock) for key in del_key: if key != 923691404: del clock[key] dataManage.save_clock(clock)
import sys sys.path.append('../../') import dot3k.lcd as lcd import dot3k.backlight as backlight import dot3k.joystick as joystick import utils.usbkeyboard as keyboard from menu import Menu, MenuOption from plugins.text import Text from plugins.deluge import Deluge from plugins import Volume, Backlight, Contrast, GraphTemp, GraphCPU, Clock, Radio, Stocks import time my_clock = Clock() menu = Menu(structure={ 'Deluge': Deluge(), 'Clock': my_clock, 'Stocks': Stocks(), 'Radio': Radio(), 'Status': { 'CPU': GraphCPU(), 'Temp': GraphTemp() }, 'Settings': { 'Volume': Volume(), 'Contrast': Contrast(lcd), 'Backlight': Backlight(backlight) }