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
|
@ -2,9 +2,9 @@ const { bot } = require('../index.js')
|
|||
const { getMessage } = require('../util/lang.js')
|
||||
module.exports = {
|
||||
execute: (c) => {
|
||||
if(c.bot.host && c.bot.host.options.netmsgDisabled){
|
||||
if (c.bot.host && c.bot.host.options.netmsgDisabled) {
|
||||
c.reply({
|
||||
text: getMessage(c.lang, "command.netmsg.disabled"),
|
||||
text: getMessage(c.lang, 'command.netmsg.disabled'),
|
||||
color: c.colors.secondary
|
||||
})
|
||||
return
|
||||
|
@ -37,7 +37,7 @@ module.exports = {
|
|||
color: 'white'
|
||||
}
|
||||
for (const i in bot) {
|
||||
if(bot[i].host.options.netmsgDisabled) continue
|
||||
if (bot[i].host.options.netmsgDisabled) continue
|
||||
bot[i].tellraw('@a', json)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,24 +4,24 @@ module.exports = {
|
|||
execute: (c) => {
|
||||
const subcmd = c.args.splice(0, 1)[0]
|
||||
switch (subcmd) {
|
||||
case 'set':
|
||||
const allowedKeys = ["colorPrimary", "colorSecondary", "lang"]
|
||||
case 'set':{
|
||||
const allowedKeys = ['colorPrimary', 'colorSecondary', 'lang']
|
||||
const key = c.args.splice(0, 1)[0]
|
||||
if(!allowedKeys.includes(key)){
|
||||
if (!allowedKeys.includes(key)) {
|
||||
c.reply({
|
||||
text: getMessage(c.lang, 'command.settings.error.invalidKey'),
|
||||
color: c.colors.secondary
|
||||
});
|
||||
return;
|
||||
})
|
||||
return
|
||||
}
|
||||
const value = c.args.join(" ")
|
||||
if(value === "" && key==="lang"){
|
||||
const value = c.args.join(' ')
|
||||
if (value === '' && key === 'lang') {
|
||||
// Show all valid languages to user
|
||||
for(const i in languages){
|
||||
for (const i in languages) {
|
||||
c.reply({
|
||||
translate: "%s (%s)",
|
||||
translate: '%s (%s)',
|
||||
color: c.colors.secondary,
|
||||
with:[
|
||||
with: [
|
||||
{
|
||||
text: getMessage(languages[i], 'language.name'),
|
||||
color: c.colors.primary
|
||||
|
@ -31,11 +31,11 @@ module.exports = {
|
|||
color: c.colors.primary
|
||||
}
|
||||
],
|
||||
hoverEvent:{
|
||||
action: "show_text",
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
value: {
|
||||
translate: getMessage(languages[i], 'command.settings.setLanguage'),
|
||||
with:[
|
||||
with: [
|
||||
{
|
||||
text: `${c.prefix}settings set lang ${languages[i]}`,
|
||||
color: c.colors.secondary
|
||||
|
@ -47,19 +47,19 @@ module.exports = {
|
|||
}
|
||||
return
|
||||
}
|
||||
if(value === ""){
|
||||
if (value === '') {
|
||||
c.reply({
|
||||
text: getMessage(c.lang, 'command.settings.error.mustProvideValue'),
|
||||
color: c.colors.secondary
|
||||
});
|
||||
return;
|
||||
})
|
||||
return
|
||||
}
|
||||
if(key==="lang" && !languages.includes(value)){
|
||||
if (key === 'lang' && !languages.includes(value)) {
|
||||
c.reply({
|
||||
text: getMessage(c.lang, 'command.settings.error.invalidLanguage'),
|
||||
color: c.colors.secondary
|
||||
});
|
||||
return;
|
||||
})
|
||||
return
|
||||
}
|
||||
c.prefs[key] = value
|
||||
|
||||
|
@ -67,19 +67,20 @@ module.exports = {
|
|||
fs.writeFileSync(`userPref/${c.uuid}.json`, JSON.stringify(c.prefs))
|
||||
|
||||
// Delete require cache
|
||||
for(const i in require.cache){
|
||||
if(i.endsWith(`${c.uuid}.json`)) delete require.cache[i]
|
||||
for (const i in require.cache) {
|
||||
if (i.endsWith(`${c.uuid}.json`)) delete require.cache[i]
|
||||
}
|
||||
c.reply({
|
||||
text: getMessage(c.lang, 'command.settings.saved'),
|
||||
color: c.colors.secondary
|
||||
});
|
||||
break;
|
||||
case 'get':{
|
||||
})
|
||||
break
|
||||
}
|
||||
case 'get':
|
||||
c.reply({
|
||||
translate: "%s: %s",
|
||||
translate: '%s: %s',
|
||||
color: c.colors.primary,
|
||||
with:[
|
||||
with: [
|
||||
{
|
||||
text: getMessage(c.lang, 'command.settings.get.colorPrimary'),
|
||||
color: c.colors.secondary
|
||||
|
@ -91,9 +92,9 @@ module.exports = {
|
|||
]
|
||||
})
|
||||
c.reply({
|
||||
translate: "%s: %s",
|
||||
translate: '%s: %s',
|
||||
color: c.colors.primary,
|
||||
with:[
|
||||
with: [
|
||||
{
|
||||
text: getMessage(c.lang, 'command.settings.get.colorSecondary'),
|
||||
color: c.colors.secondary
|
||||
|
@ -105,9 +106,9 @@ module.exports = {
|
|||
]
|
||||
})
|
||||
c.reply({
|
||||
translate: "%s: %s (%s)",
|
||||
translate: '%s: %s (%s)',
|
||||
color: c.colors.primary,
|
||||
with:[
|
||||
with: [
|
||||
{
|
||||
text: getMessage(c.lang, 'command.settings.get.language'),
|
||||
color: c.colors.secondary
|
||||
|
@ -123,7 +124,6 @@ module.exports = {
|
|||
]
|
||||
})
|
||||
break
|
||||
}
|
||||
default:
|
||||
c.reply({
|
||||
translate: getMessage(c.lang, 'command.cloop.error.subcommand'),
|
||||
|
|
|
@ -3,11 +3,11 @@ const hashcheck = require('../util/hashcheck.js')
|
|||
const settings = require('../settings.json')
|
||||
const { getMessage } = require('../util/lang.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 {
|
||||
return require(`../userPref/${uuid}.json`)
|
||||
} catch (e) {
|
||||
|
@ -21,7 +21,7 @@ module.exports = {
|
|||
b.runCommand = (name, uuid, text, prefix) => {
|
||||
if (uuid === '00000000-0000-0000-0000-000000000000') return
|
||||
if (Date.now() - b.lastCmd <= 1000) return
|
||||
const userSettings = loadSettings(uuid);
|
||||
const userSettings = loadSettings(uuid)
|
||||
b.lastCmd = Date.now()
|
||||
const cmd = text.split(' ')
|
||||
const lang = settings.defaultLang
|
||||
|
|
|
@ -13,7 +13,7 @@ module.exports = {
|
|||
b.sc_tasks = {}
|
||||
b.selfcareRun = 0
|
||||
b.interval.sc = setInterval(() => {
|
||||
if(Date.now() - b.selfcareRun <= 600){
|
||||
if (Date.now() - b.selfcareRun <= 600) {
|
||||
return
|
||||
}
|
||||
for (const i in b.sc_tasks) {
|
||||
|
|
|
@ -18,19 +18,19 @@ class Command {
|
|||
this.port = bot.host.port
|
||||
// this.lang = lang
|
||||
this.prefs = prefs
|
||||
if(prefs.lang){
|
||||
if (prefs.lang) {
|
||||
this.lang = prefs.lang
|
||||
} else {
|
||||
this.lang = settings.defaultLang
|
||||
}
|
||||
|
||||
let _colors = {}
|
||||
if(prefs.colorPrimary){
|
||||
const _colors = {}
|
||||
if (prefs.colorPrimary) {
|
||||
_colors.primary = prefs.colorPrimary
|
||||
} else {
|
||||
_colors.primary = settings.colors.primary
|
||||
}
|
||||
if(prefs.colorSecondary){
|
||||
if (prefs.colorSecondary) {
|
||||
_colors.secondary = prefs.colorSecondary
|
||||
} else {
|
||||
_colors.secondary = settings.colors.secondary
|
||||
|
|
Loading…
Reference in a new issue