owobot/plugins/commands/about.js

80 lines
1.8 KiB
JavaScript
Raw Normal View History

2024-07-28 16:30:19 -04:00
const version = require('../../version.json')
const settings = require('../../settings.json')
const getMessage = require('../../util/lang.js')
const cp = require('child_process')
module.exports = {
execute: function (c) {
c.reply({
translate: getMessage(c.lang, 'command.about.author'),
color: c.colors.secondary,
with: [
{
2024-07-28 16:48:46 -04:00
text: version.botName,
2024-07-28 16:30:19 -04:00
color: c.colors.primary
}
]
})
c.reply({ text: '' })
2024-07-28 16:48:46 -04:00
const botVersion = version.botVersion
2024-07-28 16:30:19 -04:00
let gitCommit
try {
gitCommit = cp.execSync('git rev-parse --short HEAD').toString('UTF-8').split('\n')[0]
} catch (e) {
gitCommit = false
}
if (gitCommit) {
c.reply({
translate: getMessage(c.lang, 'command.about.version'),
color: c.colors.secondary,
with: [
[
{
text: botVersion,
color: c.colors.primary
},
{
translate: ' (%s)',
color: 'white',
with: [
{
text: gitCommit,
color: c.colors.primary
}
]
}
]
]
})
} else {
c.reply({
translate: getMessage(c.lang, 'command.about.version'),
color: c.colors.secondary,
with: [
{
text: botVersion,
color: c.colors.primary
}
]
})
}
c.reply({ text: '' })
c.reply({
translate: getMessage(c.lang, 'command.about.serverinfo'),
color: c.colors.secondary,
with: [
{
translate: '"%s"',
color: 'white',
with: [
{
text: 'serverinfo',
color: c.colors.primary
}
]
}
]
})
},
aliases: ['info']
}