-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from Zastinian/beta
Update to version 3.3.0
- Loading branch information
Showing
9 changed files
with
271 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
module.exports = { | ||
name: "lang", | ||
run: async ({ bot, lang, args, message, types }) => { | ||
if (!types.isBotOwner) { | ||
return bot.sendMessage(message.chat, { text: lang.global.noOwner }, { quoted: message }); | ||
} | ||
if (!args[0]) { | ||
return bot.sendMessage( | ||
message.chat, | ||
{ text: lang.owner.private.noPrivate }, | ||
{ quoted: message }, | ||
); | ||
} | ||
const newPrivateStatus = args[0].toLowerCase(); | ||
if ( | ||
newPrivateStatus === "true" || | ||
newPrivateStatus === "on" || | ||
newPrivateStatus === "encendido" || | ||
newPrivateStatus === "enabled" || | ||
newPrivateStatus === "false" || | ||
newPrivateStatus === "off" || | ||
newPrivateStatus === "apagado" || | ||
newPrivateStatus === "desactivado" || | ||
newPrivateStatus === "disabled" | ||
) { | ||
let l; | ||
let n; | ||
switch (newPrivateStatus) { | ||
case "true": | ||
l = true; | ||
n = "True"; | ||
break; | ||
case "on": | ||
l = true; | ||
n = "True"; | ||
break; | ||
case "enabled": | ||
l = true; | ||
n = "True"; | ||
break; | ||
case "false": | ||
l = false; | ||
n = "False"; | ||
break; | ||
case "off": | ||
l = false; | ||
n = "False"; | ||
break; | ||
case "apagado": | ||
l = false; | ||
n = "False"; | ||
break; | ||
case "desactivado": | ||
l = false; | ||
n = "False"; | ||
break; | ||
case "disabled": | ||
l = false; | ||
n = "False"; | ||
break; | ||
} | ||
global.db.config.update("private", { id: "private" }, { value: l }); | ||
return bot.sendMessage( | ||
message.chat, | ||
{ text: `${lang.owner.private.correct}`.replace("{custom}", n) }, | ||
{ quoted: message }, | ||
); | ||
} | ||
return bot.sendMessage( | ||
message.chat, | ||
{ | ||
text: `${lang.owner.private.errorExisting}`.replace("{custom}", "true, false"), | ||
}, | ||
{ quoted: message }, | ||
); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
const readline = require("readline"); | ||
|
||
function getPrivateStatus() { | ||
return new Promise((resolve) => { | ||
const rl = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout, | ||
}); | ||
const askPrivate = async () => { | ||
console.log(""); | ||
rl.question( | ||
"\x1b[93mTell me if you want to disable or enable private chats (true/false)\x1b[94m\n⤳\x1b[0m ", | ||
(input) => { | ||
const value = input.toLowerCase().trim(); | ||
if ( | ||
value === "true" || | ||
value === "on" || | ||
lang === "encendido" || | ||
value === "enabled" || | ||
value === "false" || | ||
value === "off" || | ||
value === "apagado" || | ||
value === "desactivado" || | ||
value === "disabled" | ||
) { | ||
let l; | ||
switch (value) { | ||
case "true": | ||
l = true; | ||
break; | ||
case "on": | ||
l = true; | ||
break; | ||
case "enabled": | ||
l = true; | ||
break; | ||
case "false": | ||
l = false; | ||
break; | ||
case "off": | ||
l = false; | ||
break; | ||
case "apagado": | ||
l = false; | ||
break; | ||
case "desactivado": | ||
l = false; | ||
break; | ||
case "disabled": | ||
l = false; | ||
break; | ||
} | ||
resolve(l); | ||
rl.close(); | ||
} else { | ||
console.log(""); | ||
console.log("\x1b[91mERROR: \x1b[92mThe private status provided is not correct\x1b[0m"); | ||
setTimeout(() => { | ||
console.log(""); | ||
askPrivate(); | ||
}); | ||
} | ||
}, | ||
); | ||
}; | ||
askPrivate(); | ||
}); | ||
} | ||
|
||
module.exports = async (config) => { | ||
config.deleteTableIfExists("private"); | ||
config.createTable("private", ["id", "value"]); | ||
const p = await getPrivateStatus(); | ||
config.insert("private", { id: "private", value: p }); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters