def duty(): config = util.getConfig() dutyList = gsheet.getTodayDuty() mentionList = gsheet.getMentionList() # 打刻当番 # message = '本日の申請確認担当は<@' + util.getMention(mentionList, dutyList[0]) + '>です。'\ # '\n当日、10時までの申請分について対応してください。'\ # '\nマニュアル:https://infratop.docbase.io/posts/1538760' # slack.post(url=config['SLACK']['URL_ST'], text=message) # その他 message = '本日の当番です!'\ '\n学サポ日直 :<@' + util.getMention(mentionList, dutyList[0]) + '>'\ '\nメンサポ日直:<@' + util.getMention(mentionList, dutyList[1]) + '>'\ '\n昼会司会 :<@' + util.getMention(mentionList, dutyList[2]) + '>' slack.post(url=config['SLACK']['URL_LSI'], text=message)
# -*- coding:utf-8 -*- import requests import tweet import slack import gehirn import os current_ip_val = requests.get('http://ifconfig.moe/').text.strip() ip_file = os.path.join(os.path.dirname(__file__), 'global.ip') with open(ip_file,'r') as recorded_ip: recorded_ip_val = recorded_ip.read() if (current_ip_val != recorded_ip_val): with open(ip_file,'w') as recorded_ip: recorded_ip.write(current_ip_val) #tweet.tweet(current_ip_val) slack.post(current_ip_val) gehirn.update(current_ip_val)
def _process_running(instance) -> None: s_str = f"""devserver successfully started: ``` mosh -I albatross ec2-user@{instance.public_ip_address} ```""" slack.post(s_str)
pass interval_start_time = datetime.now() # 最後の揺れ時間を記録する elif measureing and is_shaking(): # 計測中に検知したら時間を更新 write_char(".") interval_start_time = datetime.now() elif measureing and not is_shaking(): # 計測中に検知しなくなったら(終了したorインターバルタイムのとき) timedelta = datetime.now() - interval_start_time if timedelta.total_seconds() >= finish_time: # 終了した write_char("E") logger.info("Finish!") slack.post("洗濯終了だよ~") measureing = False last_10_check = reset_list(False) last_10_value = reset_list(base) else: write_char("x") # まだ終わってない場合はインターバルタイムで停止しているとみなす pass if is_shaking(): # 検知したらリストを初期化 last_10_check = reset_list(False) last_10_value = reset_list(base) time_count += 1
return days week = Week.current() weekdays = week.weekdays() days = get_bookings_for(weekdays) total = sum(list(map(len, days))) unknown = filter_count(days, unknown_check) commented = filter_count(days, commented_check) returned = filter_count(days, returned_check) #x_axis = list(map(lambda x: x.short_name(), weekdays)) #chart1 = chart.StackedBar(x_axis) #chart1.add_bar(unknown, 'okända') #chart1.add_bar(commented, 'kommenterade') #chart1.add_bar(returned, 'levererade') #chart1.save('charts/{}_{}.png'.format(week._of_year, week._number)) url = kp.chart_url.format(week._of_year, week._number) success_rate = percent(sum(returned) / total) comment_rate = percent(sum(commented) / total) message = 'Vecka {} tvättades {}% av bokningarna. {}% med kommentar. Veckans summering <{}|Veckans summering>'.format( week._number, success_rate, comment_rate, url) slack.post(message, url)
sound.play(mp3['ready_to_touch']) while True: time.sleep(1) idm = suica.read() if not idm: continue user = db.find_user(idm) if user is None: user = db.add_user(idm) sound.play(mp3['add_new_user']) if idm == last_action['idm'] and time.time() - last_action['time'] < 5: sound.play(mp3['too_short_interval']) print('too short interval') continue if user['is_working']: last_action = clock_out(idm) sound.play(mp3['clock_out']) msg = 'Clock out ' + user['name'] slack.post(msg) print(msg) else: last_action = clock_in(idm) sound.play(mp3['clock_in']) msg = 'Clock in ' + user['name'] slack.post(msg) print(msg)
def send_request(num): ns = make_notice_string(num) slack.post(ns)
def _notify_slack_if_need(text, args): if args['--notify-slack']: slack.post(text)