Lint
I'm tired of making release candidates
This commit is contained in:
parent
17ac994fe9
commit
314e9c3f9c
5 changed files with 45 additions and 45 deletions
|
@ -4,7 +4,7 @@ module.exports = {
|
||||||
execute: (c) => {
|
execute: (c) => {
|
||||||
if (c.bot.host && c.bot.host.options.netmsgDisabled) {
|
if (c.bot.host && c.bot.host.options.netmsgDisabled) {
|
||||||
c.reply({
|
c.reply({
|
||||||
text: getMessage(c.lang, "command.netmsg.disabled"),
|
text: getMessage(c.lang, 'command.netmsg.disabled'),
|
||||||
color: c.colors.secondary
|
color: c.colors.secondary
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
|
|
|
@ -4,22 +4,22 @@ module.exports = {
|
||||||
execute: (c) => {
|
execute: (c) => {
|
||||||
const subcmd = c.args.splice(0, 1)[0]
|
const subcmd = c.args.splice(0, 1)[0]
|
||||||
switch (subcmd) {
|
switch (subcmd) {
|
||||||
case 'set':
|
case 'set':{
|
||||||
const allowedKeys = ["colorPrimary", "colorSecondary", "lang"]
|
const allowedKeys = ['colorPrimary', 'colorSecondary', 'lang']
|
||||||
const key = c.args.splice(0, 1)[0]
|
const key = c.args.splice(0, 1)[0]
|
||||||
if (!allowedKeys.includes(key)) {
|
if (!allowedKeys.includes(key)) {
|
||||||
c.reply({
|
c.reply({
|
||||||
text: getMessage(c.lang, 'command.settings.error.invalidKey'),
|
text: getMessage(c.lang, 'command.settings.error.invalidKey'),
|
||||||
color: c.colors.secondary
|
color: c.colors.secondary
|
||||||
});
|
})
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
const value = c.args.join(" ")
|
const value = c.args.join(' ')
|
||||||
if(value === "" && key==="lang"){
|
if (value === '' && key === 'lang') {
|
||||||
// Show all valid languages to user
|
// Show all valid languages to user
|
||||||
for (const i in languages) {
|
for (const i in languages) {
|
||||||
c.reply({
|
c.reply({
|
||||||
translate: "%s (%s)",
|
translate: '%s (%s)',
|
||||||
color: c.colors.secondary,
|
color: c.colors.secondary,
|
||||||
with: [
|
with: [
|
||||||
{
|
{
|
||||||
|
@ -32,7 +32,7 @@ module.exports = {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
hoverEvent: {
|
hoverEvent: {
|
||||||
action: "show_text",
|
action: 'show_text',
|
||||||
value: {
|
value: {
|
||||||
translate: getMessage(languages[i], 'command.settings.setLanguage'),
|
translate: getMessage(languages[i], 'command.settings.setLanguage'),
|
||||||
with: [
|
with: [
|
||||||
|
@ -47,19 +47,19 @@ module.exports = {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if(value === ""){
|
if (value === '') {
|
||||||
c.reply({
|
c.reply({
|
||||||
text: getMessage(c.lang, 'command.settings.error.mustProvideValue'),
|
text: getMessage(c.lang, 'command.settings.error.mustProvideValue'),
|
||||||
color: c.colors.secondary
|
color: c.colors.secondary
|
||||||
});
|
})
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
if(key==="lang" && !languages.includes(value)){
|
if (key === 'lang' && !languages.includes(value)) {
|
||||||
c.reply({
|
c.reply({
|
||||||
text: getMessage(c.lang, 'command.settings.error.invalidLanguage'),
|
text: getMessage(c.lang, 'command.settings.error.invalidLanguage'),
|
||||||
color: c.colors.secondary
|
color: c.colors.secondary
|
||||||
});
|
})
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
c.prefs[key] = value
|
c.prefs[key] = value
|
||||||
|
|
||||||
|
@ -73,11 +73,12 @@ module.exports = {
|
||||||
c.reply({
|
c.reply({
|
||||||
text: getMessage(c.lang, 'command.settings.saved'),
|
text: getMessage(c.lang, 'command.settings.saved'),
|
||||||
color: c.colors.secondary
|
color: c.colors.secondary
|
||||||
});
|
})
|
||||||
break;
|
break
|
||||||
case 'get':{
|
}
|
||||||
|
case 'get':
|
||||||
c.reply({
|
c.reply({
|
||||||
translate: "%s: %s",
|
translate: '%s: %s',
|
||||||
color: c.colors.primary,
|
color: c.colors.primary,
|
||||||
with: [
|
with: [
|
||||||
{
|
{
|
||||||
|
@ -91,7 +92,7 @@ module.exports = {
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
c.reply({
|
c.reply({
|
||||||
translate: "%s: %s",
|
translate: '%s: %s',
|
||||||
color: c.colors.primary,
|
color: c.colors.primary,
|
||||||
with: [
|
with: [
|
||||||
{
|
{
|
||||||
|
@ -105,7 +106,7 @@ module.exports = {
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
c.reply({
|
c.reply({
|
||||||
translate: "%s: %s (%s)",
|
translate: '%s: %s (%s)',
|
||||||
color: c.colors.primary,
|
color: c.colors.primary,
|
||||||
with: [
|
with: [
|
||||||
{
|
{
|
||||||
|
@ -123,7 +124,6 @@ module.exports = {
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
c.reply({
|
c.reply({
|
||||||
translate: getMessage(c.lang, 'command.cloop.error.subcommand'),
|
translate: getMessage(c.lang, 'command.cloop.error.subcommand'),
|
||||||
|
|
|
@ -3,9 +3,9 @@ const hashcheck = require('../util/hashcheck.js')
|
||||||
const settings = require('../settings.json')
|
const settings = require('../settings.json')
|
||||||
const { getMessage } = require('../util/lang.js')
|
const { getMessage } = require('../util/lang.js')
|
||||||
const cmds = require('../util/commands.js')
|
const cmds = require('../util/commands.js')
|
||||||
const fs = require("fs")
|
const fs = require('fs')
|
||||||
|
|
||||||
if(!fs.readdirSync('.').includes('userPref')) fs.mkdirSync("userPref");
|
if (!fs.readdirSync('.').includes('userPref')) fs.mkdirSync('userPref')
|
||||||
|
|
||||||
const loadSettings = function (uuid) {
|
const loadSettings = function (uuid) {
|
||||||
try {
|
try {
|
||||||
|
@ -21,7 +21,7 @@ module.exports = {
|
||||||
b.runCommand = (name, uuid, text, prefix) => {
|
b.runCommand = (name, uuid, text, prefix) => {
|
||||||
if (uuid === '00000000-0000-0000-0000-000000000000') return
|
if (uuid === '00000000-0000-0000-0000-000000000000') return
|
||||||
if (Date.now() - b.lastCmd <= 1000) return
|
if (Date.now() - b.lastCmd <= 1000) return
|
||||||
const userSettings = loadSettings(uuid);
|
const userSettings = loadSettings(uuid)
|
||||||
b.lastCmd = Date.now()
|
b.lastCmd = Date.now()
|
||||||
const cmd = text.split(' ')
|
const cmd = text.split(' ')
|
||||||
const lang = settings.defaultLang
|
const lang = settings.defaultLang
|
||||||
|
|
|
@ -24,7 +24,7 @@ class Command {
|
||||||
this.lang = settings.defaultLang
|
this.lang = settings.defaultLang
|
||||||
}
|
}
|
||||||
|
|
||||||
let _colors = {}
|
const _colors = {}
|
||||||
if (prefs.colorPrimary) {
|
if (prefs.colorPrimary) {
|
||||||
_colors.primary = prefs.colorPrimary
|
_colors.primary = prefs.colorPrimary
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue