From b208e8e2a33b7a187cb168138fa75123c90cda4d Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sat, 16 Apr 2022 00:35:10 +0800 Subject: [PATCH] =?UTF-8?q?everyday=5Fen=20=E6=AF=8F=E6=97=A5=E4=B8=80?= =?UTF-8?q?=E5=8F=A5=E8=8B=B1=E6=96=87=E5=8F=A5=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- everyday_en.py | 24 ++++++++++++++++++++++++ list.json | 10 ++++++++++ 2 files changed, 34 insertions(+) create mode 100644 everyday_en.py diff --git a/everyday_en.py b/everyday_en.py new file mode 100644 index 0000000..ff8a796 --- /dev/null +++ b/everyday_en.py @@ -0,0 +1,24 @@ +from pagermaid import version, silent +from pagermaid.listener import listener +from pagermaid.utils import alias_command, client +from os import sep, remove + + +@listener(is_plugin=True, outgoing=True, command=alias_command("everyday_en"), + description="每日一句英文句子") +async def everyday(context): + if not silent: + await context.edit("获取中 . . .") + try: + data = await client.get("https://open.iciba.com/dsapi/") + data = data.json() + img = await client.get(data["fenxiang_img"]) + with open(f"data{sep}everyday.jpg", 'wb') as f: + f.write(img.content) + await context.edit("上传中 . . .") + await context.client.send_file(context.chat_id, f"data{sep}everyday.jpg", + caption=f"{data['content']}\n释义:{data['note']}") + remove(f"data{sep}everyday.jpg") + await context.delete() + except Exception as e: + await context.edit(f"获取失败\n{e}") diff --git a/list.json b/list.json index 87de057..2bd7030 100644 --- a/list.json +++ b/list.json @@ -909,6 +909,16 @@ "supported": true, "des-short": "每日新闻、历史上的今天、天天成语、慧语香风、诗歌天地", "des": "每日新闻、历史上的今天、天天成语、慧语香风、诗歌天地。\n指令:-news" + }, + { + "name": "everyday_en", + "version": "1.0", + "section": "daily", + "maintainer": "xtaodada", + "size": "1.0 kb", + "supported": true, + "des-short": "每日一句英文句子", + "des": "每日一句英文句子。\n指令:-everyday_en" } ] }