voice 处理
This commit is contained in:
@@ -258,7 +258,10 @@ class MessagePushTask(MessagePluginInterface):
|
||||
|
||||
# 发送语音消息
|
||||
if content_voice:
|
||||
await self.bot.send_voice_message(group_id, Path(content_voice))
|
||||
voice_path = Path(task['content_voice'])
|
||||
# 根据文件扩展名确定类型
|
||||
voice_type = 'wav' if voice_path.suffix.lower() == '.wav' else 'mp3'
|
||||
await self.bot.send_voice_message(group_id, Path(content_voice), voice_type)
|
||||
|
||||
# 发送视频消息
|
||||
if content_video:
|
||||
@@ -312,7 +315,7 @@ class MessagePushTask(MessagePluginInterface):
|
||||
update_data = {'status': status}
|
||||
if next_time:
|
||||
update_data['schedule_time'] = next_time
|
||||
|
||||
|
||||
self.db.update_task(task['task_id'], update_data)
|
||||
|
||||
# 记录任务完成
|
||||
@@ -415,13 +418,15 @@ class MessagePushTask(MessagePluginInterface):
|
||||
days_ahead = next_weekday - current_weekday
|
||||
|
||||
# 计算下次执行时间
|
||||
next_time = now.replace(hour=hour, minute=minute, second=second, microsecond=0) + timedelta(days=days_ahead)
|
||||
next_time = now.replace(hour=hour, minute=minute, second=second, microsecond=0) + timedelta(
|
||||
days=days_ahead)
|
||||
|
||||
# 如果计算出的时间小于等于当前时间,说明计算有误,需要再加一周
|
||||
if next_time <= now:
|
||||
next_time = next_time + timedelta(days=7)
|
||||
|
||||
self.LOG.info(f"每周任务计算:当前周几={current_weekday}, 下次执行周几={next_weekday}, 天数差={days_ahead}, 下次执行时间={next_time}")
|
||||
self.LOG.info(
|
||||
f"每周任务计算:当前周几={current_weekday}, 下次执行周几={next_weekday}, 天数差={days_ahead}, 下次执行时间={next_time}")
|
||||
|
||||
except (json.JSONDecodeError, ValueError, IndexError) as e:
|
||||
self.LOG.error(f"处理每周执行日失败: {e}")
|
||||
|
||||
Reference in New Issue
Block a user