Add auto_tts plugin

This commit is contained in:
Jipok
2023-11-23 20:48:16 +05:00
parent 904f49e475
commit 371b9597ee
17 changed files with 63 additions and 17 deletions

View File

@@ -1,6 +1,7 @@
import json
from plugins.gtts_text_to_speech import GTTSTextToSpeech
from plugins.auto_tts import AutoTextToSpeech
from plugins.dice import DicePlugin
from plugins.youtube_audio_extractor import YouTubeAudioExtractorPlugin
from plugins.ddg_image_search import DDGImageSearchPlugin
@@ -36,6 +37,7 @@ class PluginManager:
'dice': DicePlugin,
'deepl_translate': DeeplTranslatePlugin,
'gtts_text_to_speech': GTTSTextToSpeech,
'auto_tts': AutoTextToSpeech,
'whois': WhoisPlugin,
'webshot': WebshotPlugin,
}
@@ -47,14 +49,14 @@ class PluginManager:
"""
return [spec for specs in map(lambda plugin: plugin.get_spec(), self.plugins) for spec in specs]
async def call_function(self, function_name, arguments):
async def call_function(self, function_name, helper, arguments):
"""
Call a function based on the name and parameters provided
"""
plugin = self.__get_plugin_by_function_name(function_name)
if not plugin:
return json.dumps({'error': f'Function {function_name} not found'})
return json.dumps(await plugin.execute(function_name, **json.loads(arguments)), default=str)
return json.dumps(await plugin.execute(function_name, helper, **json.loads(arguments)), default=str)
def get_plugin_source_name(self, function_name) -> str:
"""