change self care a bit

This commit is contained in:
ChomeNS 2023-03-02 14:29:13 +07:00
parent 00215db48e
commit 6fb4f3d852

View file

@ -1,22 +1,31 @@
function inject (bot, dcclient, config) {
let vanish = false
let nickname = true
let socialspy = false
let cspy = false
let op = true
let op = false
let gameMode = 1
let prefix = false
let muted = false
let endCredits = false
bot.on('message', (data) => {
if (data.toString() === 'You are now completely invisible to normal users, and hidden from in-game commands.') vanish = true
if (!bot.visibility &&
data.toString().startsWith('Vanish for ') &&
data.toString().endsWith('disabled')
) vanish = false
if (!bot.visibility && data.toString() === `Vanish for ${bot.username}: disabled`) vanish = false
if (data.toString() === 'You no longer have a nickname.') nickname = true
if (data.toString().startsWith('Your nickname is now ')) nickname = false
if (data.toString() === `SocialSpy for ${bot.username}: enabled`) socialspy = true
if (data.toString() === `SocialSpy for ${bot.username}: disabled`) socialspy = false
if (data.toString().startsWith('You have been muted')) muted = true
if (data.toString() === 'You have been unmuted.') muted = false
if (data.toString() === 'Successfully enabled CommandSpy' || data.toString() === ' Enabled your command spy.' || data.toString() === ' Your command spy is already enabled.') cspy = true
if (data.toString() === 'Successfully disabled CommandSpy' || data.toString() === ' Disabled your command spy.') cspy = false
if (data.toString() === 'You now have the tag: [ChomeNS Bot]' || // for ayunboom and kitsune(?)
if (data.toString() === 'You now have the tag: [ChomeNS Bot]' || // for 1.19.2 (or 1.19?) and older clones
data.toString() === 'You now have the tag: &8[&eChomeNS Bot&8]'
) {
prefix = true
@ -24,8 +33,6 @@ function inject (bot, dcclient, config) {
}
if (data.toString().startsWith('You no longer have a tag')) prefix = false
if (data.toString().startsWith('You now have the tag: ')) prefix = false
if (data.toString().startsWith('You have been muted')) muted = true
if (data.toString() === 'You have been unmuted.') muted = false
})
bot._client.on('entity_status', (data) => {
@ -48,7 +55,7 @@ function inject (bot, dcclient, config) {
})
bot._client.on('game_state_change', (data) => {
if (data.reason === 4) endCredits = true
if (data.reason === 4 && config.self_care.endCredits) bot.write('client_command', { payload: 0 })
if (data.reason !== 3) return
@ -65,10 +72,13 @@ function inject (bot, dcclient, config) {
if (!op && config.self_care.op) bot.chat('/minecraft:op @s[type=player]')
if (!cspy && config.self_care.cspy) bot.chat('/commandspy:commandspy on')
}
if (!vanish && config.self_care.vanish) bot.chat('/essentials:vanish enable')
if (!socialspy && config.self_care.socialspy) bot.chat('/essentials:socialspy enable')
if (!nickname && config.self_care.nickname) bot.chat('/essentials:nickname off')
if (gameMode !== 1 && config.self_care.gamemode) bot.chat('/minecraft:gamemode creative @s[type=player]')
if (muted && config.self_care.mute) bot.chat('/essentials:mute ' + bot.uuid)
if (endCredits && config.self_care.endCredits) bot.write('client_command', { payload: 0 })
}, config.self_care_check_interval)
bot.on('end', () => {