rewrite everything with yaml

This commit is contained in:
Lio Young 2021-07-09 11:46:45 +02:00
parent 24c1e2630f
commit dc7c00d505
8 changed files with 299 additions and 61 deletions

16
.github/workflows/LanguageFiles.yml vendored Normal file
View File

@ -0,0 +1,16 @@
name: "Generate Language Files"
on: [push]
jobs:
build:
runs-on: ubuntu-latest
env:
LANG_PATH: langs/
steps:
- name: YAML AutoSync
uses: Nuytemans-Dieter/YAML-sync-action@15
with:
lang_path: langs/
default_file: en_US.yml
github_token: ${secrets.GITHUB_TOKEN}

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules

View File

@ -1,7 +1,31 @@
import en_US from "./src/en_US";
import de_DE from "./src/de_DE";
// import en_US from "./src/en_US";
// import de_DE from "./src/de_DE";
export default {
en_US,
de_DE
}
// export default {
// en_US,
// de_DE
// }
// export default class Lingua {
// constructor() {
// }
// }
import jsyaml from 'js-yaml'
// import yaml from 'yaml'
import fs from 'fs'
try {
const file1 = fs.readFileSync('./langs/1.yml', 'utf8')
const file2 = fs.readFileSync('./langs/2.yml', 'utf8')
const Doc = jsyaml.loadAll(file1)
console.log(Doc)
} catch (error) {
console.log(error)
}

78
langs/en_US.yml Normal file
View File

@ -0,0 +1,78 @@
meta:
name: ":flag_us: English (US)"
locale: en_US
translators:
- 318044130796109825 # Lio
missing:
tags:
title: Not enough tags
desc: You need to provide a few Tags for me to search for.
values:
prefix: No Prefix given
country: No country code was given
setting: No Settings value was given
title: "Missing title. Separate the title and description with a pipe (`|`)."
mention: You need to mention another User
error:
nsfw: This Channel is not marked as NSFW, please mark it as such and rerun this Command
permissions: You need `PERMISSIONS` Permissions to run this Command
error: COMMAND encountered an error
COOLDOWN:
title: COMMAND is on COOLDOWN
desc: "COMMAND has a cooldown of COOLDOWN\nWait TIME before trying to run it again"
developer: This Command can only be run by Devs
categories:
info:
name: Info
desc: Information about the Bot, among other things.
nsfw:
name: ":underage: NSFW"
desc: Horny stuff, obviously.
animals:
name: Animals
desc: Cute Pictures of Animals to brighten your Day
misc:
name: Misc
desc: Miscellaneous Commands
fun:
name: fun
desc: Fun Commands
developer:
name: developer
desc: Developer only commands, duh.
locale:
language: Language
translators: AMOUNT Translator(s)
title: LANGUAGE by TRANSLATOR
amount: "BOT is available in AMOUNT Languages, you can easily change BOT's current Language by running `PREFIX locale set <country_code>`\n\n[Translations](https://t8.pm/lingua) are provided by the Community "
updated: Successfully updated SETTING
unsupported: BOT does not support VALUE at this time.
misc:
invite: You can invite BOT using this Link
roll: ":game_die: Rolling AMOUNT DICE"
sent: VALUE sent.
enabled: Enabled
disabled: Disabled
user:
info: Info on User
status: "Status | STATE"
roles: "Roles [AMOUNT]"
username: Username
id: User ID
created: Created
joined: Joined
states:
online: online
dnd: Do not Disturb
idle: idle
offline: Offline
rp:
client: Don't ACTION me! ACTION someone else.
self: Don't you want to ACTION someone other than yourself?

78
langs/template.yml Normal file
View File

@ -0,0 +1,78 @@
meta:
name:
locale:
translators:
- # Lio
missing:
tags:
title:
desc:
values:
prefix:
country:
setting:
title:
mention:
error:
nsfw:
permissions:
error:
COOLDOWN:
title:
desc:
developer:
categories:
info:
name:
desc:
nsfw:
name:
desc:
animals:
name:
desc:
misc:
name:
desc:
fun:
name:
desc:
developer:
name:
desc:
locale:
language:
translators:
title:
amount:
updated:
unsupported:
misc:
invite:
roll:
sent: .
enabled:
disabled:
user:
info:
status:
roles:
username:
id:
created:
joined:
states:
online:
dnd:
idle:
offline:
rp:
client:
self:

85
package-lock.json generated Normal file
View File

