I'm tired of making release candidates
This commit is contained in:
7cc5c4f330d47060 2024-08-18 13:38:09 -04:00
parent 17ac994fe9
commit 314e9c3f9c
Signed by: 7cc5c4f330d47060
SSH key fingerprint: SHA256:e+4tcZut1nBpe10PqjaO+Rvie0Q7W4qIvFzcUw+7riA
5 changed files with 45 additions and 45 deletions

View file

@ -2,9 +2,9 @@ const { bot } = require('../index.js')
const { getMessage } = require('../util/lang.js') const { getMessage } = require('../util/lang.js')
module.exports = { 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
@ -37,7 +37,7 @@ module.exports = {
color: 'white' color: 'white'
} }
for (const i in bot) { for (const i in bot) {
if(bot[i].host.options.netmsgDisabled) continue if (bot[i].host.options.netmsgDisabled) continue
bot[i].tellraw('@a', json) bot[i].tellraw('@a', json)
} }
} }

View file

@ -4,24 +4,24 @@ 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: [
{ {
text: getMessage(languages[i], 'language.name'), text: getMessage(languages[i], 'language.name'),
color: c.colors.primary color: c.colors.primary
@ -31,11 +31,11 @@ module.exports = {
color: c.colors.primary color: c.colors.primary
} }
], ],
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: [
{ {
text: `${c.prefix}settings set lang ${languages[i]}`, text: `${c.prefix}settings set lang ${languages[i]}`,
color: c.colors.secondary color: c.colors.secondary
@ -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
@ -67,19 +67,20 @@ module.exports = {
fs.writeFileSync(`userPref/${c.uuid}.json`, JSON.stringify(c.prefs)) fs.writeFileSync(`userPref/${c.uuid}.json`, JSON.stringify(c.prefs))
// Delete require cache // Delete require cache
for(const i in require.cache){ for (const i in require.cache) {
if(i.endsWith(`${c.uuid}.json`)) delete require.cache[i] if (i.endsWith(`${c.uuid}.json`)) delete require.cache[i]
} }
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: [
{ {
text: getMessage(c.lang, 'command.settings.get.colorPrimary'), text: getMessage(c.lang, 'command.settings.get.colorPrimary'),
color: c.colors.secondary color: c.colors.secondary
@ -91,9 +92,9 @@ module.exports = {
] ]
}) })
c.reply({ c.reply({
translate: "%s: %s", translate: '%s: %s',
color: c.colors.primary, color: c.colors.primary,
with:[ with: [
{ {
text: getMessage(c.lang, 'command.settings.get.colorSecondary'), text: getMessage(c.lang, 'command.settings.get.colorSecondary'),
color: c.colors.secondary color: c.colors.secondary
@ -105,9 +106,9 @@ module.exports = {
] ]
}) })
c.reply({ c.reply({
translate: "%s: %s (%s)", translate: '%s: %s (%s)',
color: c.colors.primary, color: c.colors.primary,
with:[ with: [
{ {
text: getMessage(c.lang, 'command.settings.get.language'), text: getMessage(c.lang, 'command.settings.get.language'),
color: c.colors.secondary color: c.colors.secondary
@ -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'),

View file

@ -3,11 +3,11 @@ 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 {
return require(`../userPref/${uuid}.json`) return require(`../userPref/${uuid}.json`)
} catch (e) { } catch (e) {
@ -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

View file

@ -13,7 +13,7 @@ module.exports = {
b.sc_tasks = {} b.sc_tasks = {}
b.selfcareRun = 0 b.selfcareRun = 0
b.interval.sc = setInterval(() => { b.interval.sc = setInterval(() => {
if(Date.now() - b.selfcareRun <= 600){ if (Date.now() - b.selfcareRun <= 600) {
return return
} }
for (const i in b.sc_tasks) { for (const i in b.sc_tasks) {

View file

@ -18,19 +18,19 @@ class Command {
this.port = bot.host.port this.port = bot.host.port
// this.lang = lang // this.lang = lang
this.prefs = prefs this.prefs = prefs
if(prefs.lang){ if (prefs.lang) {
this.lang = prefs.lang this.lang = prefs.lang
} else { } else {
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 {
_colors.primary = settings.colors.primary _colors.primary = settings.colors.primary
} }
if(prefs.colorSecondary){ if (prefs.colorSecondary) {
_colors.secondary = prefs.colorSecondary _colors.secondary = prefs.colorSecondary
} else { } else {
_colors.secondary = settings.colors.secondary _colors.secondary = settings.colors.secondary