From f3591ce3f8e8f3fecf7d6a93b64dce37c44403d6 Mon Sep 17 00:00:00 2001 From: Norielle Cruz Date: Sat, 5 Aug 2023 02:58:56 +0800 Subject: [PATCH] feat: website screenshot plugin --- bot/plugins/webshot.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 bot/plugins/webshot.py diff --git a/bot/plugins/webshot.py b/bot/plugins/webshot.py new file mode 100644 index 0000000..0a8baeb --- /dev/null +++ b/bot/plugins/webshot.py @@ -0,0 +1,25 @@ +from typing import Dict +from .plugin import Plugin + +class WebshotPlugin(Plugin): + """ + A plugin to screenshot a website + """ + def get_source_name(self) -> str: + return "WebShot" + + def get_spec(self) -> [Dict]: + return [{ + "name": "screenshot_website", + "description": "Show screenshot/image of a website from a given url or domain name", + "parameters": { + "type": "object", + "properties": { + "url": {"type": "string", "description": "Website url or domain name"} + }, + "required": ["url"], + }, + }] + + async def execute(self, function_name, **kwargs) -> Dict: + return {'result': f'https://image.thum.io/get/maxAge/12/width/720/{kwargs["url"]}'}