@ -0,0 +1,85 @@
{
"name": "lingua",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"dependencies": {
"js-yaml": "^4.1.0",
"yaml": "^1.10.2"
},
"devDependencies": {
"@types/js-yaml": "^4.0.2",
"@types/node": "^16.3.0"
}
},
"node_modules/@types/js-yaml": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.2.tgz",
"integrity": "sha512-KbeHS/Y4R+k+5sWXEYzAZKuB1yQlZtEghuhRxrVRLaqhtoG5+26JwQsa4HyS3AWX8v1Uwukma5HheduUDskasA==",
"dev": true
},
"node_modules/@types/node": {
"version": "16.3.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.3.0.tgz",
"integrity": "sha512-OydMCocGMGqw/1BnWbhtK+AtwyWTOigtrQlRe57OQmTNcI3HKlVI5FGlh+c4mSqInMPLynFrTlYjfajPu9O/eQ==",
"dev": true
},
"node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
},
"node_modules/js-yaml": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"dependencies": {
"argparse": "^2.0.1"
},
"bin": {
"js-yaml": "bin/js-yaml.js"
}
},
"node_modules/yaml": {
"version": "1.10.2",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
"integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==",
"engines": {
"node": ">= 6"
}
}
},
"dependencies": {
"@types/js-yaml": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.2.tgz",
"integrity": "sha512-KbeHS/Y4R+k+5sWXEYzAZKuB1yQlZtEghuhRxrVRLaqhtoG5+26JwQsa4HyS3AWX8v1Uwukma5HheduUDskasA==",
"dev": true
},
"@types/node": {
"version": "16.3.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.3.0.tgz",
"integrity": "sha512-OydMCocGMGqw/1BnWbhtK+AtwyWTOigtrQlRe57OQmTNcI3HKlVI5FGlh+c4mSqInMPLynFrTlYjfajPu9O/eQ==",
"dev": true
},
"argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
},
"js-yaml": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"requires": {
"argparse": "^2.0.1"
}
},
"yaml": {
"version": "1.10.2",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
"integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg=="
}
}
}

10
package.json Normal file
View File

@ -0,0 +1,10 @@
{
"dependencies": {
"js-yaml": "^4.1.0",
"yaml": "^1.10.2"
},
"devDependencies": {
"@types/js-yaml": "^4.0.2",
"@types/node": "^16.3.0"
}
}

View File

@ -7,14 +7,9 @@ export default {
]
},
CHANNEL_NOT_NSFW: "This Channel is not marked as NSFW, please mark it as such and rerun this Command.",
INSUFFICIENT_PERMISSIONS: `You need \`PERMISSIONS\` Permissions to run this Command `,
ON_COOLDOWN: `\`COMMAND\` is on Cooldown.`,
ON_COOLDOWN_DESCRIPTION: `\`COMMAND\` has a cooldown of \`COOLDOWN\` \n Wait \`TIME\` before trying to use it again.`,
ON_ERROR: `\`COMMAND\` encountered an Error.`,
MISSING: {
NOT_ENOUGH_TAGS: `Not Enough Tags`,
NOT_ENOUGH_TAGS_DESC: "You need to provide Tags for me to search for.",
NOT_ENOUGH_TAGS_DESC: "You need to provide a few Tags for me to search for.",
RP_REQUIRE_MENTION: `You need to mention another user.`,
MISSING_TITLE: `Missing title. Separate the title and description with a pipe (\`|\`).`,
VALUE: {
@ -23,56 +18,7 @@ export default {
SETTING: "No Setting was given."
}
},
USER_INFO: {
INFO_ON: "Info on USER",
STATUS: "Status | STATE",
ROLES: "Roles [AMOUNT]",
USERNAME: "Username",
USERID: "User ID",
CREATED_DATE: "Created",
JOINED_AT: "Joined",
STATES: {
ONLINE: "Online",
DND: "Do not Disturb",
IDLE: "Idle",
OFFLINE: "Offline"
}
},
NOT_ENOUGH_TAGS_DESC: "You need to provide Tags for me to search for.",
NOT_ENOUGH_TAGS: `Not Enough Tags`,
RP_REQUIRE_MENTION: `You need to mention another user.`,
RP_SELF: `Don't you want to ACTION someone other than yourself?`,
RP_ME: `Don't ACTION me! ACTION someone else.`,
MISSING_TITLE: `Missing title. Separate the title and description with a pipe (\`|\`).`,
VALUE_SENT: "VALUE sent.",
INVITE_STRING: "You can invite BOT using this Link",
ROLL: ":game_die: Rolling AMOUNT DICE...",
CATEGORIES: {
INFO: { name: "Info", desc: "" },
NSFW: { name: ":underage: NSFW", desc: "Horny Stuff, obviously." },
ANIMALS: { name: "Animals", desc: "Cute Pictures of Animals to brighten your Day!" },
MISC: { name: "Misc", desc: "Miscellaneous Commands" },
FUN: { name: "Fun", desc: "" },
DEVELOPER: { name: "Developer", desc: "Developer only Commands, duh" },
},
DEVELOPER_ONLY: "This Command is only for Developers.",
MISC: {
ENABLED: "Enabled",
DISABLED: "Disabled",
},
LOCALE: {
LANGUAGE: "Language",
CONTRIBUTORS: "AMOUNT Translator(s)",
TITLE: "LANGUAGE by TRANSLATOR",
COMMAND_DESC: "BOT is available in AMOUNT Languages, you can easily change BOT's current Language by running `PREFIX locale set <country_code>`\n\n[Translations](https://t8.pm/lingua) are provided by the Community",
UPDATED_SETTING: 'Updated SETTING to VALUE',
UNSUPPORTED: "BOT does not support VALUE at this Time.",
DEFAULT: {
LANGUAGES: "Languages",
LOCALIZATION: "Localization",
CURRENT: `Current Language`,
SUB: `• Use \`PREFIX locale set <country_code>\` to set the Guild's Language`
}
}
}