diff --git a/README.md b/README.md index 1677e29..be06735 100644 --- a/README.md +++ b/README.md @@ -112,16 +112,16 @@ Check out the [Budget Manual](https://github.com/n3d1117/chatgpt-telegram-bot/di | `WORLDTIME_DEFAULT_TIMEZONE` | Default timezone to use, i.e. `Europe/Rome` (required only for the `worldtimeapi` plugin, you can get TZ Identifiers from [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)) | - | #### Available plugins -| Name | Description | Required environment variable(s) | -|----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------| -| `weather` | Daily weather and 7-day forecast for any location (powered by [Open-Meteo](https://open-meteo.com)) | - | -| `wolfram` | WolframAlpha queries (powered by [WolframAlpha](https://www.wolframalpha.com)) | `WOLFRAM_APP_ID` | -| `web_search` | Web search (powered by [DuckDuckGo](https://duckduckgo.com)) | - | -| `crypto` | Live cryptocurrencies rate (powered by [CoinCap](https://coincap.io)) - by [@stumpyfr](https://github.com/stumpyfr) | - | -| `spotify` | Spotify top tracks/artists, currently playing song and content search (powered by [Spotify](https://spotify.com)). Requires one-time authorization. | `SPOTIFY_CLIENT_ID`, `SPOTIFY_CLIENT_SECRET`, `SPOTIFY_REDIRECT_URI` | -| `translate` | Translate text to any language (powered by [DuckDuckGo](https://duckduckgo.com)) | - | -| `image_search` | Search image or GIF (powered by [DuckDuckGo](https://duckduckgo.com)) | - | -| `worldtimeapi` | Get latest world time (powered by [WorldTimeAPI](https://worldtimeapi.org/)) | `WORLDTIME_DEFAULT_TIMEZONE` | +| Name | Description | Required environment variable(s) | +|--------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------| +| `weather` | Daily weather and 7-day forecast for any location (powered by [Open-Meteo](https://open-meteo.com)) | - | +| `wolfram` | WolframAlpha queries (powered by [WolframAlpha](https://www.wolframalpha.com)) | `WOLFRAM_APP_ID` | +| `ddg_web_search` | Web search (powered by [DuckDuckGo](https://duckduckgo.com)) | - | +| `ddg_translate` | Translate text to any language (powered by [DuckDuckGo](https://duckduckgo.com)) | - | +| `ddg_image_search` | Search image or GIF (powered by [DuckDuckGo](https://duckduckgo.com)) | - | +| `crypto` | Live cryptocurrencies rate (powered by [CoinCap](https://coincap.io)) - by [@stumpyfr](https://github.com/stumpyfr) | - | +| `spotify` | Spotify top tracks/artists, currently playing song and content search (powered by [Spotify](https://spotify.com)). Requires one-time authorization. | `SPOTIFY_CLIENT_ID`, `SPOTIFY_CLIENT_SECRET`, `SPOTIFY_REDIRECT_URI` | +| `worldtimeapi` | Get latest world time (powered by [WorldTimeAPI](https://worldtimeapi.org/)) | `WORLDTIME_DEFAULT_TIMEZONE` | Check out the [official API reference](https://platform.openai.com/docs/api-reference/chat) for more details. diff --git a/bot/plugin_manager.py b/bot/plugin_manager.py index eff71b0..2f37e78 100644 --- a/bot/plugin_manager.py +++ b/bot/plugin_manager.py @@ -1,11 +1,11 @@ import json -from plugins.images import ImageSearchPlugin -from plugins.translate import TranslatePlugin +from plugins.ddg_image_search import DDGImageSearchPlugin +from plugins.ddg_translate import DDGTranslatePlugin from plugins.spotify import SpotifyPlugin from plugins.crypto import CryptoPlugin from plugins.weather import WeatherPlugin -from plugins.web_search import WebSearchPlugin +from plugins.ddg_web_search import DDGWebSearchPlugin from plugins.wolfram_alpha import WolframAlphaPlugin from plugins.worldtimeapi import WorldTimeApiPlugin @@ -21,10 +21,10 @@ class PluginManager: 'wolfram': WolframAlphaPlugin, 'weather': WeatherPlugin, 'crypto': CryptoPlugin, - 'web_search': WebSearchPlugin, + 'ddg_web_search': DDGWebSearchPlugin, + 'ddg_translate': DDGTranslatePlugin, + 'ddg_image_search': DDGImageSearchPlugin, 'spotify': SpotifyPlugin, - 'translate': TranslatePlugin, - 'image_search': ImageSearchPlugin, 'worldtimeapi': WorldTimeApiPlugin, } self.plugins = [plugin_mapping[plugin]() for plugin in enabled_plugins if plugin in plugin_mapping] diff --git a/bot/plugins/images.py b/bot/plugins/ddg_image_search.py similarity index 94% rename from bot/plugins/images.py rename to bot/plugins/ddg_image_search.py index 152b254..8ef96de 100644 --- a/bot/plugins/images.py +++ b/bot/plugins/ddg_image_search.py @@ -6,7 +6,7 @@ from duckduckgo_search import DDGS from .plugin import Plugin -class ImageSearchPlugin(Plugin): +class DDGImageSearchPlugin(Plugin): """ A plugin to search images and GIFs for a given query, using DuckDuckGo """ @@ -24,7 +24,7 @@ class ImageSearchPlugin(Plugin): "type": { "type": "string", "enum": ["photo", "gif"], - "description": "The type of image to search for. Default to photo if not specified", + "description": "The type of image to search for. Default to `photo` if not specified", } }, "required": ["query", "type"], diff --git a/bot/plugins/translate.py b/bot/plugins/ddg_translate.py similarity index 96% rename from bot/plugins/translate.py rename to bot/plugins/ddg_translate.py index c7ee3c3..c5b1211 100644 --- a/bot/plugins/translate.py +++ b/bot/plugins/ddg_translate.py @@ -5,7 +5,7 @@ from duckduckgo_search import DDGS from .plugin import Plugin -class TranslatePlugin(Plugin): +class DDGTranslatePlugin(Plugin): """ A plugin to translate a given text from a language to another, using DuckDuckGo """ diff --git a/bot/plugins/web_search.py b/bot/plugins/ddg_web_search.py similarity index 97% rename from bot/plugins/web_search.py rename to bot/plugins/ddg_web_search.py index 0c8bff9..6cc84ae 100644 --- a/bot/plugins/web_search.py +++ b/bot/plugins/ddg_web_search.py @@ -6,7 +6,7 @@ from duckduckgo_search import DDGS from .plugin import Plugin -class WebSearchPlugin(Plugin): +class DDGWebSearchPlugin(Plugin): """ A plugin to search the web for a given query, using DuckDuckGo """