forked from Maddious/RiTA-DiscordBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
436 additions
and
123 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "ritabot", | ||
"version": "1.2.5-15", | ||
"version": "1.2.6", | ||
"engines": { | ||
"node": "16.2.0" | ||
}, | ||
|
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,139 @@ | ||
// ----------------- | ||
// Global variables | ||
// ----------------- | ||
|
||
// Codebeat:disable[LOC,ABC,BLOCK_NESTING,ARITY] | ||
const logger = require("../../core/logger"); | ||
const db = require("../../core/db"); | ||
const sendMessage = require("../../core/command.send"); | ||
|
||
// ------------------------------ | ||
// React varible command handler | ||
// ------------------------------ | ||
|
||
function react (data) | ||
{ | ||
|
||
const commandVariable = data.cmd.params.split(" ")[0].toLowerCase(); | ||
|
||
if (commandVariable === "on" || commandVariable === "off") | ||
{ | ||
|
||
let value = false; | ||
if (commandVariable === "on") | ||
{ | ||
|
||
value = true; | ||
|
||
} | ||
|
||
// console.log(`DEBUG: React variable ${commandVariable}`); | ||
return db.updateServerTable(data.message.guild.id, "react", value, function error (err) | ||
{ | ||
|
||
if (err) | ||
{ | ||
|
||
return logger( | ||
"error", | ||
err, | ||
"command", | ||
data.message.channel.guild.name | ||
); | ||
|
||
} | ||
const output = | ||
"**```Flag Reactions```**\n" + | ||
`Translations by Flag Reactions is now turned : \`${commandVariable}\`\n\n` + | ||
`\n`; | ||
data.color = "info"; | ||
data.text = output; | ||
|
||
// ------------- | ||
// Send message | ||
// ------------- | ||
|
||
return sendMessage(data); | ||
|
||
}); | ||
|
||
} | ||
|
||
data.color = "error"; | ||
data.text = | ||
`:warning: **\`${commandVariable | ||
}\`** is not a valid react option.\n`; | ||
|
||
// ------------- | ||
// Send message | ||
// ------------- | ||
|
||
return sendMessage(data); | ||
|
||
} | ||
|
||
// ------------- | ||
// Command Code | ||
// ------------- | ||
|
||
module.exports = function run (data) | ||
|
||
{ | ||
|
||
// ------------------------------- | ||
// Command allowed by admins only | ||
// ------------------------------- | ||
|
||
Override: if (!process.env.DISCORD_BOT_OWNER_ID.includes(data.message.author.id)) | ||
{ | ||
|
||
if (data.message.isAdmin === false) | ||
{ | ||
|
||
{ | ||
|
||
data.color = "warn"; | ||
|
||
} | ||
data.text = ":cop: This command is reserved for server adminis."; | ||
|
||
// ------------- | ||
// Send message | ||
// ------------- | ||
|
||
return sendMessage(data); | ||
|
||
} | ||
break Override; | ||
|
||
} | ||
|
||
// -------------------------------- | ||
// Error if react param is missing | ||
// -------------------------------- | ||
|
||
if (!data.cmd.params) | ||
{ | ||
|
||
data.color = "error"; | ||
data.text = | ||
":warning: Missing `react` parameter. Use `" + | ||
`${data.config.translateCmdShort} help react\` to learn more.`; | ||
|
||
// ------------- | ||
// Send message | ||
// ------------- | ||
|
||
return sendMessage(data); | ||
|
||
} | ||
|
||
// ---------------- | ||
// Execute setting | ||
// ---------------- | ||
|
||
return react(data); | ||
|
||
}; | ||
|
||
|
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
Oops, something went wrong.