Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.run = (bot, msg, args) => {
// -l -- List all fonts
// -f <font> -- Set font
const parsed = bot.utils.parseArgs(args, ['l', 'f:']);
if (parsed.options.l) {
bot.utils.textUpload(figlet.fontsSync().join('\n')).then(({ url }) => {
if (!url) {
return msg.error('Failed to upload fonts list!');
}
msg.edit({
embed: bot.utils.embed('Available Fonts', `A list of available fonts can be found [here](${url}).`)
}).then(m => m.delete(5000));
});
return;
}
if (parsed.leftover.length < 1) {
throw 'You must provide some text to render!';
}
const options = {};</font>
function generateFontTest(text): void {
var figlet = require('figlet');
var fonts = [];
figlet.fontsSync().forEach(function (font) {
fonts.push(font);
}, this);
var fontTest = [];
fonts.forEach(function (font) {
fontTest.push("Font: " + font);
fontTest.push("\n");
fontTest.push(
figlet.textSync(text, {
font: font,
horizontalLayout: 'default',
verticalLayout: 'default'
}));
return new Promise((res, rej) => {
inquirer.prompt([
{
type: "input",
message: "Text:",
name: "text"
},
{
type: "list",
message: "Font:",
name: "font",
choices: figlet.fontsSync()
},
{
type: "list",
message: "Theme:",
name: "theme",
choices: Object.keys(themes)
},
{
type: "list",
message: "Horizontal Layout:",
name: "horizontal",
choices: ["default", "full", "fitted", "controlled smushing", "universal smushing"]
},
{
type: "list",
message: "Vertical Layout:",
function replaceSelectionWithSelectedFont(): void {
var figlet = require('figlet');
var items: QuickPickItem[] = [];
figlet.fontsSync().forEach(function (font) {
items.push({ label: font, description: "Use the " + font + " font" });
}, this);
Window.showQuickPick(items).then(function (selection) {
if (!selection) {
return;
}
replaceSelectionsWithFont(selection.label);
});
}
get font() {
return sample(require('figlet').fontsSync())
},
},
get: () => require('figlet').fontsSync(),
})