import { Mwn } from 'npm:mwn' import process from "node:process"; async function getWorkshopVideos(bot: Mwn): Promise { const response = await bot.request({ action: 'query', list: 'allimages', aiprefix: 'WCS ', // Search prefix ailimit: 'max', // Maximum number of results }); if (response.query === undefined) { throw new Error("Did not receive response to file query") } // Extract and print the file titles return response.query.allimages.map(image => image.title); console.log('Files starting with "ABC ":', files); const file_content = await bot.read(files[0]) console.dir(file_content.revisions[0].content) console.dir(await bot.parseTitle(files[0])) } async function main() { const bot = new Mwn({ apiUrl: 'https://dancing.thasky.one/api.php', username: process.env.BOTNAME, password: process.env.BOTPW, userAgent: 'mwn bot', }); try { await bot.login(); const relevantFiles = await getWorkshopVideos(bot) } catch (error) { console.error('Error:', error); } finally { await bot.logout(); } } main();