mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Add fallback fonts
This commit is contained in:
+3
-1
@@ -9,6 +9,7 @@ module.exports = class FontArgumentType extends ArgumentType {
|
||||
validate(value) {
|
||||
const choice = value.toLowerCase();
|
||||
let found = this.client.fonts.filter(font => {
|
||||
if (font.isFallback) return false;
|
||||
if (font.isVariant) return false;
|
||||
if (font.name.toLowerCase().includes(choice)) return true;
|
||||
if (font.filenameNoExt.toLowerCase().includes(choice)) return true;
|
||||
@@ -24,13 +25,14 @@ module.exports = class FontArgumentType extends ArgumentType {
|
||||
if (foundExact.size === 1) return true;
|
||||
if (foundExact.size > 0) found = foundExact;
|
||||
return found.size <= 15
|
||||
? `${disambiguation(found.map(font => escapeMarkdown(font.name)), 'fonts', null)}\n`
|
||||
? `${disambiguation(found.map(font => escapeMarkdown(font.filenameNoExt)), 'fonts', null)}\n`
|
||||
: 'Multiple fonts found. Please be more specific.';
|
||||
}
|
||||
|
||||
parse(value) {
|
||||
const choice = value.toLowerCase();
|
||||
const found = this.client.fonts.filter(font => {
|
||||
if (font.isFallback) return false;
|
||||
if (font.isVariant) return false;
|
||||
if (font.name.toLowerCase().includes(choice)) return true;
|
||||
if (font.filenameNoExt.toLowerCase().includes(choice)) return true;
|
||||
|
||||
Reference in New Issue
Block a user