Compare commits
199
Commits
SupportBot
...
5.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d96ccc3265 | ||
|
|
018ef19efd | ||
|
|
159317a15a | ||
|
|
34583c96bf | ||
|
|
887d3d3ab4 | ||
|
|
f2de39de33 | ||
|
|
8173c31a60 | ||
|
|
80a2871741 | ||
|
|
3b37e9c420 | ||
|
|
730ba561bc | ||
|
|
4d7ddc9d6f | ||
|
|
680f71a602 | ||
|
|
170a7b50b9 | ||
|
|
805c48c1bb | ||
|
|
7d92ed51bb | ||
|
|
f849897f29 | ||
|
|
75e0f1ad1e | ||
|
|
2f015aff2b | ||
|
|
bb322adb2f | ||
|
|
6ee0981885 | ||
|
|
877fb0f201 | ||
|
|
ded4b9094a | ||
|
|
36ab931998 | ||
|
|
20baddfcca | ||
|
|
d180c147db | ||
|
|
86fa91cc52 | ||
|
|
b8c12a0307 | ||
|
|
eff2f9c195 | ||
|
|
8a8597afef | ||
|
|
067e619488 | ||
|
|
f7f8bc8c55 | ||
|
|
0c71fd7e59 | ||
|
|
5b2bd21c06 | ||
|
|
9ac68f68e2 | ||
|
|
aa32f00b0d | ||
|
|
bd5f5dffad | ||
|
|
645ad63f4f | ||
|
|
c83c6afecc | ||
|
|
689a191d4c | ||
|
|
5767ba0de5 | ||
|
|
cdf78f2598 | ||
|
|
d23f46ad9e | ||
|
|
8453fa5007 | ||
|
|
0bd990a9e3 | ||
|
|
9c8ee1471b | ||
|
|
87262e82a3 | ||
|
|
953db88ed2 | ||
|
|
a44bb949eb | ||
|
|
9d11369059 | ||
|
|
8c92f39349 | ||
|
|
bce9d733d3 | ||
|
|
525c216401 | ||
|
|
c145e9f11d | ||
|
|
53700003f1 | ||
|
|
03094a4c35 | ||
|
|
934ebed24f | ||
|
|
9f469e1637 | ||
|
|
77fe39774d | ||
|
|
186d688ec8 | ||
|
|
de3181b5c7 | ||
|
|
6d53234f7a | ||
|
|
b0d3673f4b | ||
|
|
e40083f585 | ||
|
|
f7b702fa29 | ||
|
|
5089a19a56 | ||
|
|
d77e9842aa | ||
|
|
88ae76a25a | ||
|
|
9b0b0d10a1 | ||
|
|
68340a8b02 | ||
|
|
d14f0966d5 | ||
|
|
e4b83f28c4 | ||
|
|
1925deec90 | ||
|
|
e9ba960b29 | ||
|
|
821f0f5b60 | ||
|
|
8fa8915673 | ||
|
|
5405aa469e | ||
|
|
cfa50b4e8c | ||
|
|
c5014baeb4 | ||
|
|
c14f120ec2 | ||
|
|
b72fcf39da | ||
|
|
6da3b0cba0 | ||
|
|
752387a02d | ||
|
|
32d3e1b957 | ||
|
|
a029dff202 | ||
|
|
89e1b85a56 | ||
|
|
4350eb709c | ||
|
|
2b1b6e916e | ||
|
|
3f6f9045bd | ||
|
|
8294496faa | ||
|
|
9f58118ecd | ||
|
|
3ba9d42587 | ||
|
|
e496a5f3d0 | ||
|
|
04e2bb29b0 | ||
|
|
131a7a015c | ||
|
|
6f430f5f14 | ||
|
|
0154c106ef | ||
|
|
04de6e6fc0 | ||
|
|
2b17e5f842 | ||
|
|
0dc8c1e68a | ||
|
|
67b291eb09 | ||
|
|
d7865a5a4e | ||
|
|
d1809587a8 | ||
|
|
64ec4dfd53 | ||
|
|
6e07d21a3d | ||
|
|
018e47bd53 | ||
|
|
065a2e9347 | ||
|
|
b53307c7fd | ||
|
|
e4cc0d960e | ||
|
|
3336824df7 | ||
|
|
166173d53c | ||
|
|
45da2d7924 | ||
|
|
af14a65ef5 | ||
|
|
9049a4b9ad | ||
|
|
2f4873ab9a | ||
|
|
0fb25d71dc | ||
|
|
34b6901434 | ||
|
|
a90b43aba3 | ||
|
|
0ac5c2c300 | ||
|
|
6290fee7bd | ||
|
|
320992f3fa | ||
|
|
bd714f0c93 | ||
|
|
45d3867c1f | ||
|
|
deafa66565 | ||
|
|
ce8fcdaa7a | ||
|
|
b83965c144 | ||
|
|
2505a8cab8 | ||
|
|
21e598bb31 | ||
|
|
ee2f3c0dfc | ||
|
|
197bda14b8 | ||
|
|
d416c2e421 | ||
|
|
6bc2e669e4 | ||
|
|
9accb65256 | ||
|
|
d9212584ca | ||
|
|
1a7effb422 | ||
|
|
1480435f15 | ||
|
|
64c6a97657 | ||
|
|
7ae2ff9837 | ||
|
|
f19dec405d | ||
|
|
bbd4e9d162 | ||
|
|
58deff0869 | ||
|
|
628632f43e | ||
|
|
436586117c | ||
|
|
7234ec728c | ||
|
|
fc4d68be39 | ||
|
|
bcf2df4bff | ||
|
|
70a469a951 | ||
|
|
981995cb32 | ||
|
|
406c7d368b | ||
|
|
5c266d8b8d | ||
|
|
4f5b94a491 | ||
|
|
284c83cc1d | ||
|
|
23f06af202 | ||
|
|
82be317595 | ||
|
|
a43c76529f | ||
|
|
26065c2a5c | ||
|
|
6b1dfe01cf | ||
|
|
72443fb7c6 | ||
|
|
28cad23746 | ||
|
|
ebc0d4b137 | ||
|
|
4b198acda7 | ||
|
|
b84c3c75a5 | ||
|
|
de0ec97d9b | ||
|
|
a8302cd276 | ||
|
|
35d8d77f15 | ||
|
|
f853394d9d | ||
|
|
500c01dd1f | ||
|
|
71bfccfb0c | ||
|
|
71e1b64818 | ||
|
|
2118a00a36 | ||
|
|
1c69c21f21 | ||
|
|
31c76fc1c0 | ||
|
|
d31cdf8af2 | ||
|
|
29b5fd2c6f | ||
|
|
aa32525f8c | ||
|
|
f6a67a3373 | ||
|
|
4f78858641 | ||
|
|
c7e70bdaf8 | ||
|
|
5479e0957b | ||
|
|
8500554cfb | ||
|
|
368727cece | ||
|
|
742faf3805 | ||
|
|
7d08cbed84 | ||
|
|
f413bb5f3c | ||
|
|
2b3edc7b45 | ||
|
|
83f982f8d2 | ||
|
|
890a1d41b1 | ||
|
|
996a2c26ca | ||
|
|
fadf042101 | ||
|
|
a819078d7f | ||
|
|
2c9b4c663d | ||
|
|
22e6803e14 | ||
|
|
61cecb112f | ||
|
|
0c18aff34d | ||
|
|
599649a97f | ||
|
|
45194b82da | ||
|
|
570d0985d3 | ||
|
|
5eae625b28 | ||
|
|
fcc5460ff2 | ||
|
|
07d45e50de |
No files matched your search
+18
@@ -0,0 +1,18 @@
|
||||
FROM node:alpine
|
||||
|
||||
MAINTAINER Thien Tran, <contact@thientran.io>
|
||||
|
||||
RUN apk update \
|
||||
&& apk upgrade
|
||||
|
||||
RUN apk add --no-cache git && \
|
||||
adduser -D -h /home/container container
|
||||
|
||||
# Ensure UTF-8
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LC_ALL en_US.UTF-8
|
||||
|
||||
WORKDIR /home/container
|
||||
|
||||
COPY ./entrypoint.sh /entrypoint.sh
|
||||
CMD ["/bin/ash", "/entrypoint.sh"]
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Emerald Services
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,94 +1,5 @@
|
||||
<h1 align="center">SupportBot v3.4</h1>
|
||||
<h4 align="center">A Self Hosted discord application</h4>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://discord.gg/hmWgxdF">
|
||||
<img src="https://discordapp.com/api/guilds/516345301985132552/widget.png?style=shield" alt="Discord Server">
|
||||
</a>
|
||||
<img src="https://img.shields.io/badge/Made%20with-NodeJS-blue.svg" alt="Made with NodeJS">
|
||||
</p>
|
||||
|
||||
SupportBot is a free & open source discord bot for your server that has the capability to control & manage your servers support.
|
||||
|
||||
| Version | Supported | Type |
|
||||
| ------- | ------------------ |--------------------|
|
||||
| 1.0.x | ❌ | None |
|
||||
| 2.0.x | ⚠ | Community |
|
||||
| 3.0.x | ✅ | Priority |
|
||||
| 4.0.x | ❌ | N/A |
|
||||
| Premium | ❌ | N/A |
|
||||
|
||||
# Getting Started
|
||||
Firstly you will need to download the resource, Once you have downloaded the resource open a new tab in your browser and go to https://discordapp.com/developers/applications/. Create a new application and then open your app and select bot and then create your bot. Copy the bot token and paste it where it says ``"token": "BOT TOKEN HERE",`` in the ``settings.json`` file.
|
||||
|
||||
# Invite the bot
|
||||
Head back to discord developers portal where your application is and head into the ``OAuth`` tab and select bot and then below select ``Administrator`` then copy the link and paste into your browser and it should as your to invite the bot to a server.
|
||||
|
||||
# Configurating SupportBot
|
||||
Once you have setup your discord application such as invited the bot and added your bot token to the ``settings.json`` we can begin configurating your bot. Firstly open up the ``settings.json`` file and you will see loads of different things to config. You will see the following below:
|
||||
|
||||
```
|
||||
"prefix": "!",
|
||||
"botname": "SupportBot",
|
||||
"colour": "#42f477",
|
||||
"footer": "Support Bot, By Emerald",
|
||||
|
||||
"BotStatus": "Support Bot",.
|
||||
|
||||
"staff": "Staff",
|
||||
"support": "Support Team",
|
||||
"everyone": "@everyone",
|
||||
|
||||
"category": "Tickets",
|
||||
"Ticket_Message": "Your support ticket has been opened successfully\nPlease allow us some time to reach out to you.",
|
||||
"Ticket_Logs": "ticket-logs",
|
||||
|
||||
"Announcement_Title": "SupportBot Announcement",
|
||||
"Announcement_Channel": "announcements",
|
||||
|
||||
"Welcome_Message": "Welcome to the server!",
|
||||
"Welcome_Channel": "welcome",
|
||||
|
||||
"Leave_Message": "Thank you for visiting us!",
|
||||
"Leave_Channel": "welcome",
|
||||
|
||||
"Poll_Channel": "polls",
|
||||
"Poll_Title": "📊 Polls",
|
||||
"Reaction_Poll_1": "✅",
|
||||
"Reaction_Poll_2": "❎",
|
||||
|
||||
"Suggestion_Title": "SupportBot Suggestions",
|
||||
"Suggestion_Channel": "suggestions",
|
||||
"suggestyes": "✅",
|
||||
"suggestno": "❎",
|
||||
|
||||
"LINK_1_NAME": "Discord",
|
||||
"LINK_2_NAME": "Twitter",
|
||||
"LINK_3_NAME": "Website",
|
||||
|
||||
"LINK_1": "https://dicord.gg/changemeinconfig",
|
||||
"LINK_2": "https://twitter.com/changemeinconfig",
|
||||
"LINK_3": "https://www.example.com/",
|
||||
|
||||
"LINKS_TITLE": "SupportBot Links",
|
||||
|
||||
"Ticket_Command": "ticket",
|
||||
"Suggest_Command": "suggest",
|
||||
"Say_Command": "say",
|
||||
"Remove_Command": "remove",
|
||||
"Add_Command": "add",
|
||||
"Ping_Command": "ping",
|
||||
"Close_Command": "close",
|
||||
"Forceclose_Command": "forceclose",
|
||||
"Rename_Command": "rename",
|
||||
"Help_Command": "help",
|
||||
"Link_Command": "links",
|
||||
"Lockchat_Command": "lock",
|
||||
"UnLockchat_Command": "unlock",
|
||||
"Poll_Command": "poll"
|
||||
```
|
||||
|
||||
# Contributors List
|
||||
|
||||
# Donators List
|
||||
|
||||
<h1 align="center">SupportBot</h1>
|
||||
<p align="center">Created by Emerald SRV</p>
|
||||
<p align="center"> SupportBot is a free self-hosted discord that is developed/designed to help control and manage the support that takes place throughout your discord server(s). SupportBot has been going around since late-2018 and it's still being constantly, updated and supported today. Alongside the core features of SupportBot which is support related features such as tickets etc.. we also allow additional addons which are made by both 3rd-party and official developers. If something goes wrong with SupportBot you can simply come to our discord server and contact us. We will be happy to help. Also! if anyone ever tells you that "nothing is free" then tell them to think again. Sometimes you just have to look a little harder to find what you want.</p>
|
||||
Version 5.2
|
||||
<hr>
|
||||
+36
-44
@@ -1,60 +1,52 @@
|
||||
// SupportBot
|
||||
// Command: Add User
|
||||
// Created by © 2020 Emerald Services
|
||||
// Command: Add
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const bot = new Discord.Client()
|
||||
|
||||
bot.settings = require("../settings.json");
|
||||
const fs = require("fs")
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
module.exports.run = async (bot, message, args) => {
|
||||
message.delete()
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Add_Command}`)
|
||||
exports.run = (bot, message, args) => {
|
||||
|
||||
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === bot.settings.support)
|
||||
console.log(`\u001b[33m`, `[${supportbot.Bot_Name}] > `, `\u001b[31;1m`, `${message.author.tag}`, `\u001b[32;1m`, `has executed`, `\u001b[31;1m`, `${supportbot.Prefix}${supportbot.Add_Command}`);
|
||||
|
||||
let staffGroup = message.guild.roles.cache.find(staffRole => staffRole.name === supportbot.StaffRole);
|
||||
|
||||
const rolemissing = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.support}**`)
|
||||
.setColor(bot.settings.colour)
|
||||
if (!staffGroup) return message.reply({embed: rolemissing});
|
||||
const rolerequired = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Incorrect Permissions, You cannot execute this command as you do not have the required role.\n\nRole Required: \`${supportbot.StaffRole}\`\n\nError Code: \`SB-02\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
if (!message.member.roles.cache.has(staffGroup.id)) return message.reply({embed: rolerequired});
|
||||
|
||||
const donothaverole = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.support}**`)
|
||||
.setColor(bot.settings.colour)
|
||||
if (!message.member.roles.has(staffGroup.id)) return message.reply({embed: donothaverole});
|
||||
const outsideticket = new Discord.MessageEmbed()
|
||||
.setTitle("Incorrect Channel")
|
||||
.setDescription(`:warning: You cannot execute this command here. This command is used when closing a ticket.`)
|
||||
.setColor(supportbot.WarningColour);
|
||||
if (!message.channel.name.startsWith(`${supportbot.Ticket_Channel_Name}-`)) return message.channel.send({embed: outsideticket});
|
||||
|
||||
const outsideticket = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Cannot use this command becase you are outside a ticket channel.`)
|
||||
.setColor(bot.settings.colour)
|
||||
if (!message.channel.name.startsWith(`ticket-`)) return message.channel.send({embed: outsideticket});
|
||||
let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.cache.get(args[0]));
|
||||
|
||||
let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
|
||||
const cantfinduser = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid User!")
|
||||
.setDescription(`:warning: This user doesn't exist, Are they in this server?\n\nTry Again:\`${supportbot.Prefix}${supportbot.Add_Command} <user#0000>\``)
|
||||
.setColor(supportbot.WarningColour);
|
||||
if(!rUser) return message.channel.send({embed: cantfinduser});
|
||||
|
||||
const cantfinduser = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Hmm! Does that user exist? I cannot find the user.`)
|
||||
.setColor(bot.settings.colour)
|
||||
if(!rUser) return message.channel.send({embed: cantfinduser});
|
||||
message.channel.updateOverwrite(rUser, { VIEW_CHANNEL: true, CREATE_INVITE: false, SEND_MESSAGES: true, READ_MESSAGES: true });
|
||||
|
||||
const channel = message.guild.channels.find(channel => channel.name === message.channel.name);
|
||||
|
||||
const cantfindchannel = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Hmm! Does that ticket exist? I cannot find the ticket channel.`)
|
||||
.setColor(bot.settings.colour)
|
||||
if(!channel) return message.channel.send({embed: cantfindchannel});
|
||||
message.delete().catch(O_o=>{});
|
||||
|
||||
message.channel.overwritePermissions(rUser, { READ_MESSAGES: true, SEND_MESSAGES: true });
|
||||
|
||||
const useradded = new Discord.RichEmbed()
|
||||
.setColor(bot.settings.colour)
|
||||
.setDescription(`:white_check_mark: Successfully Added ${rUser} to the ticket.`)
|
||||
.setTimestamp();
|
||||
|
||||
message.channel.send({embed: useradded});
|
||||
console.log(`\x1b[36m`, `${message.author} has successfully added ${rUser} to ${message.channel}`)
|
||||
|
||||
}
|
||||
const useradded = new Discord.MessageEmbed()
|
||||
.setColor(supportbot.SuccessColour)
|
||||
.setTitle("User Added")
|
||||
.setDescription(`👍 ${rUser} has been added to this ticket`)
|
||||
.setTimestamp();
|
||||
message.channel.send({embed: useradded});
|
||||
|
||||
};
|
||||
|
||||
exports.help = {
|
||||
name: bot.settings.Add_Command,
|
||||
}
|
||||
name: supportbot.Add_Command,
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
// SupportBot
|
||||
// Created by © 2020 Emerald Services
|
||||
// Command: Announce (including @everyone)
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const bot = new Discord.Client();
|
||||
|
||||
const fs = require("fs")
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
exports.run = (bot, message, args) => {
|
||||
|
||||
console.log(`\u001b[33m`, `[${supportbot.Bot_Name}] > `, `\u001b[31;1m`, `${message.author.tag}`, `\u001b[32;1m`, `has executed`, `\u001b[31;1m`, `${supportbot.Prefix}${supportbot.Announcement_Command}`);
|
||||
|
||||
let staffGroup = message.guild.roles.cache.find(staffRole => staffRole.name === supportbot.StaffRole);
|
||||
|
||||
const rolerequired = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Incorrect Permissions, You cannot execute this command as you do not have the required role.\n\nRole Required: \`${supportbot.StaffRole}\`\n\nError Code: \`SB-02\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
if (!message.member.roles.cache.has(staffGroup.id)) return message.reply({embed: rolerequired});
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(`${supportbot.Announcement_Title}`)
|
||||
.setDescription(args.join(" "))
|
||||
.setTimestamp()
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(`${message.author.username}#${message.author.discriminator}`, message.author.displayAvatarURL)
|
||||
|
||||
let locateChannel = message.guild.channels.cache.find(LocateChannel => LocateChannel.name === `${supportbot.Announcement_Channel}`)
|
||||
|
||||
const errornochannel = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Channel not Found, This command cannot be executed proberbly as their is no channel within this server.\nThis is configurable via **supportbot-config.yml**\n\nChannel Required: \`${supportbot.Announcement_Channel}\`\n\nError Code: \`SB-03\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
if(!locateChannel) return message.channel.send(errornochannel);
|
||||
|
||||
locateChannel.send(supportbot.everyone).then((msg) => {
|
||||
locateChannel.send(embed);
|
||||
});
|
||||
|
||||
|
||||
const AccSuccessEmbed = new Discord.MessageEmbed()
|
||||
.setTitle("Announcement Created")
|
||||
.setDescription(`👍 Successfully sent your announcement to <#${locateChannel.id}>`)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
message.channel.send({embed: AccSuccessEmbed});
|
||||
|
||||
}
|
||||
|
||||
exports.help = {
|
||||
name: supportbot.Announcement_Command,
|
||||
}
|
||||
+101
-28
@@ -1,43 +1,116 @@
|
||||
// SupportBot
|
||||
// Command: Close Ticket
|
||||
// Created by © 2020 Emerald Services
|
||||
// Command: Close
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const bot = new Discord.Client()
|
||||
const bot = new Discord.Client();
|
||||
|
||||
bot.settings = require("../settings.json");
|
||||
const fs = require("fs");
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
/**
|
||||
* @param {Discord.Message} message
|
||||
*/
|
||||
|
||||
exports.run = (bot, message, args) => {
|
||||
message.delete();
|
||||
|
||||
const outsideticket = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Cannot use this command becase you are outside a ticket channel.`)
|
||||
.setColor(bot.settings.colour)
|
||||
if (!message.channel.name.startsWith(`ticket-`)) return message.channel.send({embed: outsideticket});
|
||||
const close1 = new Discord.RichEmbed()
|
||||
.setDescription(`Looks like you have come to the end of your support ticket\nPlease confirm that you want to close your ticket by saying ||**confirm**||`)
|
||||
.setFooter("Your request will be avoided in 20 seconds")
|
||||
.setColor(bot.settings.colour)
|
||||
message.channel.send({embed: close1}).then(m => {
|
||||
message.channel.awaitMessages(response => response.content === `confirm`, {
|
||||
max: 1,
|
||||
time: 10000,
|
||||
errors: ['time'],
|
||||
console.log(`\u001b[33m`, `[${supportbot.Bot_Name}] > `, `\u001b[31;1m`, `${message.author.tag}`, `\u001b[32;1m`, `has executed`, `\u001b[31;1m`, `${supportbot.Prefix}${supportbot.Close_Command}`);
|
||||
|
||||
}).then((collected) => {
|
||||
message.channel.delete();
|
||||
if ( !message.channel.name.startsWith( `${supportbot.Ticket_Channel_Name}-` ) ) {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle("Incorrect Channel")
|
||||
.setDescription(`:warning: You cannot execute this command here. This command is used when closing a ticket.`)
|
||||
.setColor(supportbot.WarningColour);
|
||||
message.channel.send(embed);
|
||||
return;
|
||||
}
|
||||
|
||||
}).catch(() => {
|
||||
m.edit('Close ticket request, timedout').then(m2 => {
|
||||
m2.delete();
|
||||
}, 3000);
|
||||
const closeRequestEmbed = new Discord.MessageEmbed()
|
||||
.setDescription(`**${supportbot.Ticket_Closure}**`)
|
||||
.addField("Please confirm by repeating the following word..", `||**${supportbot.Closure_Confirm_Word}**||`)
|
||||
.setFooter("Your request will be avoided in 20 seconds")
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
|
||||
message.channel.send(closeRequestEmbed).then( m => {
|
||||
message.channel.awaitMessages( response => response.content.toLowerCase() === supportbot.Closure_Confirm_Word, {
|
||||
max: 1,
|
||||
time: 20000,
|
||||
errors: [ 'time' ],
|
||||
|
||||
} ).then( collected => {
|
||||
let logChannel = message.guild.channels.cache.find(channel => channel.name === supportbot.Transcript_Log);
|
||||
|
||||
let user = message.author;
|
||||
|
||||
let reason = args.join(" ") || "No reason provided.";
|
||||
|
||||
let name = message.channel.name;
|
||||
let ticketChannel = message.channel;
|
||||
|
||||
message.channel.send(`**${supportbot.Ticket_Closing}**`)
|
||||
.then(() => {
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.Transcript_Title)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
.addField("Ticket Author", user)
|
||||
.addField("Closed By", message.author.tag)
|
||||
.addField("Reason", reason);
|
||||
|
||||
message.channel.messages.fetch({ limit: 100 })
|
||||
.then( msgs => {
|
||||
let txt = '';
|
||||
|
||||
msgs = msgs.sort( ( a, b ) => a.createdTimestamp - b.createdTimestamp );
|
||||
|
||||
txt += `${message.guild.name}\n`;
|
||||
txt += `#${ticketChannel.name}\n`;
|
||||
txt += `${msgs.size} messages\n\n\n`;
|
||||
|
||||
msgs.forEach( msg => {
|
||||
if ( msg.content ) {
|
||||
txt += `----- ${msg.author.tag} at ${msg.createdAt}\n`;
|
||||
txt += `${msg.content}\n`;
|
||||
txt += `-----\n\n`;
|
||||
}
|
||||
} );
|
||||
|
||||
// message.author.send( `A transcript has been generated for the ticket you closed.` );
|
||||
// message.author.send( new Discord.Attachment( Buffer.from( txt ), `${name}.txt` ) );
|
||||
|
||||
logChannel.send(logEmbed).catch(err => {
|
||||
message.reply(err)
|
||||
})
|
||||
logChannel.send( new Discord.MessageAttachment( Buffer.from( txt ), `${name}.txt` ) );
|
||||
|
||||
message.channel.delete();
|
||||
|
||||
// message.channel.messages.fetch( { limit: 100, before: msgs.last().id } )
|
||||
|
||||
// .then( msg => {
|
||||
// const merged = msgs.concat( msg );
|
||||
// const output = merged.reduce( ( out, msg ) => {
|
||||
// out += `[${message.createdAt}] ${message.author.tag}: ${message.cleanContent ? message.cleanContent.replace( /\n/g, '\r\n' ) : ''}\r\n`;
|
||||
// return out;
|
||||
// }, '' );
|
||||
|
||||
// log.send( { files: [ { attachment: Buffer.from( output, 'utf8' ), name: `${name}.txt` } ] } ).then( c.delete() ).catch( console.error ); // sends the file to logs
|
||||
// return log.send( embed1 ).catch( console.error );
|
||||
// } )
|
||||
});
|
||||
})
|
||||
|
||||
}).catch( () => {
|
||||
m.edit('The request to close the ticket has timed out.').then( m2 => m2.delete( 3000 ) );
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Close_Command}`)
|
||||
|
||||
}
|
||||
|
||||
|
||||
exports.help = {
|
||||
name: bot.settings.Close_Command,
|
||||
}
|
||||
name: supportbot.Close_Command,
|
||||
}
|
||||
+56
-22
@@ -1,36 +1,70 @@
|
||||
// SupportBot
|
||||
// Command: Forceclose Ticket
|
||||
// Created by © 2020 Emerald Services
|
||||
// Command: Forceclose
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const bot = new Discord.Client()
|
||||
|
||||
bot.settings = require("../settings.json");
|
||||
const fs = require("fs")
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
exports.run = (bot, message, args) => {
|
||||
message.delete();
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === `${bot.settings.support}`)
|
||||
|
||||
const rolemissing = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.support}**`)
|
||||
.setColor(bot.settings.colour)
|
||||
if (!staffGroup) return message.reply({embed: rolemissing});
|
||||
exports.run = async (bot, message, args) => {
|
||||
|
||||
const donothaverole = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.support}**`)
|
||||
.setColor(bot.settings.colour)
|
||||
if (!message.member.roles.has(staffGroup.id)) return message.reply({embed: donothaverole});
|
||||
console.log(`\u001b[33m`, `[${supportbot.Bot_Name}] > `, `\u001b[31;1m`, `${message.author.tag}`, `\u001b[32;1m`, `has executed`, `\u001b[31;1m`, `${supportbot.Prefix}${supportbot.Forceclose_Command}`);
|
||||
|
||||
const outsideticket = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Cannot use this command becase you are outside a ticket channel.`)
|
||||
.setColor(bot.settings.colour)
|
||||
if (!message.channel.name.startsWith(`ticket-`)) return message.channel.send({embed: outsideticket});
|
||||
message.channel.delete();
|
||||
let staffGroup = message.guild.roles.cache.find(staffRole => staffRole.name === supportbot.StaffRole);
|
||||
|
||||
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Forceclose_Command}`)
|
||||
const rolerequired = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Incorrect Permissions, You cannot execute this command as you do not have the required role.\n\nRole Required: \`${supportbot.StaffRole}\`\n\nError Code: \`SB-02\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
if (!message.member.roles.cache.has(staffGroup.id)) return message.reply({embed: rolerequired});
|
||||
|
||||
const outsideticket = new Discord.MessageEmbed()
|
||||
.setTitle("Incorrect Channel")
|
||||
.setDescription(`:warning: You cannot execute this command here. This command is used when closing a ticket.`)
|
||||
.setColor(supportbot.WarningColour);
|
||||
if (!message.channel.name.startsWith(`${supportbot.Ticket_Channel_Name}-`)) return message.channel.send({embed: outsideticket});
|
||||
|
||||
const log = message.guild.channels.cache.find(channel => channel.name === supportbot.Transcript_Log)
|
||||
const uID = message.author
|
||||
const reason = args.join(" ") || "No Reason Provided.";
|
||||
const name = message.channel.name;
|
||||
const c = message.channel;
|
||||
|
||||
message.channel.send(`Your ticket is currently closing`)
|
||||
|
||||
.then(() => {
|
||||
|
||||
const embed1 = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.Transcript_Title)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
.addField("Ticket Author", uID)
|
||||
.addField("Closed By", message.author.tag)
|
||||
.addField("Reason", reason)
|
||||
message.channel.messages.fetch({ limit: 100 })
|
||||
|
||||
.then(msgs => {
|
||||
message.channel.messages.fetch({ limit: 100, before: msgs.last().id })
|
||||
|
||||
.then(msg => {
|
||||
const merged = msgs.concat(msg);
|
||||
const output = merged.reduce((out, msg) => {
|
||||
out += `[${message.createdAt}] ${message.author.tag}: ${message.cleanContent ? message.cleanContent.replace(/\n/g, '\r\n') : ''}\r\n`;
|
||||
return out;
|
||||
}, '');
|
||||
|
||||
log.send({ files: [{ attachment: Buffer.from(output, 'utf8'), name: `${name}.txt` }] }).then(c.delete()).catch(console.error); // sends the file to logs
|
||||
return log.send(embed1).catch(console.error);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
exports.help = {
|
||||
name: bot.settings.Forceclose_Command,
|
||||
}
|
||||
name: supportbot.Forceclose_Command,
|
||||
}
|
||||
+33
-27
@@ -1,46 +1,52 @@
|
||||
// SupportBot
|
||||
// Created by © 2020 Emerald Services
|
||||
// Command: Help
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const bot = new Discord.Client()
|
||||
|
||||
bot.settings = require("../settings.json");
|
||||
const fs = require("fs")
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
exports.run = (bot, message, args) => {
|
||||
message.delete();
|
||||
|
||||
console.log(`\u001b[33m`, `[${supportbot.Bot_Name}] > `, `\u001b[31;1m`, `${message.author.tag}`, `\u001b[32;1m`, `has executed`, `\u001b[31;1m`, `${supportbot.Prefix}${supportbot.Help_Command}`);
|
||||
|
||||
let userCommands = "";
|
||||
userCommands += `**${bot.settings.prefix}${bot.settings.Link_Command}**: Get some important links!\n`;
|
||||
userCommands += `**${bot.settings.prefix}${bot.settings.Ping_Command}**: Check the bots ping. Pong!\n`;
|
||||
userCommands += `**${bot.settings.prefix}${bot.settings.Ticket_Command} <reason>**: Create a support ticket\n`;
|
||||
userCommands += `**${bot.settings.prefix}${bot.settings.Close_Command}**: Close your support ticket\n`;
|
||||
userCommands += `**${bot.settings.prefix}${bot.settings.Suggest_Command} <suggestion>**: Create a server suggestion\n`;
|
||||
userCommands += `**${supportbot.Prefix}${supportbot.Ticket_Command} <reason>**: Create a support ticket\n`;
|
||||
userCommands += `**${supportbot.Prefix}${supportbot.Close_Command}**: Close your support ticket\n`;
|
||||
userCommands += `**${supportbot.Prefix}${supportbot.Suggest_Command} <suggestion>**: Create a server suggestion\n`;
|
||||
userCommands += `**${supportbot.Prefix}${supportbot.Report_Command} <user> <reason>**: Report a valid user\n`;
|
||||
userCommands += `**${supportbot.Prefix}${supportbot.Link_Command}**: Get some important links!\n`;
|
||||
userCommands += `**${supportbot.Prefix}${supportbot.Ping_Command}**: Check the bots ping. Pong!\n`;
|
||||
|
||||
let supportCommands = "";
|
||||
supportCommands += `**${bot.settings.prefix}${bot.settings.Add_Command} <user>**: Adds a user to a ticket\n`;
|
||||
supportCommands += `**${bot.settings.prefix}${bot.settings.Remove_Command} <user>**: Removes a user from a ticket\n`;
|
||||
supportCommands += `**${bot.settings.prefix}${bot.settings.Forceclose_Command}**: Forceclose a support ticket\n`;
|
||||
supportCommands += `**${bot.settings.prefix}${bot.settings.Rename_Command}**: Rename a support ticket\n`;
|
||||
supportCommands += `**${supportbot.Prefix}${supportbot.Add_Command} <user>**: Adds a user to a ticket\n`;
|
||||
supportCommands += `**${supportbot.Prefix}${supportbot.Remove_Command} <user>**: Removes a user from a ticket\n`;
|
||||
supportCommands += `**${supportbot.Prefix}${supportbot.Forceclose_Command}**: Forceclose a support ticket\n`;
|
||||
supportCommands += `**${supportbot.Prefix}${supportbot.Rename_Command}**: Rename a support ticket\n`;
|
||||
|
||||
let staffCommands = "";
|
||||
staffCommands += `**${bot.settings.prefix}${bot.settings.Say_Command} <message>**: Create a bot announcement\n`;
|
||||
staffCommands += `**${bot.settings.prefix}${bot.settings.Lockchat_Command}**: Lock the chat channel\n`;
|
||||
staffCommands += `**${bot.settings.prefix}${bot.settings.UnLockchat_Command}**: UnLock the chat channel\n`;
|
||||
let staffCommands = "";
|
||||
staffCommands += `**${supportbot.Prefix}${supportbot.Announcement_Command} <message>**: Create a bot announcement\n`;
|
||||
staffCommands += `**${supportbot.Prefix}${supportbot.Say_Command} <message>**: Send a message as the bot\n`;
|
||||
staffCommands += `**${supportbot.Prefix}${supportbot.Lockchat_Command}**: Lock the chat channel\n`;
|
||||
staffCommands += `**${supportbot.Prefix}${supportbot.UnLockchat_Command}**: UnLock the chat channel\n`;
|
||||
staffCommands += `**${supportbot.Prefix}${supportbot.Poll_Command}**: Create a poll\n`;
|
||||
|
||||
const embed = new Discord.RichEmbed()
|
||||
.setTitle(bot.settings.botname)
|
||||
.addField(":ticket: Support Commands", userCommands)
|
||||
.addField(":pushpin: Support Commands", supportCommands, true)
|
||||
.addField(":pushpin: Staff Commands", staffCommands, true)
|
||||
.setColor(bot.settings.colour)
|
||||
.setFooter(bot.settings.footer, message.author.displayAvatarURL);
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.Bot_Name)
|
||||
.addField("🟨 User Commands", userCommands)
|
||||
.addField("🎫 Support Commands", supportCommands)
|
||||
.addField("🔐 Staff Commands", staffCommands)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter, message.author.displayAvatarURL);
|
||||
|
||||
message.channel.send(embed)
|
||||
|
||||
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Help_Command}`)
|
||||
message.channel.send(embed);
|
||||
|
||||
}
|
||||
|
||||
exports.help = {
|
||||
name: bot.settings.Help_Command,
|
||||
}
|
||||
name: supportbot.Help_Command,
|
||||
};
|
||||
+25
-19
@@ -1,30 +1,36 @@
|
||||
// SupportBot
|
||||
// Command: Help
|
||||
// Created by © 2020 Emerald Services
|
||||
// Command: Links
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const bot = new Discord.Client()
|
||||
const bot = new Discord.Client();
|
||||
|
||||
bot.settings = require("../settings.json");
|
||||
const fs = require("fs");
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
exports.run = (bot, message, args) => {
|
||||
message.delete();
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
let BotLinks = "";
|
||||
BotLinks += `[${bot.settings.LINK_1_NAME}](${bot.settings.LINK_1})\n`;
|
||||
BotLinks += `[${bot.settings.LINK_2_NAME}](${bot.settings.LINK_2})\n`;
|
||||
BotLinks += `[${bot.settings.LINK_3_NAME}](${bot.settings.LINK_3})\n`;
|
||||
exports.run = ( bot, message, args ) => {
|
||||
|
||||
const links = new Discord.RichEmbed()
|
||||
.setTitle(`${bot.settings.LINKS_TITLE}`)
|
||||
.setDescription(BotLinks)
|
||||
.setColor(bot.settings.colour)
|
||||
.setFooter(bot.settings.footer)
|
||||
message.channel.send(links)
|
||||
console.log(`\u001b[33m`, `[${supportbot.Bot_Name}] > `, `\u001b[31;1m`, `${message.author.tag}`, `\u001b[32;1m`, `has executed`, `\u001b[31;1m`, `${supportbot.Prefix}${supportbot.Link_Command}`);
|
||||
|
||||
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Link_Command}`)
|
||||
let botLinks = supportbot.LINKS;
|
||||
|
||||
}
|
||||
let links = '';
|
||||
|
||||
for ( let name in botLinks ) {
|
||||
links += `[${name}](${botLinks[ name ]})\n`;
|
||||
};
|
||||
|
||||
let embed = new Discord.MessageEmbed()
|
||||
.setTitle(supportbot.LINKS_TITLE)
|
||||
.setDescription(links)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter);
|
||||
message.channel.send(embed);
|
||||
|
||||
};
|
||||
|
||||
exports.help = {
|
||||
name: bot.settings.Link_Command,
|
||||
}
|
||||
name: supportbot.Link_Command,
|
||||
};
|
||||
+24
-24
@@ -1,38 +1,38 @@
|
||||
// SupportBot
|
||||
// Command: Lockchat
|
||||
// Created by © 2020 Emerald Services
|
||||
// Command: Close
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const bot = new Discord.Client()
|
||||
const bot = new Discord.Client();
|
||||
|
||||
bot.settings = require("../settings.json");
|
||||
const fs = require("fs");
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
exports.run = async(bot, message, args) => {
|
||||
message.delete();
|
||||
|
||||
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === `${bot.settings.staff}`)
|
||||
let everyoneRole = message.guild.roles.find(everyone => everyone.name === `${bot.settings.everyone}`)
|
||||
console.log(`\u001b[33m`, `[${supportbot.Bot_Name}] > `, `\u001b[31;1m`, `${message.author.tag}`, `\u001b[32;1m`, `has executed`, `\u001b[31;1m`, `${supportbot.Prefix}${supportbot.Lockchat_Command}`);
|
||||
|
||||
const rolemissing = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.staff}**`)
|
||||
.setColor(bot.settings.colour)
|
||||
if (!staffGroup) return message.reply(rolemissing).catch(err=>{console.error(err)})
|
||||
|
||||
const donothaverole = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.staff}**`)
|
||||
.setColor(bot.settings.colour)
|
||||
if (!message.member.roles.has(staffGroup.id)) return message.reply(donothaverole)
|
||||
let staffGroup = message.guild.roles.cache.find(staffRole => staffRole.name === `${supportbot.StaffRole}`)
|
||||
let lockedRole = message.guild.roles.cache.find(lc => lc.name === `${supportbot.locked_role}`)
|
||||
|
||||
const rolerequired = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Incorrect Permissions, You cannot execute this command as you do not have the required role.\n\nRole Required: \`${supportbot.StaffRole}\`\n\nError Code: \`SB-02\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
if (!message.member.roles.cache.has(staffGroup.id)) return message.reply({embed: rolerequired});
|
||||
|
||||
message.channel.overwritePermissions(everyoneRole, { READ_MESSAGES: false, SEND_MESSAGES: false });
|
||||
message.channel.overwritePermissions(lockedRole, { READ_MESSAGES: false, SEND_MESSAGES: false });
|
||||
message.channel.overwritePermissions(staffGroup, { READ_MESSAGES: true, SEND_MESSAGES: true });
|
||||
|
||||
const lockmsg = new Discord.RichEmbed()
|
||||
const lockmsg = new Discord.MessageEmbed()
|
||||
.setDescription(":white_check_mark: **Chat Locked**")
|
||||
.setColor(bot.settings.colour)
|
||||
message.channel.send(lockmsg)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
message.channel.send(lockmsg);
|
||||
|
||||
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Lockchat_Command}`)
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
exports.help = {
|
||||
name: bot.settings.Lockchat_Command,
|
||||
}
|
||||
name: supportbot.Lockchat_Command,
|
||||
};
|
||||
+13
-10
@@ -1,23 +1,26 @@
|
||||
// SupportBot
|
||||
// Created by © 2020 Emerald Services
|
||||
// Command: Ping
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const bot = new Discord.Client()
|
||||
const bot = new Discord.Client();
|
||||
|
||||
bot.settings = require("../settings.json");
|
||||
const fs = require("fs");
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
exports.run = (bot, message, args) => {
|
||||
message.delete();
|
||||
|
||||
const embed = new Discord.RichEmbed()
|
||||
console.log(`\u001b[33m`, `[${supportbot.Bot_Name}] > `, `\u001b[31;1m`, `${message.author.tag}`, `\u001b[32;1m`, `has executed`, `\u001b[31;1m`, `${supportbot.Prefix}${supportbot.Ping_Command}`);
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setDescription(`:ping_pong: **Pong!** \`${bot.ping}ms\` `)
|
||||
.setColor(bot.settings.colour)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
message.channel.send(embed).catch(console.error);
|
||||
|
||||
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Ping_Command}`)
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
exports.help = {
|
||||
name: bot.settings.Ping_Command,
|
||||
}
|
||||
name: supportbot.Ping_Command,
|
||||
}
|
||||
+30
-26
@@ -1,46 +1,50 @@
|
||||
// SupportBot
|
||||
// Created by © 2020 Emerald Services
|
||||
// Command: Poll
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const bot = new Discord.Client()
|
||||
const bot = new Discord.Client();
|
||||
|
||||
bot.settings = require("../settings.json");
|
||||
const fs = require("fs");
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
exports.run = (bot, message, args) => {
|
||||
message.delete();
|
||||
|
||||
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === `${bot.settings.staff}`)
|
||||
console.log(`\u001b[33m`, `[${supportbot.Bot_Name}] > `, `\u001b[31;1m`, `${message.author.tag}`, `\u001b[32;1m`, `has executed`, `\u001b[31;1m`, `${supportbot.Prefix}${supportbot.Poll_Command}`);
|
||||
|
||||
const rolemissing = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.staff}**`)
|
||||
.setColor(bot.settings.colour)
|
||||
if (!staffGroup) return message.reply(rolemissing).catch(err=>{console.error(err)})
|
||||
|
||||
const donothaverole = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.staff}**`)
|
||||
.setColor(bot.settings.colour)
|
||||
if (!message.member.roles.has(staffGroup.id)) return message.reply(donothaverole)
|
||||
let staffGroup = message.guild.roles.cache.find(staffRole => staffRole.name === `${supportbot.StaffRole}`)
|
||||
|
||||
const rolerequired = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Incorrect Permissions, You cannot execute this command as you do not have the required role.\n\nRole Required: \`${supportbot.StaffRole}\`\n\nError Code: \`SB-02\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
if (!message.member.roles.cache.has(staffGroup.id)) return message.reply({embed: rolerequired});
|
||||
|
||||
const embed = new Discord.RichEmbed()
|
||||
.setTitle(`${bot.settings.Poll_Title}`)
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(`${supportbot.Poll_Title}`)
|
||||
.setDescription(args.join(" "))
|
||||
.setTimestamp()
|
||||
.setColor(bot.settings.colour)
|
||||
.setFooter(bot.settings.footer, message.author.displayAvatarURL)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter, message.author.displayAvatarURL)
|
||||
|
||||
let ac = message.guild.channels.find(AnnounceChannel => AnnounceChannel.name === `${bot.settings.Poll_Channel}`)
|
||||
if(!ac) return message.channel.send(`:x: Error! Could not find the logs channel **${bot.settings.Poll_Channel}**`)
|
||||
let locateChannel = message.guild.channels.cache.find(LocateChannel => LocateChannel.name === `${supportbot.Poll_Channel}`)
|
||||
|
||||
const errornochannel = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Channel not Found, This command cannot be executed proberbly as their is no channel within this server.\nThis is configurable via **supportbot-config.yml**\n\nChannel Required: \`${supportbot.Poll_Channel}\`\n\nError Code: \`SB-03\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
if(!locateChannel) return message.channel.send(errornochannel);
|
||||
|
||||
ac.send(embed)
|
||||
locateChannel.send(embed)
|
||||
|
||||
.then(async function(msg) {
|
||||
msg.react(bot.settings.Reaction_Poll_1).then(() => msg.react(bot.settings.Reaction_Poll_2));
|
||||
msg.react(supportbot.Reaction_Poll_1).then(() => msg.react(supportbot.Reaction_Poll_2));
|
||||
});
|
||||
|
||||
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Poll_Command}`)
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
exports.help = {
|
||||
name: bot.settings.Poll_Command,
|
||||
}
|
||||
name: supportbot.Poll_Command,
|
||||
};
|
||||
+37
-44
@@ -1,60 +1,53 @@
|
||||
// SupportBot
|
||||
// Command: Remove User
|
||||
// Created by © 2020 Emerald Services
|
||||
// Command: Remove
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const bot = new Discord.Client()
|
||||
const bot = new Discord.Client();
|
||||
|
||||
bot.settings = require("../settings.json");
|
||||
const fs = require("fs");
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
module.exports.run = async (bot, message, args) => {
|
||||
message.delete()
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Add_Command}`)
|
||||
exports.run = async (bot, message, args) => {
|
||||
|
||||
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === bot.settings.support)
|
||||
console.log(`\u001b[33m`, `[${supportbot.Bot_Name}] > `, `\u001b[31;1m`, `${message.author.tag}`, `\u001b[32;1m`, `has executed`, `\u001b[31;1m`, `${supportbot.Prefix}${supportbot.Remove_Command}`);
|
||||
|
||||
let staffGroup = message.guild.roles.cache.find(staffRole => staffRole.name === supportbot.StaffRole);
|
||||
|
||||
const rolemissing = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.support}**`)
|
||||
.setColor(bot.settings.colour)
|
||||
if (!staffGroup) return message.reply({embed: rolemissing});
|
||||
const rolerequired = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Incorrect Permissions, You cannot execute this command as you do not have the required role.\n\nRole Required: \`${supportbot.StaffRole}\`\n\nError Code: \`SB-02\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
if (!message.member.roles.cache.has(staffGroup.id)) return message.reply({embed: rolerequired});
|
||||
|
||||
const donothaverole = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.support}**`)
|
||||
.setColor(bot.settings.colour)
|
||||
if (!message.member.roles.has(staffGroup.id)) return message.reply({embed: donothaverole});
|
||||
const outsideticket = new Discord.MessageEmbed()
|
||||
.setTitle("Incorrect Channel")
|
||||
.setDescription(`:warning: You cannot execute this command here. This command is used when closing a ticket.`)
|
||||
.setColor(supportbot.WarningColour);
|
||||
if (!message.channel.name.startsWith(`${supportbot.Ticket_Channel_Name}-`)) return message.channel.send({embed: outsideticket});
|
||||
|
||||
const outsideticket = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Cannot use this command becase you are outside a ticket channel.`)
|
||||
.setColor(bot.settings.colour)
|
||||
if (!message.channel.name.startsWith(`ticket-`)) return message.channel.send({embed: outsideticket});
|
||||
let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.cache.get(args[0]));
|
||||
|
||||
let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
|
||||
const cantfinduser = new Discord.MessageEmbed()
|
||||
.setTitle("Invalid User!")
|
||||
.setDescription(`:warning: This user doesn't exist, Are they in this server?\n\nTry Again:\`${supportbot.Prefix}${supportbot.Remove_Command} <user#0000>\``)
|
||||
.setColor(supportbot.WarningColour);
|
||||
if(!rUser) return message.channel.send({embed: cantfinduser});
|
||||
|
||||
message.channel.updateOverwrite(rUser, { VIEW_CHANNEL: false, CREATE_INVITE: false, SEND_MESSAGES: false, READ_MESSAGES: false });
|
||||
|
||||
const cantfinduser = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Hmm! Does that user exist? I cannot find the user.`)
|
||||
.setColor(bot.settings.colour)
|
||||
if(!rUser) return message.channel.send({embed: cantfinduser});
|
||||
const useradded = new Discord.MessageEmbed()
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setTitle("User Removed")
|
||||
.setDescription(`👍 ${rUser} has been removed from this ticket`)
|
||||
.setTimestamp();
|
||||
|
||||
const channel = message.guild.channels.find(channel => channel.name === message.channel.name);
|
||||
message.channel.send({embed: useradded});
|
||||
|
||||
const cantfindchannel = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Hmm! Does that ticket exist? I cannot find the ticket channel.`)
|
||||
.setColor(bot.settings.colour)
|
||||
if(!channel) return message.channel.send({embed: cantfindchannel});
|
||||
message.delete().catch(O_o=>{});
|
||||
|
||||
message.channel.overwritePermissions(rUser, { READ_MESSAGES: false, SEND_MESSAGES: false });
|
||||
|
||||
const useradded = new Discord.RichEmbed()
|
||||
.setColor(bot.settings.colour)
|
||||
.setDescription(`:white_check_mark: Successfully remove ${rUser} from the ticket.`)
|
||||
.setTimestamp();
|
||||
|
||||
message.channel.send({embed: useradded});
|
||||
console.log(`\x1b[36m`, `${message.author} has successfully removed ${rUser} from ${message.channel}`)
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
exports.help = {
|
||||
name: bot.settings.Remove_Command,
|
||||
}
|
||||
name: supportbot.Remove_Command,
|
||||
}
|
||||
+36
-32
@@ -1,49 +1,53 @@
|
||||
// SupportBot
|
||||
// Command: Close Ticket
|
||||
// Created by © 2020 Emerald Services
|
||||
// Command: Rename
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const bot = new Discord.Client()
|
||||
const bot = new Discord.Client();
|
||||
|
||||
bot.settings = require("../settings.json");
|
||||
const fs = require("fs");
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
exports.run = (bot, message, args) => {
|
||||
message.delete();
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === bot.settings.support)
|
||||
exports.run = async (bot, message, args) => {
|
||||
|
||||
const rolemissing = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.support}**`)
|
||||
.setColor(bot.settings.colour)
|
||||
if (!staffGroup) return message.reply({embed: rolemissing});
|
||||
console.log(`\u001b[33m`, `[${supportbot.Bot_Name}] > `, `\u001b[31;1m`, `${message.author.tag}`, `\u001b[32;1m`, `has executed`, `\u001b[31;1m`, `${supportbot.Prefix}${supportbot.Rename_Command}`);
|
||||
|
||||
const donothaverole = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.support}**`)
|
||||
.setColor(bot.settings.colour)
|
||||
if (!message.member.roles.has(staffGroup.id)) return message.reply({embed: donothaverole});
|
||||
|
||||
const outsideticket = new Discord.RichEmbed()
|
||||
let staffGroup = message.guild.roles.cache.find(staffRole => staffRole.name === supportbot.StaffRole);
|
||||
|
||||
const rolerequired = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Incorrect Permissions, You cannot execute this command as you do not have the required role.\n\nRole Required: \`${supportbot.StaffRole}\`\n\nError Code: \`SB-02\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
if (!message.member.roles.cache.has(staffGroup.id)) return message.reply({embed: rolerequired});
|
||||
|
||||
const outsideticket = new Discord.MessageEmbed()
|
||||
.setDescription(`:x: Cannot use this command becase you are outside a ticket channel.`)
|
||||
.setColor(bot.settings.colour)
|
||||
if (!message.channel.name.startsWith(`ticket-`)) return message.channel.send({embed: outsideticket});
|
||||
.setColor(supportbot.colour)
|
||||
if (!message.channel.name.startsWith(`${supportbot.Ticket_Channel_Name}-`)) return message.channel.send({embed: outsideticket});
|
||||
const renameto = args.join(" ")
|
||||
message.channel.setName(`ticket-${renameto}-${message.author.username}`)
|
||||
message.channel.setName(`${supportbot.Ticket_Channel_Name}-${renameto}`)
|
||||
|
||||
// Renamed Ticket Logistic
|
||||
const logEmbed = new Discord.RichEmbed()
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(":ticket: Ticket Renamed")
|
||||
.setDescription(`<@${message.author.id}> has renamed a ticket to ${renameto}`)
|
||||
.setColor(bot.settings.colour)
|
||||
.setFooter(bot.settings.footer)
|
||||
.setDescription(`<@${message.author.id}> has renamed a ticket to ${supportbot.Ticket_Channel_Name}-${renameto}`)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
|
||||
let logChannel = message.guild.channels.find(TicketChannel => TicketChannel.name === `${bot.settings.Ticket_Logs}`);
|
||||
if(!logChannel) return message.channel.send(`:x: Error! Could not find the logs channel **${bot.settings.Ticket_Logs}**`);
|
||||
|
||||
logChannel.send({embed: logEmbed})
|
||||
|
||||
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Rename_Command}`)
|
||||
let locateChannel = message.guild.channels.cache.find(LocateChannel => LocateChannel.name === `${supportbot.Ticket_Logs}`)
|
||||
|
||||
}
|
||||
const errornochannel = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Channel not Found, This command cannot be executed proberbly as their is no channel within this server.\nThis is configurable via **supportbot-config.yml**\n\nChannel Required: \`${supportbot.Ticket_Logs}\`\n\nError Code: \`SB-03\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
if(!locateChannel) return message.channel.send(errornochannel);
|
||||
|
||||
locateChannel.send(logEmbed)
|
||||
|
||||
};
|
||||
|
||||
exports.help = {
|
||||
name: bot.settings.Rename_Command,
|
||||
}
|
||||
name: supportbot.Rename_Command,
|
||||
}
|
||||
+30
-21
@@ -1,29 +1,33 @@
|
||||
// SupportBot
|
||||
// Created by © 2020 Emerald Services
|
||||
// Command: Report
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const bot = new Discord.Client()
|
||||
const bot = new Discord.Client();
|
||||
|
||||
bot.settings = require("../settings.json");
|
||||
const fs = require("fs");
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
exports.run = (bot, message, args) => {
|
||||
message.delete();
|
||||
|
||||
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === `${bot.settings.staff}`);
|
||||
console.log(`\u001b[33m`, `[${supportbot.Bot_Name}] > `, `\u001b[31;1m`, `${message.author.tag}`, `\u001b[32;1m`, `has executed`, `\u001b[31;1m`, `${supportbot.Prefix}${supportbot.Report_Command}`);
|
||||
|
||||
const rolemissing = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.staff}**`)
|
||||
.setColor(bot.settings.colour);
|
||||
let staffGroup = message.guild.roles.cache.find(staffRole => staffRole.name === `${supportbot.StaffRole}`);
|
||||
|
||||
if(!staffGroup) {
|
||||
message.reply(rolemissing).catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
} else {
|
||||
const donothaverole = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.staff}**`)
|
||||
.setColor(bot.settings.colour)
|
||||
if(!message.member.roles.has(staffGroup.id)) {
|
||||
const rolerequired = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Incorrect Permissions, You cannot execute this command as you do not have the required role.\n\nRole Required: \`${supportbot.StaffRole}\`\n\nError Code: \`SB-02\``)
|
||||
.setColor(supportbot.ErrorColour)
|
||||
|
||||
if (!message.member.roles.cache.has(staffGroup.id)) return message.reply({embed: rolerequired});
|
||||
if(!message.member.roles.cache.has(staffGroup.id)) {
|
||||
message.reply(donothaverole);
|
||||
} else {
|
||||
if(!args[0]) {
|
||||
@@ -33,28 +37,33 @@ exports.run = (bot, message, args) => {
|
||||
message.reply(":x: Sorry! Specify the reason of your report.");
|
||||
} else {
|
||||
let reportDesc = args.slice(1).join(" ");
|
||||
const embed = new Discord.RichEmbed()
|
||||
.setTitle(`${bot.settings.Report_Title}`)
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(`${supportbot.Report_Title}`)
|
||||
.setThumbnail(message.author.avatarURL)
|
||||
.addField("Report by:", `<@${message.author.id}>`, false)
|
||||
.addField("Description:", `${reportDesc}`, false)
|
||||
.addField("Reported User:", `${args[0]}`, false)
|
||||
.setTimestamp(new Date())
|
||||
.setColor(bot.settings.colour)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(`${message.author.username}#${message.author.discriminator}`, message.author.displayAvatarURL);
|
||||
let rc = message.guild.channels.find(ReportChannel => ReportChannel.name === `${bot.settings.Report_Channel}`)
|
||||
if(!rc) {
|
||||
message.channel.send(`:x: Error! Could not find the logs channel **${bot.settings.Report_Channel}**`);
|
||||
let locateChannel = message.guild.channels.cache.find(LocateChannel => LocateChannel.name === `${supportbot.Report_Channel}`)
|
||||
if(!locateChannel) {
|
||||
const errornochannel = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Channel not Found, This command cannot be executed proberbly as their is no channel within this server.\nThis is configurable via **supportbot-config.yml**\n\nChannel Required: \`${supportbot.Report_Channel}\`\n\nError Code: \`SB-03\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
if(!locateChannel) return message.channel.send(errornochannel);
|
||||
|
||||
} else {
|
||||
rc.send(embed);
|
||||
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Report_Command}`);
|
||||
locateChannel.send(embed);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports.help = {
|
||||
name: bot.settings.Report_Command
|
||||
name: supportbot.Report_Command
|
||||
}
|
||||
+22
-26
@@ -1,42 +1,38 @@
|
||||
// SupportBot
|
||||
// Created by © 2020 Emerald Services
|
||||
// Command: Say
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const bot = new Discord.Client()
|
||||
const bot = new Discord.Client();
|
||||
|
||||
bot.settings = require("../settings.json");
|
||||
const fs = require("fs");
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
exports.run = (bot, message, args) => {
|
||||
message.delete();
|
||||
|
||||
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === `${bot.settings.staff}`)
|
||||
console.log(`\u001b[33m`, `[${supportbot.Bot_Name}] > `, `\u001b[31;1m`, `${message.author.tag}`, `\u001b[32;1m`, `has executed`, `\u001b[31;1m`, `${supportbot.Prefix}${supportbot.Say_Command}`);
|
||||
|
||||
const rolemissing = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.staff}**`)
|
||||
.setColor(bot.settings.colour)
|
||||
if (!staffGroup) return message.reply(rolemissing).catch(err=>{console.error(err)})
|
||||
|
||||
const donothaverole = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.staff}**`)
|
||||
.setColor(bot.settings.colour)
|
||||
if (!message.member.roles.has(staffGroup.id)) return message.reply(donothaverole)
|
||||
let staffGroup = message.guild.roles.cache.find(staffRole => staffRole.name === supportbot.StaffRole);
|
||||
|
||||
const rolerequired = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Incorrect Permissions, You cannot execute this command as you do not have the required role.\n\nRole Required: \`${supportbot.StaffRole}\`\n\nError Code: \`SB-02\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
if (!message.member.roles.cache.has(staffGroup.id)) return message.reply({embed: rolerequired});
|
||||
|
||||
const embed = new Discord.RichEmbed()
|
||||
.setTitle(`${bot.settings.Announcement_Title}`)
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(`${supportbot.Announcement_Title}`)
|
||||
.setDescription(args.join(" "))
|
||||
.setTimestamp()
|
||||
.setColor(bot.settings.colour)
|
||||
.setFooter(`${message.author.username}#${message.author.discriminator}`, message.author.displayAvatarURL)
|
||||
|
||||
let ac = message.guild.channels.find(AnnounceChannel => AnnounceChannel.name === `${bot.settings.Announcement_Channel}`)
|
||||
if(!ac) return message.channel.send(`:x: Error! Could not find the logs channel **${bot.settings.Announcement_Channel}**`)
|
||||
|
||||
ac.send(embed)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(`${message.author.username}#${message.author.discriminator}`, message.author.displayAvatarURL)
|
||||
|
||||
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Say_Command}`)
|
||||
message.channel.send(embed);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
exports.help = {
|
||||
name: bot.settings.Say_Command,
|
||||
}
|
||||
name: supportbot.Say_Command,
|
||||
}
|
||||
+34
-19
@@ -1,33 +1,48 @@
|
||||
|
||||
// SupportBot
|
||||
// Command: Suggest
|
||||
// Created by © 2020 Emerald Services
|
||||
// Command: Say
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const bot = new Discord.Client()
|
||||
const bot = new Discord.Client();
|
||||
|
||||
bot.settings = require("../settings.json");
|
||||
const fs = require("fs");
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
exports.run = async(bot, message, args) => {
|
||||
message.delete();
|
||||
|
||||
const SuggestionEmbed = new Discord.RichEmbed()
|
||||
.setTitle(`${bot.settings.Suggestion_Title}`)
|
||||
.setDescription(args.join(" "))
|
||||
.setFooter(`Suggestion by ${message.author.username}`, message.author.displayAvatarURL)
|
||||
.setColor(bot.settings.colour)
|
||||
|
||||
let sc = message.guild.channels.find(SuggestionChannel => SuggestionChannel.name === `${bot.settings.Suggestion_Channel}`);
|
||||
if(!sc) return message.channel.send(`:x: Error! Could not find the suggestion channel **${bot.settings.Suggestion_Channel}**`);
|
||||
|
||||
sc.send(SuggestionEmbed)
|
||||
console.log(`\u001b[33m`, `[${supportbot.Bot_Name}] > `, `\u001b[31;1m`, `${message.author.tag}`, `\u001b[32;1m`, `has executed`, `\u001b[31;1m`, `${supportbot.Prefix}${supportbot.Suggest_Command}`);
|
||||
|
||||
const SuggestionEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(`${supportbot.Suggestion_Title}`)
|
||||
.setDescription(`\`\`\`${args.join(" ")}\`\`\`\nFrom <@${message.author.id}>`)
|
||||
.setFooter(`${supportbot.EmbedFooter}`, message.author.avatarURL)
|
||||
.setTimestamp(new Date())
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
let locateChannel = message.guild.channels.cache.find(LocateChannel => LocateChannel.name === `${supportbot.Suggestion_Channel}`)
|
||||
|
||||
const errornochannel = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Channel not Found, This command cannot be executed proberbly as their is no channel within this server.\nThis is configurable via **supportbot-config.yml**\n\nChannel Required: \`${supportbot.Suggestion_Channel}\`\n\nError Code: \`SB-03\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
if(!locateChannel) return message.channel.send(errornochannel);
|
||||
|
||||
locateChannel.send(SuggestionEmbed)
|
||||
|
||||
.then(async function(msg) {
|
||||
msg.react(bot.settings.suggestyes).then(() => msg.react(bot.settings.suggestno));
|
||||
msg.react(supportbot.suggestyes).then(() => msg.react(supportbot.suggestno));
|
||||
});
|
||||
|
||||
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Suggest_Command}`)
|
||||
const SuggestionSuccessEmbed = new Discord.MessageEmbed()
|
||||
.setDescription(`👍 Suggestion has been successfully created\nYou can view your suggestion in <#${locateChannel.id}>`)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
message.channel.send(SuggestionSuccessEmbed);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
exports.help = {
|
||||
name: bot.settings.Suggest_Command,
|
||||
}
|
||||
name: supportbot.Suggest_Command,
|
||||
}
|
||||
+130
-49
@@ -1,85 +1,166 @@
|
||||
// SupportBot
|
||||
// Created by © 2020 Emerald Services
|
||||
// Command: Ticket
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const bot = new Discord.Client()
|
||||
const bot = new Discord.Client();
|
||||
|
||||
bot.settings = require("../settings.json");
|
||||
const fs = require("fs");
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
exports.run = async(bot, message, args) => {
|
||||
message.delete();
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
const TicketNumberID = require('../utility/TicketNumber');
|
||||
|
||||
const ID = Math.floor(Math.random() * 10) + 2000;
|
||||
const subject = args.join(" ") || "No Subject.";
|
||||
exports.run = async (bot, message, args) => {
|
||||
|
||||
const alreadyopen = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Cannot create a ticket because **ticket-${message.author.username}** already exists.`)
|
||||
.setColor(bot.settings.colour)
|
||||
if (message.guild.channels.find(TicketChannel => TicketChannel.name === 'ticket-' + message.author.username)) return message.channel.send(alreadyopen);
|
||||
message.guild.createChannel(`ticket-${message.author.username}`, 'text').then(TicketChannel => {
|
||||
console.log(`\u001b[33m`, `[${supportbot.Bot_Name}] > `, `\u001b[31;1m`, `${message.author.tag}`, `\u001b[32;1m`, `has executed`, `\u001b[31;1m`, `${supportbot.Prefix}${supportbot.Ticket_Command}`);
|
||||
|
||||
// Ticket Number ID Settings
|
||||
let ticketNumberID = TicketNumberID.pad(message.guild.id);
|
||||
|
||||
// Ticket Subject Settings
|
||||
const subject = args.join(" ") || `${supportbot.Default_Ticket_Reason}`;
|
||||
|
||||
// Ticket Limitiations
|
||||
const alreadyopen = new Discord.MessageEmbed()
|
||||
.setDescription(`:x: Cannot create a ticket because **${supportbot.Ticket_Channel_Name}-${ticketNumberID}** already exists.`)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
|
||||
// Ticket Creation
|
||||
if (message.guild.channels.cache.find(TicketChannel => TicketChannel.name === `${supportbot.Ticket_Channel_Name}-` + message.author.username)) return message.channel.send(alreadyopen);
|
||||
message.guild.channels.create(`${supportbot.Ticket_Channel_Name}-${ticketNumberID}`, {
|
||||
type: 'text',
|
||||
}).then(TicketChannel => {
|
||||
|
||||
// Roles
|
||||
let staff = message.guild.roles.find(staffRole => staffRole.name === `${bot.settings.support}`)
|
||||
let everyone = message.guild.roles.find(everyoneRole => everyoneRole.name === `@everyone`)
|
||||
let staff = message.guild.roles.cache.find(supportRole => supportRole.name === `${supportbot.StaffRole}`)
|
||||
let everyone = message.guild.roles.cache.find(everyoneRole => everyoneRole.name === supportbot.everyone)
|
||||
let department = message.guild.roles.cache.find(DepartmentRole => DepartmentRole.name === `${supportbot.Department_Role_1}`)
|
||||
let department2 = message.guild.roles.cache.find(DepartmentRole => DepartmentRole.name === `${supportbot.Department_Role_2}`)
|
||||
let department3 = message.guild.roles.cache.find(DepartmentRole => DepartmentRole.name === `${supportbot.Department_Role_3}`)
|
||||
|
||||
// Permissions
|
||||
TicketChannel.overwritePermissions(everyone, { SEND_MESSAGES: false, READ_MESSAGES: false })
|
||||
TicketChannel.overwritePermissions(staff, { SEND_MESSAGES: true, READ_MESSAGES: true })
|
||||
TicketChannel.overwritePermissions(message.author, { SEND_MESSAGES: true, READ_MESSAGES: true })
|
||||
TicketChannel.overwritePermissions(bot.user, { SEND_MESSAGES: true, READ_MESSAGES: true })
|
||||
TicketChannel.updateOverwrite(everyone, { VIEW_CHANNEL: false });
|
||||
TicketChannel.updateOverwrite(message.author, { VIEW_CHANNEL: true, CREATE_INVITE: false, SEND_MESSAGES: false, READ_MESSAGES: true });
|
||||
TicketChannel.updateOverwrite(staff, { VIEW_CHANNEL: true, CREATE_INVITE: false, CREATE_INVITE: false, SEND_MESSAGES: true, READ_MESSAGES: true });
|
||||
TicketChannel.updateOverwrite(department, { VIEW_CHANNEL: true, CREATE_INVITE: false, SEND_MESSAGES: true, READ_MESSAGES: true });
|
||||
TicketChannel.updateOverwrite(department2, { VIEW_CHANNEL: true, CREATE_INVITE: false, SEND_MESSAGES: true, READ_MESSAGES: true });
|
||||
TicketChannel.updateOverwrite(department3, { VIEW_CHANNEL: true, CREATE_INVITE: false, SEND_MESSAGES: true, READ_MESSAGES: true });
|
||||
|
||||
// Category
|
||||
let category = message.guild.channels.find(c => c.name === bot.settings.category);
|
||||
let category = message.guild.channels.cache.find(c => c.name === supportbot.category);
|
||||
if (category) {
|
||||
TicketChannel.setParent(category.id);
|
||||
} else {
|
||||
if (message.guild.channels.get(bot.settings.category)) {
|
||||
TicketChannel.setParent(message.guild.channels.get(bot.settings.category).id);
|
||||
if (message.guild.channels.cache.get(supportbot.category)) {
|
||||
TicketChannel.setParent(message.guild.channels.cache.get(supportbot.category).id);
|
||||
}
|
||||
}
|
||||
|
||||
const ticketopened = new Discord.RichEmbed()
|
||||
.setDescription(`:white_check_mark: <@${message.author.id}> You ticket has been created <#${TicketChannel.id}>`)
|
||||
.setColor(bot.settings.colour)
|
||||
const ticketopened = new Discord.MessageEmbed()
|
||||
.setTitle(":white_check_mark: Support Ticket Created")
|
||||
.setDescription(`<@${message.author.id}> your support ticket created successfully`)
|
||||
.addField("Your Ticket:", `<#${TicketChannel.id}>`)
|
||||
.setColor(supportbot.SuccessColour)
|
||||
message.channel.send({embed: ticketopened});
|
||||
|
||||
// Ticket Message - ( Able to edit this message via the settings.json file )
|
||||
const ticketMessage = `Hi! <@${message.author.id}>\n${bot.settings.Ticket_Message}`;
|
||||
const ticketMessage = `Hi! <@${message.author.id}>\n${supportbot.Ticket_Message}`;
|
||||
|
||||
const TicketMessage = new Discord.RichEmbed()
|
||||
.setDescription(ticketMessage)
|
||||
.setColor(bot.settings.colour)
|
||||
.setFooter(bot.settings.footer)
|
||||
TicketChannel.send({embed: TicketMessage});
|
||||
const Department_1 = supportbot.Ticket_Department_1;
|
||||
const Department_2 = supportbot.Ticket_Department_2;
|
||||
const Department_3 = supportbot.Ticket_Department_3;
|
||||
|
||||
const Emoji_1 = supportbot.Ticket_Department_Emoji_1;
|
||||
const Emoji_2 = supportbot.Ticket_Department_Emoji_2;
|
||||
const Emoji_3 = supportbot.Ticket_Department_Emoji_3;
|
||||
|
||||
const TicketMessage = new Discord.MessageEmbed()
|
||||
.setDescription(ticketMessage, true)
|
||||
.addField("Available Departments", `${Emoji_1} ${Department_1}\n${Emoji_2} ${Department_2}\n${Emoji_3} ${Department_3}`)
|
||||
.setColor(supportbot.Ticket_Colour)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
|
||||
if (subject != 'No Subject.') {
|
||||
TicketMessage.addField("Reason", subject);
|
||||
}
|
||||
|
||||
|
||||
TicketChannel.send({embed: TicketMessage}).then(function(msg) {
|
||||
|
||||
msg.react(Emoji_1).then(() => msg.react(Emoji_2)).then(() => msg.react(Emoji_3));
|
||||
|
||||
const filter = (reaction, user) => {
|
||||
return [Emoji_1, Emoji_2, Emoji_3].includes(reaction.emoji.name) && user.id !== msg.author.id;
|
||||
};
|
||||
|
||||
msg.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
|
||||
.then(collected => {
|
||||
const reaction = collected.first();
|
||||
|
||||
if (reaction.emoji.name === `${Emoji_1}`) {
|
||||
TicketChannel.updateOverwrite(message.author, { VIEW_CHANNEL: true, CREATE_INVITE: false, SEND_MESSAGES: true, READ_MESSAGES: true });
|
||||
TicketChannel.updateOverwrite(staff, { VIEW_CHANNEL: true, CREATE_INVITE: false, SEND_MESSAGES: true, READ_MESSAGES: true });
|
||||
TicketChannel.updateOverwrite(department, { VIEW_CHANNEL: true, CREATE_INVITE: false, SEND_MESSAGES: true, READ_MESSAGES: true });
|
||||
|
||||
const dept1 = new Discord.MessageEmbed()
|
||||
.setDescription(`You have requested to contact ${department}. Please wait patiently for someone to reach out to you.`)
|
||||
.setColor(supportbot.SuccessColour)
|
||||
TicketChannel.send(dept1)
|
||||
}
|
||||
|
||||
if (reaction.emoji.name === `${Emoji_2}`) {
|
||||
TicketChannel.updateOverwrite(message.author, { VIEW_CHANNEL: true, CREATE_INVITE: false, SEND_MESSAGES: true, READ_MESSAGES: true });
|
||||
TicketChannel.updateOverwrite(staff, { VIEW_CHANNEL: true, CREATE_INVITE: false, SEND_MESSAGES: true, READ_MESSAGES: true });
|
||||
TicketChannel.updateOverwrite(department2, { VIEW_CHANNEL: true, CREATE_INVITE: false, SEND_MESSAGES: true, READ_MESSAGES: true });
|
||||
|
||||
const dept2 = new Discord.MessageEmbed()
|
||||
.setDescription(`You have requested to contact ${department2}. Please wait patiently for someone to reach out to you.`)
|
||||
.setColor(supportbot.SuccessColour)
|
||||
TicketChannel.send(dept2)
|
||||
}
|
||||
|
||||
if (reaction.emoji.name === `${Emoji_3}`) {
|
||||
TicketChannel.updateOverwrite(message.author, { VIEW_CHANNEL: true, CREATE_INVITE: false, SEND_MESSAGES: true, READ_MESSAGES: true });
|
||||
TicketChannel.updateOverwrite(staff, { VIEW_CHANNEL: true, CREATE_INVITE: false, SEND_MESSAGES: true, READ_MESSAGES: true });
|
||||
TicketChannel.updateOverwrite(department3, { VIEW_CHANNEL: true, CREATE_INVITE: false, SEND_MESSAGES: true, READ_MESSAGES: true });
|
||||
|
||||
const dept3 = new Discord.MessageEmbed()
|
||||
.setDescription(`You have requested to contact ${department3}. Please wait patiently for someone to reach out to you.`)
|
||||
.setColor(supportbot.SuccessColour)
|
||||
TicketChannel.send(dept3)
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
if (subject != 'No Subject.') {
|
||||
TicketChannel.setTopic(subject);
|
||||
}
|
||||
|
||||
// Ticket Logging
|
||||
const logEmbed = new Discord.RichEmbed()
|
||||
.setTitle(":ticket: Logistics of your Ticket")
|
||||
.addField("Ticket ID", ID, true)
|
||||
const logEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(":ticket: Ticket Log")
|
||||
.addField("Ticket ID", ticketNumberID, true)
|
||||
.addField("User", `<@${message.author.id}>`, true)
|
||||
.addField("Channel", `ticket#${ID}`, true)
|
||||
.setColor(bot.settings.colour)
|
||||
.setFooter(bot.settings.footer)
|
||||
.addField("Channel", `ticket#${ticketNumberID}`, true)
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setFooter(supportbot.EmbedFooter)
|
||||
|
||||
if (subject != 'No Subject.') {
|
||||
logEmbed.addField('Subject', subject, true);
|
||||
}
|
||||
|
||||
let logChannel = message.guild.channels.find(TicketChannel => TicketChannel.name === `${bot.settings.Ticket_Logs}`);
|
||||
if(!logChannel) return message.channel.send(`:x: Error! Could not find the logs channel **${bot.settings.Ticket_Logs}**`);
|
||||
|
||||
logChannel.send({embed: logEmbed})
|
||||
let locateChannel = message.guild.channels.cache.find(LocateChannel => LocateChannel.name === `${supportbot.Ticket_Logs}`)
|
||||
|
||||
const errornochannel = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Channel not Found, This command cannot be executed proberbly as their is no channel within this server.\nThis is configurable via **supportbot-config.yml**\n\nChannel Required: \`${supportbot.Ticket_Logs}\`\n\nError Code: \`SB-03\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
if(!locateChannel) return message.channel.send(errornochannel);
|
||||
|
||||
locateChannel.send(logEmbed)
|
||||
|
||||
}).catch(err=>{console.error(err)});
|
||||
|
||||
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Ticket_Command}`)
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
exports.help = {
|
||||
name: bot.settings.Ticket_Command,
|
||||
}
|
||||
name: supportbot.Ticket_Command,
|
||||
};
|
||||
+24
-24
@@ -1,38 +1,38 @@
|
||||
// SupportBot
|
||||
// Command: Lockchat
|
||||
// Created by © 2020 Emerald Services
|
||||
// Command: Say
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const bot = new Discord.Client()
|
||||
const bot = new Discord.Client();
|
||||
|
||||
bot.settings = require("../settings.json");
|
||||
const fs = require("fs");
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
exports.run = async(bot, message, args) => {
|
||||
message.delete();
|
||||
|
||||
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === `${bot.settings.staff}`)
|
||||
let everyoneRole = message.guild.roles.find(everyone => everyone.name === `${bot.settings.everyone}`)
|
||||
console.log(`\u001b[33m`, `[${supportbot.Bot_Name}] > `, `\u001b[31;1m`, `${message.author.tag}`, `\u001b[32;1m`, `has executed`, `\u001b[31;1m`, `${supportbot.Prefix}${supportbot.UnLockchat_Command}`);
|
||||
|
||||
const rolemissing = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.staff}**`)
|
||||
.setColor(bot.settings.colour)
|
||||
if (!staffGroup) return message.reply(rolemissing).catch(err=>{console.error(err)})
|
||||
|
||||
const donothaverole = new Discord.RichEmbed()
|
||||
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.staff}**`)
|
||||
.setColor(bot.settings.colour)
|
||||
if (!message.member.roles.has(staffGroup.id)) return message.reply(donothaverole)
|
||||
let staffGroup = message.guild.roles.cache.find(staffRole => staffRole.name === `${supportbot.StaffRole}`)
|
||||
let lockedRole = message.guild.roles.cache.find(lc => lc.name === `${supportbot.locked_role}`)
|
||||
|
||||
const rolerequired = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Incorrect Permissions, You cannot execute this command as you do not have the required role.\n\nRole Required: \`${supportbot.StaffRole}\`\n\nError Code: \`SB-02\``)
|
||||
.setColor(supportbot.ErrorColour);
|
||||
if (!message.member.roles.cache.has(staffGroup.id)) return message.reply({embed: rolerequired});
|
||||
|
||||
message.channel.overwritePermissions(everyoneRole, { READ_MESSAGES: true, SEND_MESSAGES: true });
|
||||
message.channel.overwritePermissions(lockedRole, { READ_MESSAGES: true, SEND_MESSAGES: true });
|
||||
message.channel.overwritePermissions(staffGroup, { READ_MESSAGES: true, SEND_MESSAGES: true });
|
||||
|
||||
const lockmsg = new Discord.RichEmbed()
|
||||
const lockmsg = new Discord.MessageEmbed()
|
||||
.setDescription(":white_check_mark: **Chat Un-Locked**")
|
||||
.setColor(bot.settings.colour)
|
||||
message.channel.send(lockmsg)
|
||||
.setColor(supportbot.EmbedColour);
|
||||
message.channel.send(lockmsg);
|
||||
|
||||
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.UnLockchat_Command}`)
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
exports.help = {
|
||||
name: bot.settings.UnLockchat_Command,
|
||||
}
|
||||
name: supportbot.UnLockchat_Command,
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
cd /home/container
|
||||
|
||||
if [ "${GIT_CLONE}" == "true" ] || [ "${GIT_CLONE}" == "1" ]; then
|
||||
if [ "$(ls -A /home/container)" ]; then
|
||||
echo "Pulling Updates"
|
||||
git pull
|
||||
else
|
||||
echo -e "/home/container is empty.\nCloning files into the directory."
|
||||
git clone https://github.com/1tzemerald/SupportBot.git
|
||||
fi
|
||||
fi
|
||||
|
||||
sed -i '/s/BOT_TOKEN_HERE/${BOT_TOKEN}/g' settings.json
|
||||
MODIFIED_STARTUP=`eval echo $(echo ${STARTUP} | sed -e 's/{{/${/g' -e 's/}}/}/g')`
|
||||
${MODIFIED_STARTUP}
|
||||
@@ -1,23 +1,31 @@
|
||||
// Resource: SupportBot
|
||||
// Developed by Emerald
|
||||
// Version: 3.4
|
||||
// ____ _ ____ _
|
||||
// / ___| _ _ _ __ _ __ ___ _ __| |_| __ ) ___ | |_
|
||||
// \___ \| | | | '_ \| '_ \ / _ \| '__| __| _ \ / _ \| __|
|
||||
// ___) | |_| | |_) | |_) | (_) | | | |_| |_) | (_) | |_
|
||||
// |____/ \__,_| .__/| .__/ \___/|_| \__|____/ \___/ \__|
|
||||
// |_| |_|
|
||||
// © 2020 Created by Emerald Services
|
||||
// Licnese: MIT
|
||||
// SupportBot v5.2
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const fs = require("fs");
|
||||
const bot = new Discord.Client();
|
||||
|
||||
bot.commands = new Discord.Collection();
|
||||
bot.settings = require("./settings.json");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
fs.readdir("./commands/", (err, files) => {
|
||||
if(err) console.log(err);
|
||||
|
||||
let jsfile = files.filter(f => f.split(".").pop() === "js")
|
||||
if(jsfile.length <= 0) return console.log(`${bot.settings.botname} No commands found. Try to Re-download the resource`);
|
||||
if(jsfile.length <= 0) return console.log(`${supportbot.Bot_Name} No commands found. Try to Re-download the resource`);
|
||||
|
||||
jsfile.forEach((f, i) =>{
|
||||
let props = require(`./commands/${f}`);
|
||||
console.log(`[${bot.settings.botname}] > Command Loaded > ${f}`);
|
||||
console.log(`[${supportbot.Bot_Name}] > Command Loaded > ${f}`);
|
||||
bot.commands.set(props.help.name, props);
|
||||
});
|
||||
|
||||
@@ -29,74 +37,121 @@ fs.readdir("./sb-addons/", (err, files) => {
|
||||
if(err) console.log(err);
|
||||
|
||||
let jsfile = files.filter(f => f.split(".").pop() === "js")
|
||||
if(jsfile.length <= 0) return console.log(`${bot.settings.botname} No addons detected nor default! Either download addons from https://itzemerald.tk/`);
|
||||
if(jsfile.length <= 0) return console.log(`${supportbot.Bot_Name} No addons detected nor default! Either download addons from https://emeraldservices.xyz/`);
|
||||
|
||||
jsfile.forEach((f, i) =>{
|
||||
let props = require(`./sb-addons/${f}`);
|
||||
console.log(`[${bot.settings.botname}] > Addons Loaded > ${f}`);
|
||||
console.log(`[${supportbot.Bot_Name}] > Addons Loaded > ${f}`);
|
||||
bot.addons.set(props.help.name, props);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
bot.on("ready", async () => {
|
||||
bot.user.setActivity(bot.settings.BotStatus, {type:"PLAYING"});
|
||||
console.log(`\x1b[36m`, `=== [SupportBot] ===\n\nSupportBot - Created by Emerald Services\nInvite ${bot.user.username} to your server\nhttps://discordapp.com/api/oauth2/authorize?client_id=${bot.user.username}&permissions=8&scope=bot\n\n=== [SupportBot] ===`)
|
||||
bot.user.setActivity(supportbot.BotActivity, {type: supportbot.ActvityType});
|
||||
console.log(`\u001b[32m`, `―――――――――――――――――― SupportBot ――――――――――――――――――`)
|
||||
console.log(`\u001b[37m`, `${supportbot.Bot_Name} has successfully connected to discord`)
|
||||
console.log(`\u001b[37m`, `You can download additional features from our marketplace https://emeraldservices.xyz/`)
|
||||
console.log(`\u001b[37m`, `Invite your bot with https://discordapp.com/api/oauth2/authorize?client_id=${bot.user.id}&permissions=8&scope=bot`)
|
||||
console.log(`\u001b[37m`, `© SupportBot created by Emerald Services`)
|
||||
console.log(`\u001b[32m`, `―――――――――――――――――― SupportBot ――――――――――――――――――`)
|
||||
|
||||
});
|
||||
|
||||
bot.on("message", async message => {
|
||||
if(message.author.bot) return;
|
||||
if(message.channel.type === "dm") return;
|
||||
if (message.content.indexOf(bot.settings.prefix) !== 0) return;
|
||||
if(message.author.bot) return;
|
||||
if(message.channel.type === "dm") return;
|
||||
if (message.content.indexOf(supportbot.Prefix) !== 0) return;
|
||||
|
||||
let messageArray = message.content.split(" ");
|
||||
const args = message.content.slice(bot.settings.prefix.length).trim().split(/ +/g);
|
||||
const command = args.shift().toLowerCase();
|
||||
let messageArray = message.content.split(" ");
|
||||
const args = message.content.slice(supportbot.Prefix.length).trim().split(/ +/g);
|
||||
const command = args.shift().toLowerCase();
|
||||
|
||||
const cmd = bot.commands.get(command);
|
||||
if(!cmd) return;
|
||||
cmd.run(bot, message, args);
|
||||
let staffGroup = message.guild.roles.cache.find(staffRole => staffRole.name === `${supportbot.StaffRole}`)
|
||||
let autoGroup = message.guild.roles.cache.find(autoRole => autoRole.name === `${supportbot.AutoRole}`)
|
||||
let deptGroup1 = message.guild.roles.cache.find(deptRole1 => deptRole1.name === `${supportbot.Department_Role_1}`)
|
||||
let deptGroup2 = message.guild.roles.cache.find(deptRole2 => deptRole2.name === `${supportbot.Department_Role_2}`)
|
||||
let deptGroup3 = message.guild.roles.cache.find(deptRole3 => deptRole3.name === `${supportbot.Department_Role_3}`)
|
||||
|
||||
const rolemissing = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Staff role missing, You cannot execute any commands as the following role does not exist with this server.\nThis role is configurable via **supportbot-config.yml**\n\nPlease create the role: \`${supportbot.StaffRole}\`\n\nError Code: \`SB-01\``)
|
||||
.setColor(supportbot.ErrorColour)
|
||||
if (!staffGroup) return message.reply(rolemissing).catch(err=>{console.error(err)})
|
||||
|
||||
const rolemissing1 = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Auto Role missing, You cannot execute any commands as the following role does not exist with this server.\nThis role is configurable via **supportbot-config.yml**\n\nPlease create the role: \`${supportbot.AutoRole}\`\n\nError Code: \`SB-01\``)
|
||||
.setColor(supportbot.ErrorColour)
|
||||
if (!autoGroup) return message.reply(rolemissing1).catch(err=>{console.error(err)})
|
||||
|
||||
const rolemissing2 = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Department Role missing, You cannot execute any commands as the following role does not exist with this server.\nThis role is configurable via **supportbot-config.yml**\n\nPlease create the role: \`${supportbot.Department_Role_1}\`\n\nError Code: \`SB-01\``)
|
||||
.setColor(supportbot.ErrorColour)
|
||||
if (!deptGroup1) return message.reply(rolemissing2).catch(err=>{console.error(err)})
|
||||
|
||||
const rolemissing3 = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Department Role missing, You cannot execute any commands as the following role does not exist with this server.\nThis role is configurable via **supportbot-config.yml**\n\nPlease create the role: \`${supportbot.Department_Role_2}\`\n\nError Code: \`SB-01\``)
|
||||
.setColor(supportbot.ErrorColour)
|
||||
if (!deptGroup2) return message.reply(rolemissing3).catch(err=>{console.error(err)})
|
||||
|
||||
const rolemissing4 = new Discord.MessageEmbed()
|
||||
.setTitle("SupportBot Error!")
|
||||
.setDescription(`:x: **Error!** Department Role missing, You cannot execute any commands as the following role does not exist with this server.\nThis role is configurable via **supportbot-config.yml**\n\nPlease create the role: \`${supportbot.Department_Role_3}\`\n\nError Code: \`SB-01\` `)
|
||||
.setColor(supportbot.ErrorColour)
|
||||
if (!deptGroup3) return message.reply(rolemissing4).catch(err=>{console.error(err)})
|
||||
|
||||
const cmd = bot.commands.get(command);
|
||||
if(!cmd) return;
|
||||
cmd.run(bot, message, args);
|
||||
message.delete();
|
||||
});
|
||||
|
||||
bot.on("message", async message => {
|
||||
if(message.author.bot) return;
|
||||
if(message.channel.type === "dm") return;
|
||||
if (message.content.indexOf(bot.settings.prefix) !== 0) return;
|
||||
if(message.author.bot) return;
|
||||
if(message.channel.type === "dm") return;
|
||||
if (message.content.indexOf(supportbot.Prefix) !== 0) return;
|
||||
|
||||
let messageArray = message.content.split(" ");
|
||||
const args = message.content.slice(bot.settings.prefix.length).trim().split(/ +/g);
|
||||
const addon = args.shift().toLowerCase();
|
||||
let messageArray = message.content.split(" ");
|
||||
const args = message.content.slice(supportbot.Prefix.length).trim().split(/ +/g);
|
||||
const addon = args.shift().toLowerCase();
|
||||
|
||||
const cmd = bot.addons.get(addon);
|
||||
if(!cmd) return;
|
||||
cmd.run(bot, message, args);
|
||||
const cmd = bot.addons.get(addon);
|
||||
if(!cmd) return;
|
||||
cmd.run(bot, message, args);
|
||||
message.delete();
|
||||
});
|
||||
|
||||
// [SupportBot] Welcome Message
|
||||
// [SupportBot] Welcome Message && Auto Join Role
|
||||
|
||||
bot.on("guildMemberAdd", (member) => {
|
||||
let channel = member.guild.channels.find(channel => channel.name === `${bot.settings.Welcome_Channel}`)
|
||||
|
||||
const WelcomeMsg= new Discord.RichEmbed()
|
||||
.setColor(bot.settings.colour)
|
||||
.setThumbnail(member.user.avatarURL)
|
||||
.setDescription(`:wave: ${member.user.username}\n${bot.settings.Welcome_Message}`)
|
||||
let channel = member.guild.channels.find(channel => channel.name === `${supportbot.WelcomeChannel}`)
|
||||
let autorole = member.guild.roles.find(autorole => autorole.name === `${supportbot.AutoRole}`)
|
||||
|
||||
const WelcomeMsg= new Discord.MessageEmbed()
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setThumbnail(member.user.avatarURL)
|
||||
.setDescription(`:wave: ${member.user.username}\n${supportbot.WelcomeMessage}`)
|
||||
|
||||
channel.send(WelcomeMsg);
|
||||
member.addRole(autorole).catch(console.error);
|
||||
|
||||
});
|
||||
|
||||
// [SupportBot] Leave Message
|
||||
|
||||
bot.on("guildMemberRemove", (member) => {
|
||||
let channel = member.guild.channels.find(channel => channel.name === `${bot.settings.Leave_Channel}`)
|
||||
let channel = member.guild.channels.find(channel => channel.name === `${supportbot.LeaveChannel}`)
|
||||
|
||||
const LeaveMsg= new Discord.RichEmbed()
|
||||
.setColor(bot.settings.colour)
|
||||
.setThumbnail(member.user.avatarURL)
|
||||
.setDescription(`:wave: ${member.user.username}\n${bot.settings.Leave_Message}`)
|
||||
const LeaveMsg= new Discord.MessageEmbed()
|
||||
.setColor(supportbot.EmbedColour)
|
||||
.setThumbnail(member.user.avatarURL)
|
||||
.setDescription(`:wave: ${member.user.username}\n${supportbot.LeaveMessage}`)
|
||||
|
||||
channel.send(LeaveMsg);
|
||||
|
||||
});
|
||||
|
||||
bot.login(bot.settings.token);
|
||||
bot.login(supportbot.Token);
|
||||
+9
-12
@@ -1,18 +1,15 @@
|
||||
{
|
||||
"name": "supportbot",
|
||||
"version": "3.4",
|
||||
"description": "SupportBot",
|
||||
"version": "5.1.0",
|
||||
"description": "a discord dbot that can you help with your servers support",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"discord.js": "^11.4.2"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
"test": "!help"
|
||||
"test": "-help"
|
||||
},
|
||||
"keywords": [
|
||||
"SupportBot"
|
||||
],
|
||||
"author": "Emerald Services",
|
||||
"homepage": "https://discord.gg/hmWgxdF"
|
||||
"author": "Emerald SRV",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"discord.js": "^12.1.1",
|
||||
"js-yaml": "^3.13.1"
|
||||
}
|
||||
}
|
||||
@@ -3,16 +3,17 @@
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const bot = new Discord.Client()
|
||||
const someaddon = new Discord.Client()
|
||||
|
||||
bot.settings = require("../settings.json");
|
||||
someaddon.settings = require("./settings/someaddon.json");
|
||||
|
||||
exports.run = async(bot, message, args) => {
|
||||
message.delete();
|
||||
|
||||
message.channel.send(":white_check_mark: **SupportBot Addon**\nThis addon is here by default.\nWe are currently working on some super amazing addons for SupportBot\nHowever, If you would like to start creating your own support bot addon\ncontact us at EmeraldServices.\n")
|
||||
message.channel.send(":white_check_mark: **SupportBot Addon**\nYou can download addons from our marketplace. https://emeraldservices.xyz/")
|
||||
|
||||
}
|
||||
|
||||
exports.help = {
|
||||
name: 'addon',
|
||||
}
|
||||
name: someaddon.settings.Addon_Example_Command,
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
|
||||
"Addon_Example_Command": "addonexample"
|
||||
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
{
|
||||
|
||||
"SupportBot": "v3.4 / Download addons @ https://itzemerald.tk/",
|
||||
|
||||
"token": "TOKEN",
|
||||
"prefix": "!",
|
||||
"botname": "SupportBot",
|
||||
"colour": "#42f477",
|
||||
"footer": "Support Bot, By Emerald",
|
||||
|
||||
"BotStatus": "Support Bot",
|
||||
|
||||
"staff": "Staff",
|
||||
"support": "Support",
|
||||
"everyone": "@everyone",
|
||||
|
||||
"category": "Tickets",
|
||||
"Ticket_Message": "Your support ticket has been opened successfully\nPlease allow us some time to reach out to you.",
|
||||
"Ticket_Logs": "ticket-logs",
|
||||
|
||||
"Announcement_Title": "SupportBot Announcement",
|
||||
"Announcement_Channel": "announcements",
|
||||
|
||||
"Welcome_Message": "Welcome to the server!",
|
||||
"Welcome_Channel": "welcome",
|
||||
|
||||
"Leave_Message": "Thank you for visiting us!",
|
||||
"Leave_Channel": "welcome",
|
||||
|
||||
"Poll_Channel": "polls",
|
||||
"Poll_Title": "📊 Polls",
|
||||
"Reaction_Poll_1": "✅",
|
||||
"Reaction_Poll_2": "❎",
|
||||
|
||||
"Suggestion_Title": "SupportBot Suggestions",
|
||||
"Suggestion_Channel": "suggestions",
|
||||
"suggestyes": "✅",
|
||||
"suggestno": "❎",
|
||||
|
||||
"Report_Channel": "reports",
|
||||
"Report_Title": "SupportBot Report",
|
||||
|
||||
"LINK_1_NAME": "Discord",
|
||||
"LINK_2_NAME": "Twitter",
|
||||
"LINK_3_NAME": "Website",
|
||||
|
||||
"LINK_1": "https://dicord.gg/changemeinconfig",
|
||||
"LINK_2": "https://twitter.com/changemeinconfig",
|
||||
"LINK_3": "https://www.example.com/",
|
||||
|
||||
"LINKS_TITLE": "SupportBot Links",
|
||||
|
||||
"Ticket_Command": "ticket",
|
||||
"Suggest_Command": "suggest",
|
||||
"Say_Command": "say",
|
||||
"Remove_Command": "remove",
|
||||
"Add_Command": "add",
|
||||
"Ping_Command": "ping",
|
||||
"Close_Command": "close",
|
||||
"Forceclose_Command": "forceclose",
|
||||
"Rename_Command": "rename",
|
||||
"Help_Command": "help",
|
||||
"Link_Command": "links",
|
||||
"Lockchat_Command": "lock",
|
||||
"UnLockchat_Command": "unlock",
|
||||
"Poll_Command": "poll",
|
||||
"Report_Command": "report"
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{}
|
||||
@@ -0,0 +1,120 @@
|
||||
# _________ __ __________ __
|
||||
# / _____/__ ________ ______ ____________/ |\______ \ _____/ |_
|
||||
# \_____ \| | \____ \\____ \ / _ \_ __ \ __\ | _// _ \ __\
|
||||
# / \ | / |_> > |_> > <_> ) | \/| | | | ( <_> ) |
|
||||
# /_______ /____/| __/| __/ \____/|__| |__| |______ /\____/|__|
|
||||
# \/ |__| |__| \/
|
||||
#
|
||||
# SupportBot v5.2
|
||||
# Created by © 2020 Emerald Services
|
||||
# License: MIT
|
||||
|
||||
#Bot Indentification
|
||||
Token: "BOT_TOKEN_HERE"
|
||||
Prefix: "!"
|
||||
Bot_Name: "SupportBot"
|
||||
|
||||
BotActivity: "SupportBot v5.2"
|
||||
ActivityType: "PLAYING"
|
||||
|
||||
EmbedColour: "#4bbf5c"
|
||||
EmbedFooter: "SupportBot | The #1 Supportive Discord Bot"
|
||||
|
||||
# Colour Settings
|
||||
ErrorColour: "#ff3030"
|
||||
SuccessColour: "#4bbf5c"
|
||||
WarningColour: "#fca117"
|
||||
|
||||
# Role Settings
|
||||
AutoRole: "Member"
|
||||
StaffRole: "Support"
|
||||
|
||||
locked_role: "@everyone"
|
||||
everyone: "@everyone"
|
||||
|
||||
Department_Role_1: "Support"
|
||||
Department_Role_2: "Sales"
|
||||
Department_Role_3: "Support"
|
||||
|
||||
# Ticket Department Settings
|
||||
Ticket_Department_1: "Support"
|
||||
Ticket_Department_2: "Sales"
|
||||
Ticket_Department_3: "Other"
|
||||
|
||||
Ticket_Department_Emoji_1: "🟢"
|
||||
Ticket_Department_Emoji_2: "🔵"
|
||||
Ticket_Department_Emoji_3: "🔴"
|
||||
|
||||
# Ticket Settings
|
||||
category: "Tickets"
|
||||
Ticket_Colour: "#4bbf5c"
|
||||
Ticket_Channel_Name: "ticket"
|
||||
Ticket_Logs: "ticket-logs"
|
||||
|
||||
Transcript_Log: "ticket-data"
|
||||
Transcript_Title: "Support Transcript"
|
||||
|
||||
Ticket_Closing: "⚠ Your ticket is now closing!"
|
||||
Ticket_Closure: "Looks like you have come to the end of your support ticket\nPlease confirm that you want to close your ticket."
|
||||
Closure_Confirm_Word: "confirm"
|
||||
|
||||
Ticket_Message: "Your support ticket has been opened successfully\nPlease allow us some time to reach out to you."
|
||||
Default_Ticket_Reason: "No Subject"
|
||||
|
||||
# Welcome & Leave
|
||||
WelcomeChannel: "welcome"
|
||||
WelcomeMessage: "Welcome to the server!"
|
||||
|
||||
LeaveChannel: "welcome"
|
||||
LeaveMessage: "Thank you for visiting us!"
|
||||
|
||||
# Announcement Settings
|
||||
Announcement_Title: "SupportBot Announcement"
|
||||
Announcement_Channel: "announcements"
|
||||
Announcement_Tag_Role: "@everyone"
|
||||
|
||||
# Poll Settings
|
||||
Poll_Channel: "polls"
|
||||
Poll_Title: "📊 Polls"
|
||||
|
||||
Reaction_Poll_1: "✅"
|
||||
Reaction_Poll_2: "❎"
|
||||
|
||||
# Suggestion Settings
|
||||
Suggestion_Title: "SupportBot Suggestions"
|
||||
Suggestion_Channel: "suggestions"
|
||||
|
||||
suggestyes: "✅"
|
||||
suggestno: "❎"
|
||||
|
||||
# Report Settings
|
||||
Report_Channel: "reports"
|
||||
Report_Title: "SupportBot Report"
|
||||
|
||||
# Link Settings
|
||||
LINKS_TITLE: "SupportBot Links"
|
||||
|
||||
LINKS:
|
||||
"Discord": "https://discord.gg/"
|
||||
"Twitter": "https://twitter.com/"
|
||||
"Website": "https://example.com/"
|
||||
"AddMore": "AddMoreIfYouWant"
|
||||
|
||||
# Bot Command Settings
|
||||
Add_Command: "add"
|
||||
Remove_Command: "remove"
|
||||
Ticket_Command: "ticket"
|
||||
Close_Command: "close"
|
||||
Forceclose_Command: "forceclose"
|
||||
Rename_Command: "rename"
|
||||
Lockchat_Command: "lock"
|
||||
UnLockchat_Command: "unlock"
|
||||
Announcement_Command: "announce"
|
||||
Say_Command: "say"
|
||||
Suggest_Command: "suggest"
|
||||
Ping_Command: "ping"
|
||||
Help_Command: "help"
|
||||
Link_Command: "links"
|
||||
Poll_Command: "poll"
|
||||
Report_Command: "report"
|
||||
Setup_Command: "setup"
|
||||
@@ -0,0 +1,72 @@
|
||||
// SupportBot Utility
|
||||
// Ticket Numbers
|
||||
|
||||
const discord = require("discord.js")
|
||||
const fs = require("fs");
|
||||
|
||||
const yaml = require('js-yaml');
|
||||
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
|
||||
|
||||
class TicketNumberID {
|
||||
|
||||
static pad(guildId) {
|
||||
let n = this.get(guildId) + '';
|
||||
let z = '0';
|
||||
let width = 4;
|
||||
setTimeout(() => {
|
||||
this.set(guildId, this.get(guildId) + 1);
|
||||
}, 50);
|
||||
return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
|
||||
}
|
||||
|
||||
static get(guildId) {
|
||||
|
||||
let ticketnumberID = JSON.parse(fs.readFileSync("./storage/tickets.json", "utf8"));
|
||||
|
||||
if (!ticketnumberID[guildId]) {
|
||||
ticketnumberID[guildId] = {
|
||||
id: 0
|
||||
}
|
||||
|
||||
fs.writeFileSync("./storage/tickets.json", JSON.stringify(ticketnumberID, null, 4), err => {
|
||||
if (err) console.log(err);
|
||||
});
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
} else {
|
||||
return ticketnumberID[guildId].id;
|
||||
}
|
||||
}
|
||||
|
||||
static set(guildId, value) {
|
||||
let ticketnumberID = JSON.parse(fs.readFileSync("./storage/tickets.json", "utf8"));
|
||||
|
||||
ticketnumberID[guildId] = {
|
||||
id: value
|
||||
}
|
||||
|
||||
fs.writeFileSync("./storage/tickets.json", JSON.stringify(ticketnumberID, null, 4), err => {
|
||||
if (err) console.log(err);
|
||||
});
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static reset(guildId) {
|
||||
let ticketnumberID = JSON.parse(fs.readFileSync("./storage/tickets.json", "utf8"));
|
||||
|
||||
ticketnumberID[guildId] = {
|
||||
id: 0
|
||||
}
|
||||
|
||||
fs.writeFileSync("./storage/tickets.json", JSON.stringify(ticketnumberID, null, 4), err => {
|
||||
if (err) console.log(err);
|
||||
});
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = TicketNumberID;
|
||||
Reference in new issue
Block a user