This commit is contained in:
Pyhtagodzilla 2025-07-20 23:31:42 +08:00
parent 58b5dcff73
commit a3c5ae75d3
3 changed files with 15 additions and 3 deletions

6
.env.bak Normal file
View File

@ -0,0 +1,6 @@
BOT_ACCOUNT="Your-bot-account"
ROOT_ACCOUNT="Your-root-account"
WS_URI="ws://Your-uri:port"
WS_TOKEN="Your-token"
WEBUI_URI="http://Your-uri:port"
WEBUI_TOKEN="Your-token

4
requirements.txt Normal file
View File

@ -0,0 +1,4 @@
requests~=2.32.4
ncatbot~=3.8.8.post7
dotenv~=0.9.9
python-dotenv~=1.1.1

View File

@ -39,11 +39,13 @@ async def on_receive_images_group_event(msg: GroupMessage):
_log.info(f"The message's meta data is: {meta_message}")
_log.info(f"The message's raw message is: {msg.raw_message}")
if "[CQ:image," in msg.raw_message:
# if "[CQ:image," in msg.raw_message:
if msg.raw_message.startswith("[CQ:image,"):
divided_message = msg.raw_message.split(',')
for item in divided_message:
if "file=" in item:
# if "file=" in item:
if item.startswith("file="):
file_name = item.split("=")[1]
_log.info(f"Name of the image is: {file_name}")
image_url = await bot.api.get_image(file_name)
@ -53,7 +55,7 @@ async def on_receive_images_group_event(msg: GroupMessage):
response = requests.get(real_url)
img = response.content
with open(f"D:/Projects/memebot/src/data/pics/{file_name}", 'wb') as f:
with open(f"../../data/pics/{file_name}", 'wb') as f:
f.write(img)