mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Refactor findChar to utils
- Refactor and move finChar to utils, instead of slashcommands function - Refactor scrapers to use actual init functionality
This commit is contained in:
@@ -13,6 +13,7 @@ import { isValidUrl } from './utils.js';
|
||||
* @property {string} description
|
||||
* @property {string} iconClass
|
||||
* @property {boolean} iconAvailable
|
||||
* @property {() => Promise<void>} [init=null]
|
||||
* @property {() => Promise<boolean>} isAvailable
|
||||
* @property {() => Promise<File[]>} scrape
|
||||
*/
|
||||
@@ -42,6 +43,10 @@ export class ScraperManager {
|
||||
return;
|
||||
}
|
||||
|
||||
if (scraper.init) {
|
||||
scraper.init();
|
||||
}
|
||||
|
||||
ScraperManager.#scrapers.push(scraper);
|
||||
}
|
||||
|
||||
@@ -462,7 +467,9 @@ class YouTubeScraper {
|
||||
this.description = 'Download a transcript from a YouTube video.';
|
||||
this.iconClass = 'fa-brands fa-youtube';
|
||||
this.iconAvailable = true;
|
||||
}
|
||||
|
||||
async init() {
|
||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||
name: 'yt-script',
|
||||
callback: async (args, url) => {
|
||||
@@ -564,9 +571,11 @@ class YouTubeScraper {
|
||||
}
|
||||
}
|
||||
|
||||
ScraperManager.registerDataBankScraper(new FileScraper());
|
||||
ScraperManager.registerDataBankScraper(new Notepad());
|
||||
ScraperManager.registerDataBankScraper(new WebScraper());
|
||||
ScraperManager.registerDataBankScraper(new MediaWikiScraper());
|
||||
ScraperManager.registerDataBankScraper(new FandomScraper());
|
||||
ScraperManager.registerDataBankScraper(new YouTubeScraper());
|
||||
export function initScrapers() {
|
||||
ScraperManager.registerDataBankScraper(new FileScraper());
|
||||
ScraperManager.registerDataBankScraper(new Notepad());
|
||||
ScraperManager.registerDataBankScraper(new WebScraper());
|
||||
ScraperManager.registerDataBankScraper(new MediaWikiScraper());
|
||||
ScraperManager.registerDataBankScraper(new FandomScraper());
|
||||
ScraperManager.registerDataBankScraper(new YouTubeScraper());
|
||||
}
|
||||
|
Reference in New Issue
Block a user