Change rules.txt to rules.json
This commit is contained in:
parent
25c4f8c8fd
commit
7826f95976
5 changed files with 109 additions and 71 deletions
|
@ -25,35 +25,30 @@ class rules extends command {
|
||||||
if (context.message.member.roles.cache.find(role => role.name == context.client.config.rules.adminrole)) {
|
if (context.message.member.roles.cache.find(role => role.name == context.client.config.rules.adminrole)) {
|
||||||
// If the rulesfile exists
|
// If the rulesfile exists
|
||||||
if (existsSync(context.client.config.rules.rulesfile)) {
|
if (existsSync(context.client.config.rules.rulesfile)) {
|
||||||
// Get the contents of the rules file, and split it by "> "
|
const rulesJson = readFileSync(context.client.config.rules.rulesfile);
|
||||||
// Each embed in the rules is set by the "> " syntax
|
const rules = JSON.parse(rulesJson);
|
||||||
let rulesText = readFileSync(context.client.config.rules.rulesfile).toString();
|
|
||||||
rulesText = rulesText.split("> ");
|
|
||||||
|
|
||||||
// Loop through each embed to be sent
|
for (let i = 0; i < rules.length; i++) {
|
||||||
for (let i = 0; i < rulesText.length; i++) {
|
const rule = rules[i];
|
||||||
// If the first line after "> " has a "#", create and embed with an image of the url specified after
|
const embed = new MessageEmbed();
|
||||||
if (rulesText[i].charAt(0) == '#') {
|
|
||||||
const embed = new MessageEmbed()
|
|
||||||
.setColor(embedColor)
|
|
||||||
.setImage(rulesText[i].substring(1));
|
|
||||||
|
|
||||||
context.message.channel.send(embed);
|
embed.setColor(embedColor);
|
||||||
} else { // If the file doesn't have a "#" at the start
|
|
||||||
// Split the embed into different lines, set the first line as the title, and the rest as the description
|
|
||||||
const rulesLines = rulesText[i].split("\n");
|
|
||||||
const rulesTitle = rulesLines[0];
|
|
||||||
const rulesDescription = rulesLines.slice(1).join("\n");
|
|
||||||
|
|
||||||
// Create the embed with the specified information above
|
if (rule.image) embed.setImage(rule.image);
|
||||||
const embed = new MessageEmbed()
|
if (rule.title) embed.setTitle(rule.title);
|
||||||
.setTitle(rulesTitle)
|
if (rule.footer) embed.setFooter(rule.footer);
|
||||||
.setColor(embedColor)
|
if (rule.description) {
|
||||||
.setDescription(rulesDescription);
|
let description = "";
|
||||||
|
|
||||||
// Send the embed
|
for (let j = 0; j < rule.description.length; j++) {
|
||||||
context.message.channel.send(embed);
|
const line = rule.description[j];
|
||||||
|
description += `${line}\n`;
|
||||||
|
}
|
||||||
|
|
||||||
|
embed.setDescription(description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context.message.channel.send(embed);
|
||||||
}
|
}
|
||||||
} else { // If the rules file doesn't exist
|
} else { // If the rules file doesn't exist
|
||||||
const errorEmbed = new MessageEmbed()
|
const errorEmbed = new MessageEmbed()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"token": "",
|
"token": "",
|
||||||
"prefix": "d!",
|
"prefix": "v!",
|
||||||
"commands": [
|
"commands": [
|
||||||
"commands"
|
"commands"
|
||||||
],
|
],
|
||||||
|
@ -9,10 +9,10 @@
|
||||||
],
|
],
|
||||||
"about": {
|
"about": {
|
||||||
"description": "Discord Bot for Vylpes' Den",
|
"description": "Discord Bot for Vylpes' Den",
|
||||||
"version": "2.1",
|
"version": "2.2",
|
||||||
"core-ver": "1.0.4",
|
"core-ver": "1.0.4",
|
||||||
"author": "Vylpes",
|
"author": "Vylpes",
|
||||||
"date": "17-Feb-21"
|
"date": "22/04/2021"
|
||||||
},
|
},
|
||||||
"ban": {
|
"ban": {
|
||||||
"modrole": "Moderator",
|
"modrole": "Moderator",
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"adminrole": "Admin",
|
"adminrole": "Admin",
|
||||||
"rulesfile": "data/rules/rules.txt"
|
"rulesfile": "data/rules/rules.json"
|
||||||
},
|
},
|
||||||
"unmute": {
|
"unmute": {
|
||||||
"modrole": "Moderator",
|
"modrole": "Moderator",
|
||||||
|
|
84
data/rules/rules.json
Normal file
84
data/rules/rules.json
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"image": "https://i.imgur.com/bjH1gza.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Vylpes' Den",
|
||||||
|
"description": [
|
||||||
|
"Welcome to Vylpes' Den! Make sure to say hi!",
|
||||||
|
"Invite link: https://discord.gg/UyAhAVp"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Discord TOS",
|
||||||
|
"description": [
|
||||||
|
"All servers are required to follow the Discord Terms of Service. This includes minimum age requirements (13+). If the moderation team discover a breach of TOS we are required by discord to ban. Make sure you know them!",
|
||||||
|
"https://discord.com/terms"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Rules",
|
||||||
|
"description": [
|
||||||
|
"**English Only**",
|
||||||
|
"In order for everyone to understand each other we would like to ask everyone to speak in English only.",
|
||||||
|
"",
|
||||||
|
"**No NSFW or Obscene Content**",
|
||||||
|
"This includes text, images, or links featuring nudity, sex, hard violence, or other graphically disturbing content.",
|
||||||
|
"",
|
||||||
|
"**Treat Everyone with Respect**",
|
||||||
|
"Absolutely no harassment, witch hunting, sexism, racism, or hate speech will be tolerated.",
|
||||||
|
"",
|
||||||
|
"**No spam or self promotion**",
|
||||||
|
"Outside of #self-promo. This includes DMing fellow members.",
|
||||||
|
"",
|
||||||
|
"**Keep Politics to #general**",
|
||||||
|
"And make sure it doesn't become too heated. Debate don't argue.",
|
||||||
|
"",
|
||||||
|
"**Drama From Other Servers**",
|
||||||
|
"Please don't bring up drama from other servers, keep that to DMs",
|
||||||
|
"",
|
||||||
|
"**Bot Abuse**",
|
||||||
|
"Don't abuse the bots or you will be blocked from using them"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Moderators Discretion",
|
||||||
|
"description": [
|
||||||
|
"Don't argue with a mod's decision. A moderator's choice is final. If you have an issue with a member of the mod team DM me (Vylpes#0001)."
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Supporters",
|
||||||
|
"description": [
|
||||||
|
"If you are a Twitch Subscriber or a Patreon Member and have linked your profiles to your discord account you will get exclusive access to the Vylpes Plus channels, including early access to videos!"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Self-Assignable Roles",
|
||||||
|
"description": [
|
||||||
|
"If you want to assign yourself roles, go to #bot-stuff and type v!role <role>. The current roles you can get are:",
|
||||||
|
"Notify: Get pinged when a new stream or video releases.",
|
||||||
|
"VotePings: Get pinged when I start a new poll",
|
||||||
|
"ProjectUpdates: Get pinged when I update my projects as well as new for them"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "VylBot",
|
||||||
|
"description": [
|
||||||
|
"This server uses a bot made by me, VylBot, to help moderate the server.",
|
||||||
|
"For more information on it, see the GitHub repositories:",
|
||||||
|
"https://github.com/Vylpes/vylbot-core",
|
||||||
|
"https://github.com/Vylpes/vylbot-app"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Links",
|
||||||
|
"description": [
|
||||||
|
"YouTube: https://www.youtube.com/channel/UCwPlzKwCmP5Q9bCX3fHk2BA",
|
||||||
|
"Patreon: https://www.patreon.com/vylpes",
|
||||||
|
"Twitch: https://www.twitch.tv/vylpes_",
|
||||||
|
"Twitter: https://twitter.com/vylpes"
|
||||||
|
],
|
||||||
|
"footer": "Last updated 22/04/2021"
|
||||||
|
}
|
||||||
|
]
|
|
@ -1,41 +0,0 @@
|
||||||
> #https://i.imgur.com/bjH1gza.png
|
|
||||||
> Vylpes' Den
|
|
||||||
Welcome to Vylpes' Den! Make sure to say hi!
|
|
||||||
Invite link: https://discord.gg/UyAhAVp
|
|
||||||
> Discord TOS
|
|
||||||
All servers are required to follow the Discord Terms of Service. This includes minimum age requirements (13+). If the moderation team discover a breach of TOS we are required by discord to ban. Make sure you follow them! - https://discord.com/terms
|
|
||||||
> Rules
|
|
||||||
- **English Only**
|
|
||||||
In order for everyone to understand each other we would like to ask everyone to speak in English only.
|
|
||||||
|
|
||||||
- **No NSFW or Obscene Content**
|
|
||||||
This includes text, images, or links featuring nudity, sex, hard violence, or other graphically disturbing content.
|
|
||||||
|
|
||||||
- **Treat Everyone with Respect**
|
|
||||||
Absolutely no harassment, witch hunting, sexism, racism, or hate speech will be tolerated.
|
|
||||||
|
|
||||||
- **No spam or self promotion**
|
|
||||||
Outside of #self-promo. This includes DMing fellow members.
|
|
||||||
|
|
||||||
- **Keep Politics to #general**
|
|
||||||
And make sure it doesn't become too heated. Debate don't argue.
|
|
||||||
|
|
||||||
- **Drama From Other Servers**
|
|
||||||
Please don't bring up drama from other servers, keep that to DMs
|
|
||||||
|
|
||||||
- **Bot Abuse**
|
|
||||||
Don't abuse the bots or you will be blocked from using them
|
|
||||||
|
|
||||||
> Moderators Discretion
|
|
||||||
Don't argue with a mod's decision. A moderator's choice is final. If you have an issue with a member of the mod team DM me (Vylpes#0001).
|
|
||||||
> Supporters
|
|
||||||
If you are a Twitch Subscriber or a Patreon Member and have linked your profiles to your discord account you will get exclusive access to the Vylpes Plus channels, including early access to videos!
|
|
||||||
> Self-Assignable Roles
|
|
||||||
If you want to assign yourself roles, go to #bot-stuff and type v!role <role>. The current roles you can get are:
|
|
||||||
Notify: Get pinged when a new stream or video releases.
|
|
||||||
> Links
|
|
||||||
YouTube: https://www.youtube.com/channel/UCwPlzKwCmP5Q9bCX3fHk2BA
|
|
||||||
Patreon: https://www.patreon.com/vylpes
|
|
||||||
Twitch: https://www.twitch.tv/vylpes_
|
|
||||||
Twitter: https://twitter.com/vylpes
|
|
||||||
|
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
"name": "vylbot-app",
|
"name": "vylbot-app",
|
||||||
"version": "1.0.0",
|
"version": "2.1.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"version": "1.0.0",
|
"version": "2.1.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"emoji-regex": "^9.2.0",
|
"emoji-regex": "^9.2.0",
|
||||||
|
|
Loading…
Reference in a new issue