Compare commits

...
109 Commits
Author SHA1 Message Date
ItzEmerald 0bd990a9e3 updated index.js 2020-03-31 09:57:39 +01:00
ItzEmerald 9c8ee1471b updated version number 2020-03-31 09:56:09 +01:00
ItzEmerald 87262e82a3 Update forceclose.js 2020-03-31 00:15:10 +01:00
ItzEmerald 953db88ed2 Update close.js 2020-03-31 00:14:47 +01:00
doge a44bb949eb Merge pull request #13 from 1tzemerald/version-5.2
Update README.md
2020-03-12 20:28:49 -04:00
doge 9d11369059 Update README.md 2020-03-12 20:28:02 -04:00
ItzEmerald 8c92f39349 Delete package-lock.json 2020-02-23 13:13:31 +00:00
ItzEmerald bce9d733d3 Update package.json 2020-02-23 13:13:12 +00:00
ItzEmerald 525c216401 Update suggest.js 2020-02-09 13:14:10 +00:00
ItzEmerald c145e9f11d Update README.md 2020-02-04 10:42:59 +00:00
ItzEmerald 53700003f1 Update README.md 2020-02-04 10:41:12 +00:00
ItzEmerald 03094a4c35 Update README.md 2020-02-04 10:39:09 +00:00
ItzEmerald 934ebed24f Update ticket.js 2020-02-02 12:06:04 +00:00
ItzEmerald 9f469e1637 Update supportbot-config.yml 2020-01-30 21:03:17 +00:00
ItzEmerald 77fe39774d Update close.js 2020-01-30 21:02:35 +00:00
ItzEmerald 186d688ec8 Delete setup.js 2020-01-30 20:56:37 +00:00
ItzEmerald de3181b5c7 Update tickets.json 2020-01-29 21:43:06 +00:00
ItzEmerald 6d53234f7a Update supportbot-config.yml 2020-01-29 21:42:37 +00:00
ItzEmerald b0d3673f4b Update close.js 2020-01-29 21:41:56 +00:00
ItzEmerald e40083f585 Add files via upload 2020-01-29 21:40:44 +00:00
ItzEmerald f7b702fa29 Update ticket.js 2020-01-29 20:06:28 +00:00
ItzEmerald 5089a19a56 Update TicketNumber.js 2020-01-29 20:05:34 +00:00
ItzEmerald d77e9842aa Update TicketNumber.js 2020-01-29 19:59:44 +00:00
ItzEmerald 88ae76a25a Update ticket.js 2020-01-29 19:59:14 +00:00
ItzEmerald 9b0b0d10a1 Update ticket.js 2020-01-29 19:08:00 +00:00
ItzEmerald 68340a8b02 Create tickets.json 2020-01-29 18:59:22 +00:00
ItzEmerald d14f0966d5 Update TicketNumber.js 2020-01-29 18:58:58 +00:00
ItzEmerald e4b83f28c4 Update TicketNumber.js 2020-01-29 18:57:22 +00:00
ItzEmerald 1925deec90 Create TicketNumber.js 2020-01-29 18:55:32 +00:00
ItzEmerald e9ba960b29 Delete utils 2020-01-29 18:52:23 +00:00
ItzEmerald 821f0f5b60 Create utils 2020-01-29 18:52:13 +00:00
ItzEmerald 8fa8915673 Update README.md 2020-01-29 18:34:02 +00:00
ItzEmerald 5405aa469e Update README.md 2020-01-29 18:33:42 +00:00
ItzEmerald cfa50b4e8c Update README.md 2020-01-29 18:33:17 +00:00
ItzEmerald c5014baeb4 Update README.md 2020-01-29 18:32:09 +00:00
ItzEmerald c14f120ec2 Update README.md 2020-01-29 18:27:10 +00:00
ItzEmerald b72fcf39da Update help.js 2020-01-26 23:53:53 +00:00
ItzEmerald 6da3b0cba0 Update README.md 2020-01-26 22:47:39 +00:00
ItzEmerald 752387a02d Update README.md 2020-01-26 22:47:05 +00:00
ItzEmerald 32d3e1b957 Update README.md 2020-01-26 22:46:47 +00:00
ItzEmerald a029dff202 Update README.md 2020-01-26 22:44:45 +00:00
ItzEmerald 89e1b85a56 Delete settings.json 2020-01-26 22:38:25 +00:00
ItzEmerald 4350eb709c Delete old.json 2020-01-26 22:38:13 +00:00
ItzEmerald 2b1b6e916e Updated SupportBot
Pre-Release - 5.1.0
2020-01-26 22:35:45 +00:00
ItzEmerald 3f6f9045bd Update announce.js 2020-01-25 16:59:35 +00:00
ItzEmerald 8294496faa Update add.js 2020-01-25 16:56:56 +00:00
ItzEmerald 9f58118ecd Update supportbot-config.yml 2020-01-25 16:51:30 +00:00
ItzEmerald 3ba9d42587 Delete terminal.sh 2020-01-25 14:20:08 +00:00
ItzEmerald e496a5f3d0 Delete terminal.bat 2020-01-25 14:19:45 +00:00
ItzEmerald 04e2bb29b0 Update supportbot-config.yml 2020-01-25 14:09:40 +00:00
ItzEmerald 131a7a015c Update supportbot-config.yml 2020-01-25 14:03:20 +00:00
ItzEmerald 6f430f5f14 Create supportbot-config.yml 2020-01-25 13:57:23 +00:00
ItzEmerald 0154c106ef updated index.js 2020-01-25 13:55:33 +00:00
ItzEmerald 04de6e6fc0 Update index.js 2020-01-25 13:48:02 +00:00
ItzEmerald 2b17e5f842 Update index.js 2020-01-25 13:42:44 +00:00
ItzEmerald 0dc8c1e68a updated announce.js
cleaned up the code + updated the command executed message
2020-01-25 13:37:25 +00:00
ItzEmerald 67b291eb09 Update add.js 2020-01-25 13:30:13 +00:00
ItzEmerald d7865a5a4e Update add.js 2020-01-25 13:28:01 +00:00
ItzEmerald d1809587a8 Updated add.js
Cleaned and updated the code within the file alongside the console.log for executing the command.
2020-01-25 13:20:44 +00:00
ItzEmerald 64ec4dfd53 Update LICENSE 2020-01-22 22:44:36 +00:00
ItzEmerald 6e07d21a3d Create someaddon.json 2020-01-22 22:42:10 +00:00
ItzEmerald 018e47bd53 Update default-addon.js 2020-01-22 22:41:33 +00:00
ItzEmerald 065a2e9347 Update help.js 2020-01-05 21:37:08 +00:00
ItzEmerald b53307c7fd Update ticket.js 2020-01-05 16:33:31 +00:00
ItzEmerald e4cc0d960e Update ticket.js 2020-01-05 15:33:23 +00:00
ItzEmerald 3336824df7 Update close.js 2020-01-05 15:22:50 +00:00
TommyTran732 166173d53c Update entrypoint.sh 2020-01-03 04:40:13 -05:00
TommyTran732 45da2d7924 Create entrypoint.sh 2020-01-02 11:51:19 -05:00
TommyTran732 af14a65ef5 Create Dockerfile 2020-01-02 11:50:14 -05:00
ItzEmerald 9049a4b9ad Update rename.js 2019-12-11 18:17:00 +00:00
ItzEmerald 2f4873ab9a Update settings.json 2019-12-07 13:08:34 +00:00
ItzEmerald 0fb25d71dc Update rename.js 2019-12-03 23:24:43 +00:00
ItzEmerald 34b6901434 Update remove.js 2019-12-03 23:24:22 +00:00
ItzEmerald a90b43aba3 Update add.js 2019-12-03 23:24:01 +00:00
ItzEmerald 0ac5c2c300 Update forceclose.js 2019-12-03 23:23:33 +00:00
ItzEmerald 6290fee7bd Update close.js 2019-12-03 23:22:54 +00:00
ItzEmerald 320992f3fa Update ticket.js 2019-12-03 23:17:47 +00:00
ItzEmerald bd714f0c93 Update ticket.js 2019-12-03 23:15:52 +00:00
ItzEmerald 45d3867c1f Update ticket.js 2019-12-03 23:13:56 +00:00
ItzEmerald deafa66565 Update settings.json 2019-12-03 23:13:02 +00:00
ItzEmerald ce8fcdaa7a Update settings.json 2019-12-03 23:11:58 +00:00
ItzEmerald b83965c144 Update ticket.js 2019-12-03 23:10:41 +00:00
ItzEmerald 2505a8cab8 Created MIT License 2019-12-03 21:41:34 +00:00
ItzEmerald 21e598bb31 Delete LICENSE 2019-12-03 21:39:11 +00:00
ItzEmerald ee2f3c0dfc Created GNU License 2019-12-03 21:32:00 +00:00
ItzEmerald 197bda14b8 Update rename.js 2019-11-29 22:34:57 +00:00
ItzEmerald d416c2e421 Update README.md 2019-11-18 16:12:28 +00:00
ItzEmerald 6bc2e669e4 Update README.md 2019-11-18 16:12:13 +00:00
ItzEmerald 9accb65256 Update README.md 2019-11-18 16:11:23 +00:00
ItzEmerald d9212584ca Update README.md 2019-11-18 16:10:19 +00:00
ItzEmerald 1a7effb422 Update README.md 2019-11-18 16:09:37 +00:00
ItzEmerald 1480435f15 Update index.js 2019-11-18 15:53:02 +00:00
ItzEmerald 64c6a97657 Update index.js 2019-11-18 15:49:36 +00:00
ItzEmerald 7ae2ff9837 Update settings.json 2019-11-18 15:49:21 +00:00
ItzEmerald f19dec405d Updated settings.json 2019-11-18 15:29:33 +00:00
ItzEmerald bbd4e9d162 Update ticket.js 2019-11-17 22:24:05 +00:00
ItzEmerald 58deff0869 Updated close.js
Added ticket transcripts
2019-11-17 21:27:13 +00:00
ItzEmerald 628632f43e Update forceclose.js 2019-11-15 21:54:32 +00:00
ItzEmerald 436586117c Update close.js 2019-11-15 21:53:39 +00:00
ItzEmerald 7234ec728c Update close.js 2019-11-15 20:43:29 +00:00
ItzEmerald fc4d68be39 Update forceclose.js 2019-11-15 20:31:58 +00:00
ItzEmerald bcf2df4bff Update close.js 2019-11-15 20:27:10 +00:00
ItzEmerald 70a469a951 Update settings.json
Added settings for transcripts
2019-11-15 20:25:43 +00:00
ItzEmerald 981995cb32 Merge pull request #7 from iJosGCS/patch-1
Update close.js
2019-11-15 20:00:14 +00:00
Joseph Gonzalo 406c7d368b Update close.js 2019-11-15 13:58:24 -06:00
ItzEmerald 5c266d8b8d Update README.md 2019-11-01 20:27:24 +00:00
Joseph Gonzalo 4f5b94a491 Update README.md 2019-10-17 17:08:13 -06:00
ItzEmerald 284c83cc1d Update help.js 2019-09-28 17:30:57 +01:00
RedstoneGamez 23f06af202 Update README.md 2019-09-07 14:59:59 -03:00
32 changed files with 832 additions and 1234 deletions

No files matched your search

+18
View File
@@ -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"]
+21
View File
@@ -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.
+5 -135
View File
@@ -1,135 +1,5 @@
<h1 align="center">SupportBot v4.0.1</h1> <h1 align="center">SupportBot</h1>
<h4 align="center">A Self Hosted discord application</h4> <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>
<p align="center"> Version 5.2
<a href="https://discord.gg/hmWgxdF"> <hr>
<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">
<img src="https://img.shields.io/github/release/EmeraldRusher/SupportBot.svg" alt="GitHub release">
<img src="https://img.shields.io/github/package-json/dependency-version/EmeraldRusher/SupportBot/discord.js.svg" alt="GitHub package.json dependency version (prod)">
</p>
SupportBot is a free & open source discord bot for your server that has the capability to control & manage your servers support.
| Version | Supported | Status |
| ------- | ------------------ |--------------------|
| 1.x | 🚫 | Discontinued |
| 2.x | 🚫 | Discontinued |
| 3.x | ✔️ | Supported |
| 4.x | ✔️ | Supported |
| Premium | ❌ | Not released yet |
# 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.
# Help
If you don't understand something, you are experiencing problems, or you just need a gentle nudge in the right direction, please don't hesitate to join our official [Emerald Services Server](https://discord.gg/u47MQJ).
# 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:
```
{
"SupportBot": "v4.0.0",
"token": "BOT_TOKEN_HERE",
"prefix": "!",
"botname": "SupportBot",
"colour": "#13bd2a",
"footer": "Support Bot, By Emerald Services",
"BotStatus": "Support Bot",
"staff": "Staff",
"support": "Support",
"everyone": "@everyone",
"Auto_Role": "Member",
"LINKS": {
"Discord": "https://discord.gg/",
"Twitter": "https://twitter.com/",
"Website": "https://example.com/",
"AddMore": "AddMoreIfYouWant"
},
"LINKS_TITLE": "SupportBot Links",
"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",
"Default_Ticket_Reason": "No Subject",
"Ticket_React_Message": ":mailbox: React to create your support ticket.",
"Commands_Log_Title": "SupportBot Logs",
"Command_Log_Channel": "command-logs",
"Announcement_Title": "SupportBot Announcement",
"Announcement_Channel": "announcements",
"Announcement_Tag_Role": "@everyone",
"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",
"Announcement_Command": "announce",
"Say_Command": "say",
"Suggest_Command": "suggest",
"Ping_Command": "ping",
"Ticket_Command": "ticket",
"Remove_Command": "remove",
"Add_Command": "add",
"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"
}
```
# Contributors List
<p>
<a href="https://github.com/iJosGCS">
<img src="https://cdn.discordapp.com/avatars/199237487648833556/cdd7d976b75698b19e3c6b64e1dcdceb.png?size=32" alt="iJosGCS Profile">
<strong>@iJosGCS</strong>
</a>
</p>
<p>
<a href="https://github.com/RedstoneGamez">
<img src="https://cdn.discordapp.com/avatars/282610987801247744/9567e0674a5a6d371bb5d6efb956d57b.png?size=32" alt="RedstoneGamez Profile">
<strong>@RedstoneGamez</strong>
</a>
</p>
# Donators List
# Community
<p align="center">
<a href="https://discord.gg/hmWgxdF">
<img src="https://discordapp.com/api/guilds/516345301985132552/widget.png?style=banner1" alt="Discord Server">
</a>
</p>
+41 -54
View File
@@ -1,75 +1,62 @@
// SupportBot // SupportBot
// Command: Add User // Created by © 2020 Emerald Services
// Command: Add
const Discord = require("discord.js"); 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) => { const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
message.delete()
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.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.Add_Command}`);
const rolemissing = new Discord.RichEmbed() let staffGroup = message.guild.roles.find(staffRole => staffRole.name === supportbot.StaffRole);
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.staff}**`)
.setColor(bot.settings.colour)
if (!staffGroup) return message.reply({embed: rolemissing});
const donothaverole = new Discord.RichEmbed() const rolemissing = new Discord.RichEmbed()
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.staff}**`) .setDescription(`:x: Looks like this server doesn't have the role **${supportbot.StaffRole}**`)
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour);
if (!message.member.roles.has(staffGroup.id)) return message.reply({embed: donothaverole}); if (!staffGroup) return message.reply({embed: rolemissing});
const outsideticket = new Discord.RichEmbed() const donothaverole = new Discord.RichEmbed()
.setDescription(`:x: Cannot use this command becase you are outside a ticket channel.`) .setDescription(`:x: Sorry! You cannot use this command with the role **${supportbot.StaffRole}**`)
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour);
if (!message.channel.name.startsWith(`ticket-`)) return message.channel.send({embed: outsideticket}); if (!message.member.roles.has(staffGroup.id)) return message.reply({embed: donothaverole});
let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0])); const outsideticket = new Discord.RichEmbed()
.setDescription(`:x: Cannot use this command becase you are outside a ticket channel.`)
.setColor(supportbot.EmbedColour);
if (!message.channel.name.startsWith(`${supportbot.Ticket_Channel_Name}-`)) return message.channel.send({embed: outsideticket});
const cantfinduser = new Discord.RichEmbed() let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
.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 channel = message.guild.channels.find(channel => channel.name === message.channel.name); const cantfinduser = new Discord.RichEmbed()
.setDescription(`:x: Hmm! Does that user exist? I cannot find the user.`)
.setColor(supportbot.EmbedColour);
if(!rUser) return message.channel.send({embed: cantfinduser});
const cantfindchannel = new Discord.RichEmbed() const channel = message.guild.channels.find(channel => channel.name === message.channel.name);
.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 cantfindchannel = new Discord.RichEmbed()
.setDescription(`:x: Hmm! Does that ticket exist? I cannot find the ticket channel.`)
.setColor(supportbot.EmbedColour);
const useradded = new Discord.RichEmbed() if(!channel) return message.channel.send({embed: cantfindchannel});
.setColor(bot.settings.colour) // message.delete().catch(O_o=>{});
.setDescription(`:white_check_mark: Successfully Added ${rUser} to the ticket.`) message.channel.overwritePermissions(rUser, { READ_MESSAGES: true, SEND_MESSAGES: true });
.setTimestamp();
message.channel.send({embed: useradded}); const useradded = new Discord.RichEmbed()
console.log(`\x1b[36m`, `${message.author} has successfully added ${rUser} to ${message.channel}`) .setColor(supportbot.EmbedColour)
.setTitle("User Added")
.setDescription(`👍 ${rUser} has been added to this ticket`)
.setTimestamp();
message.channel.send({embed: useradded});
const CMDLog = new Discord.RichEmbed() };
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Add_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
exports.help = { exports.help = {
name: bot.settings.Add_Command, name: supportbot.Add_Command,
} };
+25 -35
View File
@@ -1,64 +1,54 @@
// SupportBot // SupportBot
// Command: Say // Created by © 2020 Emerald Services
// Command: Announce (including @everyone)
const Discord = require("discord.js"); 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) => { const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
exports.run = (bot, message, args) => {
message.delete(); 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.Announcement_Command}`);
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === `${supportbot.StaffRole}`)
const rolemissing = new Discord.RichEmbed() const rolemissing = new Discord.RichEmbed()
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.staff}**`) .setDescription(`:x: Looks like this server doesn't have the role **${supportbot.StaffRole}**`)
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
if (!staffGroup) return message.reply(rolemissing).catch(err=>{console.error(err)}) if (!staffGroup) return message.reply(rolemissing).catch(err=>{console.error(err)})
const donothaverole = new Discord.RichEmbed() const donothaverole = new Discord.RichEmbed()
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.staff}**`) .setDescription(`:x: Sorry! You cannot use this command with the role **${supportbot.StaffRole}**`)
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
if (!message.member.roles.has(staffGroup.id)) return message.reply(donothaverole) if (!message.member.roles.has(staffGroup.id)) return message.reply(donothaverole)
const embed = new Discord.RichEmbed() const embed = new Discord.RichEmbed()
.setTitle(`${bot.settings.Announcement_Title}`) .setTitle(`${supportbot.Announcement_Title}`)
.setDescription(args.join(" ")) .setDescription(args.join(" "))
.setTimestamp() .setTimestamp()
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
.setFooter(`${message.author.username}#${message.author.discriminator}`, message.author.displayAvatarURL) .setFooter(`${message.author.username}#${message.author.discriminator}`, message.author.displayAvatarURL)
let ac = message.guild.channels.find(AnnounceChannel => AnnounceChannel.name === `${bot.settings.Announcement_Channel}`) let ac = message.guild.channels.find(AnnounceChannel => AnnounceChannel.name === `${supportbot.Announcement_Channel}`)
if(!ac) return message.channel.send(`:x: Error! Could not find the logs channel **${bot.settings.Announcement_Channel}**`) if(!ac) return message.channel.send(`:x: Error! Could not find the logs channel **${supportbot.Announcement_Channel}**`)
ac.send("@everyone").then((msg) => { ac.send("@everyone").then((msg) => {
ac.send(embed); ac.send(embed);
}); });
const SuggestionSuccessEmbed = new Discord.RichEmbed() const AccSuccessEmbed = new Discord.RichEmbed()
.setDescription(`:white_check_mark: You have successfully created an announcement. <#${ac.id}>`) .setTitle("Announcement Created")
.setColor(bot.settings.colour) .setDescription(`👍 Successfully sent your announcement to <#${ac.id}>`)
message.channel.send(SuggestionSuccessEmbed); .setColor(supportbot.EmbedColour)
message.channel.send({embed: AccSuccessEmbed});
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Announcement_Command}`)
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Announcement_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
} }
exports.help = { exports.help = {
name: bot.settings.Announcement_Command, name: supportbot.Announcement_Command,
} }
+100 -42
View File
@@ -1,58 +1,116 @@
// SupportBot // SupportBot
// Command: Close Ticket // Created by © 2020 Emerald Services
// Command: Close
const Discord = require("discord.js"); 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) => { exports.run = (bot, message, args) => {
message.delete();
const outsideticket = 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.Close_Command}`);
.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'],
}).then((collected) => { if ( !message.channel.name.startsWith( `${supportbot.Ticket_Channel_Name}-` ) ) {
message.channel.delete(); const embed = new Discord.RichEmbed()
.setDescription(`:x: Cannot use this command becase you are outside a ticket channel.`)
.setColor(supportbot.EmbedColour);
}).catch(() => { message.channel.send(embed);
m.edit('Close ticket request, timedout').then(m2 => { return;
m2.delete(); }
}, 3000);
const closeRequestEmbed = new Discord.RichEmbed()
.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.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.RichEmbed()
.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.fetchMessages({ 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.Attachment( Buffer.from( txt ), `${name}.txt` ) );
message.channel.delete();
// message.channel.fetchMessages( { 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}`)
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Close_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
} }
exports.help = { exports.help = {
name: bot.settings.Close_Command, name: supportbot.Close_Command,
} }
+54 -31
View File
@@ -1,50 +1,73 @@
// SupportBot // SupportBot
// Command: Forceclose Ticket // Created by © 2020 Emerald Services
// Command: Forceclose
const Discord = require("discord.js"); 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) => { const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
message.delete();
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === `${bot.settings.staff}`) exports.run = async (bot, message, args) => {
const rolemissing = 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.Forceclose_Command}`);
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.staff}**`)
.setColor(bot.settings.colour)
if (!staffGroup) return message.reply({embed: rolemissing});
const donothaverole = new Discord.RichEmbed() let staffGroup = message.guild.roles.find(staffRole => staffRole.name === `${supportbot.StaffRole}`)
.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({embed: donothaverole});
const outsideticket = new Discord.RichEmbed() const rolemissing = new Discord.RichEmbed()
.setDescription(`:x: Cannot use this command becase you are outside a ticket channel.`) .setDescription(`:x: Looks like this server doesn't have the role **${supportbot.StaffRole}**`)
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
if (!message.channel.name.startsWith(`ticket-`)) return message.channel.send({embed: outsideticket}); if (!staffGroup) return message.reply({embed: rolemissing});
message.channel.delete();
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Forceclose_Command}`) const donothaverole = new Discord.RichEmbed()
.setDescription(`:x: Sorry! You cannot use this command with the role **${supportbot.StaffRole}**`)
.setColor(supportbot.EmbedColour)
if (!message.member.roles.has(staffGroup.id)) return message.reply({embed: donothaverole});
const CMDLog = new Discord.RichEmbed() const outsideticket = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title) .setDescription(`:x: Cannot use this command becase you are outside a ticket channel.`)
.addField(`User`, `<@${message.author.id}>`) .setColor(supportbot.EmbedColour)
.addField(`Command`, bot.settings.Forceclose_Command, true) if (!message.channel.name.startsWith(`${supportbot.Ticket_Channel_Name}-`)) return message.channel.send({embed: outsideticket});
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`); const log = message.guild.channels.find(channel => channel.name === supportbot.Transcript_Log)
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```); const uID = message.author
const reason = args.join(" ") || "No Reason Provided.";
const name = message.channel.name;
const c = message.channel;
CommandLog.send(CMDLog); message.channel.send(`Your ticket is currently closing`)
.then(() => {
const embed1 = new Discord.RichEmbed()
.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.fetchMessages({ limit: 100 })
.then(msgs => {
message.channel.fetchMessages({ 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 = { exports.help = {
name: bot.settings.Forceclose_Command, name: supportbot.Forceclose_Command,
} }
+32 -43
View File
@@ -1,62 +1,51 @@
// SupportBot // SupportBot
// Created by © 2020 Emerald Services
// Command: Help // Command: Help
const Discord = require("discord.js"); 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) => { 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 = ""; let userCommands = "";
userCommands += `**${bot.settings.prefix}${bot.settings.Link_Command}**: Get some important links!\n`; userCommands += `**${supportbot.Prefix}${supportbot.Ticket_Command} <reason>**: Create a support ticket\n`;
userCommands += `**${bot.settings.prefix}${bot.settings.Ping_Command}**: Check the bots ping. Pong!\n`; userCommands += `**${supportbot.Prefix}${supportbot.Close_Command}**: Close your support ticket\n`;
userCommands += `**${bot.settings.prefix}${bot.settings.Ticket_Command} <reason>**: Create a support ticket\n`; userCommands += `**${supportbot.Prefix}${supportbot.Suggest_Command} <suggestion>**: Create a server suggestion\n`;
userCommands += `**${bot.settings.prefix}${bot.settings.Close_Command}**: Close your support ticket\n`; userCommands += `**${supportbot.Prefix}${supportbot.Report_Command} <user> <reason>**: Report a valid user\n`;
userCommands += `**${bot.settings.prefix}${bot.settings.Suggest_Command} <suggestion>**: Create a server suggestion\n`; userCommands += `**${supportbot.Prefix}${supportbot.Link_Command}**: Get some important links!\n`;
userCommands += `**${bot.settings.prefix}${bot.settings.Report_Command} <user> <reason>**: Create a server suggestion\n`; userCommands += `**${supportbot.Prefix}${supportbot.Ping_Command}**: Check the bots ping. Pong!\n`;
let supportCommands = ""; let supportCommands = "";
supportCommands += `**${bot.settings.prefix}${bot.settings.Add_Command} <user>**: Adds a user to a ticket\n`; supportCommands += `**${supportbot.Prefix}${supportbot.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 += `**${supportbot.Prefix}${supportbot.Remove_Command} <user>**: Removes a user from a ticket\n`;
supportCommands += `**${bot.settings.prefix}${bot.settings.Forceclose_Command}**: Forceclose a support ticket\n`; supportCommands += `**${supportbot.Prefix}${supportbot.Forceclose_Command}**: Forceclose a support ticket\n`;
supportCommands += `**${bot.settings.prefix}${bot.settings.Rename_Command}**: Rename a support ticket\n`; supportCommands += `**${supportbot.Prefix}${supportbot.Rename_Command}**: Rename a support ticket\n`;
let staffCommands = ""; let staffCommands = "";
staffCommands += `**${bot.settings.prefix}${bot.settings.Announcement_Command} <message>**: Create a bot announcement\n`; staffCommands += `**${supportbot.Prefix}${supportbot.Announcement_Command} <message>**: Create a bot announcement\n`;
staffCommands += `**${bot.settings.prefix}${bot.settings.Say_Command} <message>**: Send a message as the bot\n`; staffCommands += `**${supportbot.Prefix}${supportbot.Say_Command} <message>**: Send a message as the bot\n`;
staffCommands += `**${bot.settings.prefix}${bot.settings.Lockchat_Command}**: Lock the chat channel\n`; staffCommands += `**${supportbot.Prefix}${supportbot.Lockchat_Command}**: Lock the chat channel\n`;
staffCommands += `**${bot.settings.prefix}${bot.settings.UnLockchat_Command}**: UnLock 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() const embed = new Discord.RichEmbed()
.setTitle(bot.settings.botname) .setTitle(supportbot.Bot_Name)
.addField(":ticket: Support Commands", userCommands) .addField("👨 User Commands", userCommands)
.addField(":pushpin: Support Commands", supportCommands, true) .addField(":pushpin: Support Commands", supportCommands)
.addField(":pushpin: Staff Commands", staffCommands, true) .addField("🔑 Staff Commands", staffCommands)
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
.setFooter(bot.settings.footer, message.author.displayAvatarURL); .setFooter(supportbot.EmbedFooter, message.author.displayAvatarURL);
message.channel.send(embed);
message.channel.send(embed)
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Help_Command}`)
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Help_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via settings.json`);
CommandLog.send(CMDLog);
} }
exports.help = { exports.help = {
name: bot.settings.Help_Command, name: supportbot.Help_Command,
} };
+20 -32
View File
@@ -1,48 +1,36 @@
// SupportBot // SupportBot
// Command: Help // Created by © 2020 Emerald Services
// Command: Links
const Discord = require( "discord.js" ); 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 ) => { exports.run = ( bot, message, args ) => {
message.delete();
let botLinks = bot.settings.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}`);
let botLinks = supportbot.LINKS;
let links = ''; let links = '';
for ( let name in botLinks ) { for ( let name in botLinks ) {
links += `[${name}](${botLinks[ name ]})\n`; links += `[${name}](${botLinks[ name ]})\n`;
} };
let embed = new Discord.RichEmbed() let embed = new Discord.RichEmbed()
.setTitle( bot.settings.LINKS_TITLE ) .setTitle(supportbot.LINKS_TITLE)
.setDescription( links ) .setDescription(links)
.setColor( bot.settings.colour ) .setColor(supportbot.EmbedColour)
.setFooter( bot.settings.footer ) .setFooter(supportbot.EmbedFooter);
message.channel.send(embed);
message.channel.send( embed ); };
console.log( `\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Link_Command}` )
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Link_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
exports.help = { exports.help = {
name: bot.settings.Link_Command, name: supportbot.Link_Command,
} };
+20 -31
View File
@@ -1,25 +1,30 @@
// SupportBot // SupportBot
// Command: Lockchat // Created by © 2020 Emerald Services
// Command: Close
const Discord = require("discord.js"); 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) => { exports.run = async(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.Lockchat_Command}`);
let lockedRole = message.guild.roles.find(lc => lc.name === `${bot.settings.locked_role}`)
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === `${supportbot.StaffRole}`)
let lockedRole = message.guild.roles.find(lc => lc.name === `${supportbot.locked_role}`)
const rolemissing = new Discord.RichEmbed() const rolemissing = new Discord.RichEmbed()
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.staff}**`) .setDescription(`:x: Looks like this server doesn't have the role **${supportbot.StaffRole}**`)
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
if (!staffGroup) return message.reply(rolemissing).catch(err=>{console.error(err)}) if (!staffGroup) return message.reply(rolemissing).catch(err=>{console.error(err)})
const donothaverole = new Discord.RichEmbed() const donothaverole = new Discord.RichEmbed()
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.staff}**`) .setDescription(`:x: Sorry! You cannot use this command with the role **${supportbot.StaffRole}**`)
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
if (!message.member.roles.has(staffGroup.id)) return message.reply(donothaverole) if (!message.member.roles.has(staffGroup.id)) return message.reply(donothaverole)
message.channel.overwritePermissions(lockedRole, { READ_MESSAGES: false, SEND_MESSAGES: false }); message.channel.overwritePermissions(lockedRole, { READ_MESSAGES: false, SEND_MESSAGES: false });
@@ -27,27 +32,11 @@ exports.run = async(bot, message, args) => {
const lockmsg = new Discord.RichEmbed() const lockmsg = new Discord.RichEmbed()
.setDescription(":white_check_mark: **Chat Locked**") .setDescription(":white_check_mark: **Chat Locked**")
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
message.channel.send(lockmsg) message.channel.send(lockmsg);
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Lockchat_Command}`) };
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Lockchat_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
exports.help = { exports.help = {
name: bot.settings.Lockchat_Command, name: supportbot.Lockchat_Command,
} };
+11 -22
View File
@@ -1,37 +1,26 @@
// SupportBot // SupportBot
// Created by © 2020 Emerald Services
// Command: Ping // Command: Ping
const Discord = require("discord.js"); 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) => { 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.Ping_Command}`);
const embed = new Discord.RichEmbed() const embed = new Discord.RichEmbed()
.setDescription(`:ping_pong: **Pong!** \`${bot.ping}ms\` `) .setDescription(`:ping_pong: **Pong!** \`${bot.ping}ms\` `)
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
message.channel.send(embed).catch(console.error); message.channel.send(embed).catch(console.error);
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Ping_Command}`) };
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Ping_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
exports.help = { exports.help = {
name: bot.settings.Ping_Command, name: supportbot.Ping_Command,
} }
+22 -33
View File
@@ -1,60 +1,49 @@
// SupportBot // SupportBot
// Created by © 2020 Emerald Services
// Command: Poll // Command: Poll
const Discord = require("discord.js"); 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) => { 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}`);
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === `${supportbot.StaffRole}`)
const rolemissing = new Discord.RichEmbed() const rolemissing = new Discord.RichEmbed()
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.staff}**`) .setDescription(`:x: Looks like this server doesn't have the role **${supportbot.StaffRole}**`)
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
if (!staffGroup) return message.reply(rolemissing).catch(err=>{console.error(err)}) if (!staffGroup) return message.reply(rolemissing).catch(err=>{console.error(err)})
const donothaverole = new Discord.RichEmbed() const donothaverole = new Discord.RichEmbed()
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.staff}**`) .setDescription(`:x: Sorry! You cannot use this command with the role **${supportbot.StaffRole}**`)
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
if (!message.member.roles.has(staffGroup.id)) return message.reply(donothaverole) if (!message.member.roles.has(staffGroup.id)) return message.reply(donothaverole)
const embed = new Discord.RichEmbed() const embed = new Discord.RichEmbed()
.setTitle(`${bot.settings.Poll_Title}`) .setTitle(`${supportbot.Poll_Title}`)
.setDescription(args.join(" ")) .setDescription(args.join(" "))
.setTimestamp() .setTimestamp()
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
.setFooter(bot.settings.footer, message.author.displayAvatarURL) .setFooter(supportbot.EmbedFooter, message.author.displayAvatarURL)
let ac = message.guild.channels.find(AnnounceChannel => AnnounceChannel.name === `${bot.settings.Poll_Channel}`) let ac = message.guild.channels.find(AnnounceChannel => AnnounceChannel.name === `${supportbot.Poll_Channel}`)
if(!ac) return message.channel.send(`:x: Error! Could not find the logs channel **${bot.settings.Poll_Channel}**`) if(!ac) return message.channel.send(`:x: Error! Could not find the logs channel **${supportbot.Poll_Channel}**`)
ac.send(embed) ac.send(embed)
.then(async function(msg) { .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}`) };
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Close_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
exports.help = { exports.help = {
name: bot.settings.Poll_Command, name: supportbot.Poll_Command,
} };
+41 -52
View File
@@ -1,74 +1,63 @@
// SupportBot // SupportBot
// Command: Remove User // Created by © 2020 Emerald Services
// Command: Remove
const Discord = require("discord.js"); 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) => { const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
message.delete()
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.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.Remove_Command}`);
const rolemissing = new Discord.RichEmbed() let staffGroup = message.guild.roles.find(staffRole => staffRole.name === supportbot.StaffRole)
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.staff}**`)
.setColor(bot.settings.colour)
if (!staffGroup) return message.reply({embed: rolemissing});
const donothaverole = new Discord.RichEmbed() const rolemissing = new Discord.RichEmbed()
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.staff}**`) .setDescription(`:x: Looks like this server doesn't have the role **${supportbot.StaffRole}**`)
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
if (!message.member.roles.has(staffGroup.id)) return message.reply({embed: donothaverole}); if (!staffGroup) return message.reply({embed: rolemissing});
const outsideticket = new Discord.RichEmbed() const donothaverole = new Discord.RichEmbed()
.setDescription(`:x: Cannot use this command becase you are outside a ticket channel.`) .setDescription(`:x: Sorry! You cannot use this command with the role **${supportbot.StaffRole}**`)
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
if (!message.channel.name.startsWith(`ticket-`)) return message.channel.send({embed: outsideticket}); if (!message.member.roles.has(staffGroup.id)) return message.reply({embed: donothaverole});
let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0])); const outsideticket = new Discord.RichEmbed()
.setDescription(`:x: Cannot use this command becase you are outside a ticket channel.`)
.setColor(supportbot.EmbedColour)
if (!message.channel.name.startsWith(`${supportbot.Ticket_Channel_Name}-`)) return message.channel.send({embed: outsideticket});
const cantfinduser = new Discord.RichEmbed() let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
.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 channel = message.guild.channels.find(channel => channel.name === message.channel.name); const cantfinduser = new Discord.RichEmbed()
.setDescription(`:x: Hmm! Does that user exist? I cannot find the user.`)
.setColor(supportbot.EmbedColour)
if(!rUser) return message.channel.send({embed: cantfinduser});
const cantfindchannel = new Discord.RichEmbed() const channel = message.guild.channels.find(channel => channel.name === message.channel.name);
.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 cantfindchannel = new Discord.RichEmbed()
.setDescription(`:x: Hmm! Does that ticket exist? I cannot find the ticket channel.`)
.setColor(supportbot.EmbedColour)
if(!channel) return message.channel.send({embed: cantfindchannel});
// message.delete().catch(O_o=>{});
const useradded = new Discord.RichEmbed() message.channel.overwritePermissions(rUser, { READ_MESSAGES: false, SEND_MESSAGES: false });
.setColor(bot.settings.colour)
.setDescription(`:white_check_mark: Successfully remove ${rUser} from the ticket.`)
.setTimestamp();
message.channel.send({embed: useradded}); const useradded = new Discord.RichEmbed()
console.log(`\x1b[36m`, `${message.author} has successfully removed ${rUser} from ${message.channel}`) .setColor(supportbot.EmbedColour)
.setTitle("User Removed")
.setDescription(`👍 ${rUser} has been removed from this ticket`)
.setTimestamp();
const CMDLog = new Discord.RichEmbed() message.channel.send({embed: useradded});
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Remove_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`); };
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
exports.help = { exports.help = {
name: bot.settings.Remove_Command, name: supportbot.Remove_Command,
} }
+26 -37
View File
@@ -1,63 +1,52 @@
// SupportBot // SupportBot
// Command: Close Ticket // Created by © 2020 Emerald Services
// Command: Rename
const Discord = require("discord.js"); 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) => { const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
message.delete();
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === bot.settings.staff) exports.run = async (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.Rename_Command}`);
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === supportbot.StaffRole)
const rolemissing = new Discord.RichEmbed() const rolemissing = new Discord.RichEmbed()
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.staff}**`) .setDescription(`:x: Looks like this server doesn't have the role **${supportbot.StaffRole}**`)
.setColor(bot.settings.colour) .setColor(supportbot.colour)
if (!staffGroup) return message.reply({embed: rolemissing}); if (!staffGroup) return message.reply({embed: rolemissing});
const donothaverole = new Discord.RichEmbed() const donothaverole = new Discord.RichEmbed()
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.staff}**`) .setDescription(`:x: Sorry! You cannot use this command with the role **${supportbot.StaffRole}**`)
.setColor(bot.settings.colour) .setColor(supportbot.colour)
if (!message.member.roles.has(staffGroup.id)) return message.reply({embed: donothaverole}); if (!message.member.roles.has(staffGroup.id)) return message.reply({embed: donothaverole});
const outsideticket = new Discord.RichEmbed() const outsideticket = new Discord.RichEmbed()
.setDescription(`:x: Cannot use this command becase you are outside a ticket channel.`) .setDescription(`:x: Cannot use this command becase you are outside a ticket channel.`)
.setColor(bot.settings.colour) .setColor(supportbot.colour)
if (!message.channel.name.startsWith(`ticket-`)) return message.channel.send({embed: outsideticket}); if (!message.channel.name.startsWith(`${supportbot.Ticket_Channel_Name}-`)) return message.channel.send({embed: outsideticket});
const renameto = args.join(" ") const renameto = args.join(" ")
message.channel.setName(`ticket-${renameto}-${message.author.username}`) message.channel.setName(`${supportbot.Ticket_Channel_Name}-${renameto}`)
// Renamed Ticket Logistic // Renamed Ticket Logistic
const logEmbed = new Discord.RichEmbed() const logEmbed = new Discord.RichEmbed()
.setTitle(":ticket: Ticket Renamed") .setTitle(":ticket: Ticket Renamed")
.setDescription(`<@${message.author.id}> has renamed a ticket to ${renameto}`) .setDescription(`<@${message.author.id}> has renamed a ticket to ${supportbot.Ticket_Channel_Name}-${renameto}`)
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
.setFooter(bot.settings.footer) .setFooter(supportbot.EmbedFooter)
let logChannel = message.guild.channels.find(TicketChannel => TicketChannel.name === `${bot.settings.Ticket_Logs}`); let logChannel = message.guild.channels.find(TicketChannel => TicketChannel.name === `${supportbot.Ticket_Logs}`);
if(!logChannel) return message.channel.send(`:x: Error! Could not find the logs channel **${bot.settings.Ticket_Logs}**`); if(!logChannel) return message.channel.send(`:x: Error! Could not find the logs channel **${supportbot.Ticket_Logs}**`);
logChannel.send({embed: logEmbed}) logChannel.send({embed: logEmbed});
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Rename_Command}`) };
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Rename_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
exports.help = { exports.help = {
name: bot.settings.Rename_Command, name: supportbot.Rename_Command,
} }
+19 -29
View File
@@ -1,19 +1,24 @@
// SupportBot // SupportBot
// Created by © 2020 Emerald Services
// Command: Report // Command: Report
const Discord = require("discord.js"); 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) => { 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}`);
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === `${supportbot.StaffRole}`);
const rolemissing = new Discord.RichEmbed() const rolemissing = new Discord.RichEmbed()
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.staff}**`) .setDescription(`:x: Looks like this server doesn't have the role **${supportbot.StaffRole}**`)
.setColor(bot.settings.colour); .setColor(supportbot.EmbedColour);
if(!staffGroup) { if(!staffGroup) {
message.reply(rolemissing).catch(err => { message.reply(rolemissing).catch(err => {
@@ -21,8 +26,8 @@ exports.run = (bot, message, args) => {
}); });
} else { } else {
const donothaverole = new Discord.RichEmbed() const donothaverole = new Discord.RichEmbed()
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.staff}**`) .setDescription(`:x: Sorry! You cannot use this command with the role **${supportbot.StaffRole}**`)
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
if(!message.member.roles.has(staffGroup.id)) { if(!message.member.roles.has(staffGroup.id)) {
message.reply(donothaverole); message.reply(donothaverole);
} else { } else {
@@ -34,42 +39,27 @@ exports.run = (bot, message, args) => {
} else { } else {
let reportDesc = args.slice(1).join(" "); let reportDesc = args.slice(1).join(" ");
const embed = new Discord.RichEmbed() const embed = new Discord.RichEmbed()
.setTitle(`${bot.settings.Report_Title}`) .setTitle(`${supportbot.Report_Title}`)
.setThumbnail(message.author.avatarURL) .setThumbnail(message.author.avatarURL)
.addField("Report by:", `<@${message.author.id}>`, false) .addField("Report by:", `<@${message.author.id}>`, false)
.addField("Description:", `${reportDesc}`, false) .addField("Description:", `${reportDesc}`, false)
.addField("Reported User:", `${args[0]}`, false) .addField("Reported User:", `${args[0]}`, false)
.setTimestamp(new Date()) .setTimestamp(new Date())
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
.setFooter(`${message.author.username}#${message.author.discriminator}`, message.author.displayAvatarURL); .setFooter(`${message.author.username}#${message.author.discriminator}`, message.author.displayAvatarURL);
let rc = message.guild.channels.find(ReportChannel => ReportChannel.name === `${bot.settings.Report_Channel}`) let rc = message.guild.channels.find(ReportChannel => ReportChannel.name === `${supportbot.Report_Channel}`)
if(!rc) { if(!rc) {
message.channel.send(`:x: Error! Could not find the logs channel **${bot.settings.Report_Channel}**`); message.channel.send(`:x: Error! Could not find the logs channel **${supportbot.Report_Channel}**`);
} else { } else {
rc.send(embed); rc.send(embed);
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Report_Command}`);
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Report_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
} }
} }
} }
} }
} }
} };
exports.help = { exports.help = {
name: bot.settings.Report_Command name: supportbot.Report_Command
} }
+17 -27
View File
@@ -1,52 +1,42 @@
// SupportBot // SupportBot
// Created by © 2020 Emerald Services
// Command: Say // Command: Say
const Discord = require("discord.js"); 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) => { 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}`);
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === `${supportbot.StaffRole}`)
const rolemissing = new Discord.RichEmbed() const rolemissing = new Discord.RichEmbed()
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.staff}**`) .setDescription(`:x: Looks like this server doesn't have the role **${supportbot.StaffRole}**`)
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
if (!staffGroup) return message.reply(rolemissing).catch(err=>{console.error(err)}) if (!staffGroup) return message.reply(rolemissing).catch(err=>{console.error(err)})
const donothaverole = new Discord.RichEmbed() const donothaverole = new Discord.RichEmbed()
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.staff}**`) .setDescription(`:x: Sorry! You cannot use this command with the role **${supportbot.StaffRole}**`)
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
if (!message.member.roles.has(staffGroup.id)) return message.reply(donothaverole) if (!message.member.roles.has(staffGroup.id)) return message.reply(donothaverole)
const embed = new Discord.RichEmbed() const embed = new Discord.RichEmbed()
.setTitle(`${bot.settings.Announcement_Title}`) .setTitle(`${supportbot.Announcement_Title}`)
.setDescription(args.join(" ")) .setDescription(args.join(" "))
.setTimestamp() .setTimestamp()
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
.setFooter(`${message.author.username}#${message.author.discriminator}`, message.author.displayAvatarURL) .setFooter(`${message.author.username}#${message.author.discriminator}`, message.author.displayAvatarURL)
message.channel.send(embed); message.channel.send(embed);
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Say_Command}`) };
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Say_Command, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
exports.help = { exports.help = {
name: bot.settings.Say_Command, name: supportbot.Say_Command,
} }
-294
View File
@@ -1,294 +0,0 @@
const Discord = require("discord.js");
const bot = new Discord.Client()
bot.settings = require("../settings.json");
exports.run = async (bot, message, args) => {
if (message.guild.owner === message.member) {
message.delete(1000);
const embed = new Discord.RichEmbed()
.setTitle("SupportBot Setup Mode")
.setColor("#fff")
.setDescription(`${bot.settings.botname} is about to enter **Setup Mode**.\nThis means that all the roles & channels that are\nrequired to allow supportbot to work will be created.`)
.setFooter("Setup mode will expire in 60 seconds")
message.channel.send(embed).then((msg) => {
msg.react("✅");
const filter = (reaction, user) => reaction.emoji.name === "✅" && user.id === message.author.id;
msg.awaitReactions(filter, {
max: 1,
time: 60000,
errors: ["time"]
}).then(async (collected) => {
msg.clearReactions();
const embed1 = new Discord.RichEmbed()
.setTitle("SupportBot Setup Mode")
.setColor("#fff")
.setDescription(`${bot.settings.botname} has activated **Setup Mode**\nPlease allow a couple minutes for the process to be complete.`)
msg.edit(embed1).then((m) => {
m.delete(5000);
m.edit(":white_check_mark: **Success!** You\'r server is ready, thanks for using SupportBot by Emerald Services.");
});
const reaction = collected.first();
if (reaction.emoji.name === "✅") {
// Roles
let supportRole = bot.settings.support;
let staffRole = bot.settings.staff;
let autoRole = bot.settings.Auto_Role;
let Department_Role_1 = bot.settings.Department_Role_1
let Department_Role_2 = bot.settings.Department_Role_2
let Department_Role_3 = bot.settings.Department_Role_3
// Channels & Categories
let generalCategory = bot.settings.General_Category;
let informationCategory = bot.settings.InformationCategory;
let ticketCategory = bot.settings.category;
let staffCategory = bot.settings.StaffCategory;
let accessChannel = bot.settings.Access_Channel;
let announceChannel = bot.settings.Announcement_Channel;
let suggestChannel = bot.settings.Suggestion_Channel;
let reportsChannel = bot.settings.Report_Channel;
let ticketsChannel = bot.settings.Tickets_Channel;
let ticketsVoice1 = bot.settings.TicketsVoice1;
let ticketsVoice2 = bot.settings.TicketsVoice2;
let generalChannel = bot.settings.GeneralChannel;
let pollsChannel = bot.settings.Poll_Channel;
let botSpam = bot.settings.BotSpam_Channel;
let staffGeneral = bot.settings.StaffChat;
let staffCommands = bot.settings.StaffCmds;
let staffVoice = bot.settings.StaffVoice;
let ticketLogs = bot.settings.Ticket_Logs;
let commandLogs = bot.settings.Command_Log_Channel;
// Information Category
await message.guild.createChannel(`${informationCategory}`, {
type: "category",
position: 1
}).then(async (cat) => {
await message.guild.createChannel(`${accessChannel}`, {
type: "text",
position: 1,
topic: `${bot.settings.Access_Topic}`,
parent: cat
});
await message.guild.createChannel(`${announceChannel}`, {
type: "text",
position: 2,
topic: `${bot.settings.Announcement_Topic}`,
parent: cat
});
await message.guild.createChannel(`${pollsChannel}`, {
type: "text",
position: 3,
topic: `${bot.settings.Poll_Topic}`,
parent: cat
});
await message.guild.createChannel(`${suggestChannel}`, {
type: "text",
position: 4,
topic: `${bot.settings.Suggestion_Topic}`,
parent: cat
});
await message.guild.createChannel(`${reportsChannel}`, {
type: "text",
position: 5,
topic: `${bot.settings.Report_Topic}`,
parent: cat
});
});
// General Category
await message.guild.createChannel(`${generalCategory}`, {
type: "category",
position: 2
}).then(async (cat) => {
await message.guild.createChannel(`${generalChannel}`, {
type: "text",
position: 1,
topic: `${bot.settings.GeneralTopic}`,
parent: cat
});
await message.guild.createChannel(`${botSpam}`, {
type: "text",
position: 2,
topic: `${bot.settings.BotSpam_Topic}`,
parent: cat
});
});
// Support Category
await message.guild.createChannel(`${ticketCategory}`, {
type: "category",
position: 3
}).then(async (cat) => {
await message.guild.createChannel(`${ticketsChannel}`, {
type: "text",
position: 1,
topic: `${bot.settings.Tickets_Topic}`,
parent: cat
});
await message.guild.createChannel(`${ticketsVoice1}`, {
type: "voice",
position: 2,
parent: cat,
userLimit: 2,
speakable: true,
joineable: true
});
await message.guild.createChannel(`${ticketsVoice2}`, {
type: "voice",
position: 3,
parent: cat,
userLimit: 2,
speakable: true,
joineable: true
});
});
// Staff Category (Private)
await message.guild.createChannel(`${staffCategory}`, {
type: "category",
position: 4
}).then(async (cat) => {
await message.guild.createChannel(`${staffGeneral}`, {
type: "text",
position: 1,
parent: cat
});
await message.guild.createChannel(`${staffCommands}`, {
type: "text",
position: 2,
parent: cat
});
await message.guild.createChannel(`${staffVoice}`, {
type: "voice",
position: 3,
parent: cat,
joineable: true,
speakable: true
});
await message.guild.createChannel(`${ticketLogs}`, {
type: "text",
position: 4,
parent: cat
});
await message.guild.createChannel(`${commandLogs}`, {
type: "text",
position: 5,
parent: cat
});
await message.guild.createRole({
name: `${staffRole}`,
color: "#ff0000",
position: 1,
permissions: {
"MANAGE_CHANNELS": true,
"MANAGE_GUILD": true,
"MENTION_EVERYONE": true,
"CREATE_INSTANT_INVITE": true,
"KICK_MEMBERS": true,
"VIEW_AUDIT_LOG": true,
"MANAGE_NICKNAMES": true,
"CONNECT": true,
"SPEAK": true,
"USE_EXTERNAL_EMOJIS": true,
"MANAGE_MESSAGES": true,
"PRIORITY_SPEAKER": true
},
mentionable: true
});
await message.guild.createRole({
name: `${autoRole}`,
color: "#ffffff",
position: 2,
permissions: {
"MANAGE_CHANNELS": false,
"MANAGE_GUILD": false,
"MENTION_EVERYONE": false,
"CREATE_INSTANT_INVITE": true,
"KICK_MEMBERS": false,
"VIEW_AUDIT_LOG": false,
"MANAGE_NICKNAMES": false,
"CONNECT": true,
"SPEAK": true,
"USE_EXTERNAL_EMOJIS": true,
"MANAGE_MESSAGES": false,
"PRIORITY_SPEAKER": false
},
mentionable: false
});
await message.guild.createRole({
name: `${Department_Role_1}`,
color: "#ffffff",
position: 2,
permissions: {
"MANAGE_CHANNELS": false,
"MANAGE_GUILD": false,
"MENTION_EVERYONE": false,
"CREATE_INSTANT_INVITE": true,
"KICK_MEMBERS": true,
"VIEW_AUDIT_LOG": true,
"MANAGE_NICKNAMES": true,
"CONNECT": true,
"SPEAK": true,
"USE_EXTERNAL_EMOJIS": true,
"MANAGE_MESSAGES": true,
"PRIORITY_SPEAKER": true
},
mentionable: false
});
await message.guild.createRole({
name: `${Department_Role_2}`,
color: "#ffffff",
position: 2,
permissions: {
"MANAGE_CHANNELS": false,
"MANAGE_GUILD": false,
"MENTION_EVERYONE": false,
"CREATE_INSTANT_INVITE": true,
"KICK_MEMBERS": true,
"VIEW_AUDIT_LOG": true,
"MANAGE_NICKNAMES": true,
"CONNECT": true,
"SPEAK": true,
"USE_EXTERNAL_EMOJIS": true,
"MANAGE_MESSAGES": true,
"PRIORITY_SPEAKER": true
},
mentionable: false
});
await message.guild.createRole({
name: `${Department_Role_3}`,
color: "#ffffff",
position: 2,
permissions: {
"MANAGE_CHANNELS": false,
"MANAGE_GUILD": false,
"MENTION_EVERYONE": false,
"CREATE_INSTANT_INVITE": true,
"KICK_MEMBERS": true,
"VIEW_AUDIT_LOG": true,
"MANAGE_NICKNAMES": true,
"CONNECT": true,
"SPEAK": true,
"USE_EXTERNAL_EMOJIS": true,
"MANAGE_MESSAGES": true,
"PRIORITY_SPEAKER": true
},
mentionable: false
});
});
} else {
return;
}
});
});
} else {
message.channel.send(":x: **Error:** You don't have permissions to use this command.").then((msg) => {
msg.delete(5000);
});
}
}
exports.help = {
name: bot.settings.Setup_Command
}
+19 -30
View File
@@ -1,53 +1,42 @@
// SupportBot // SupportBot
// Command: Suggest // Created by © 2020 Emerald Services
// Command: Say
const Discord = require("discord.js"); 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) => { exports.run = async(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.Suggest_Command}`);
const SuggestionEmbed = new Discord.RichEmbed() const SuggestionEmbed = new Discord.RichEmbed()
.setTitle(`${bot.settings.Suggestion_Title}`) .setTitle(`${supportbot.Suggestion_Title}`)
.setDescription(`\`\`\`${args.join(" ")}\`\`\`\nFrom <@${message.author.id}>`) .setDescription(`\`\`\`${args.join(" ")}\`\`\`\nFrom <@${message.author.id}>`)
.setFooter(`${bot.settings.footer}`, message.author.avatarURL) .setFooter(`${supportbot.EmbedFooter}`, message.author.avatarURL)
.setTimestamp(new Date()) .setTimestamp(new Date())
.setColor(bot.settings.colour); .setColor(supportbot.EmbedColour)
let sc = message.guild.channels.find(SuggestionChannel => SuggestionChannel.name === `${bot.settings.Suggestion_Channel}`); let sc = message.guild.channels.find(SuggestionChannel => SuggestionChannel.name === `${supportbot.Suggestion_Channel}`);
if(!sc) return message.channel.send(`:x: Error! Could not find the suggestion channel **${bot.settings.Suggestion_Channel}**`); if(!sc) return message.channel.send(`:x: Error! Could not find the suggestion channel **${supportbot.Suggestion_Channel}**`);
sc.send(SuggestionEmbed) sc.send(SuggestionEmbed)
.then(async function(msg) { .then(async function(msg) {
msg.react(bot.settings.suggestyes).then(() => msg.react(bot.settings.suggestno)); msg.react(supportbot.suggestyes).then(() => msg.react(supportbot.suggestno));
}); });
const SuggestionSuccessEmbed = new Discord.RichEmbed() const SuggestionSuccessEmbed = new Discord.RichEmbed()
.setDescription(`:white_check_mark: You have successfully created your suggestion. <#${sc.id}>`) .setDescription(`👍 Suggestion has been successfully created\nYou can view your suggestion in <#${sc.id}>`)
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
message.channel.send(SuggestionSuccessEmbed); message.channel.send(SuggestionSuccessEmbed);
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Suggest_Command}`) };
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Suggest_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**`);
CommandLog.send(CMDLog);
}
exports.help = { exports.help = {
name: bot.settings.Suggest_Command, name: supportbot.Suggest_Command,
} }
+56 -92
View File
@@ -1,58 +1,43 @@
// SupportBot // SupportBot
// Command: Ticket // Created by © 2020 Emerald Services
// Command: Say
const Discord = require("discord.js"); 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) => { const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
message.delete(); const TicketNumberID = require('../utility/TicketNumber');
const ID = Math.floor(Math.random() * 10) + 2000; exports.run = async (bot, message, args) => {
const subject = args.join(" ") || `${bot.settings.Default_Ticket_Reason}`;
// Ticket Reactions 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}`);
const reactembed = new Discord.RichEmbed()
.setColor(bot.settings.colour)
.setDescription(`${bot.settings.Ticket_React_Message}`);
message.channel.send(reactembed)
.then(function(msg) {
msg.react('✅').then(() => msg.react('❎')); // Ticket Number ID Settings
let ticketNumberID = TicketNumberID.pad(message.guild.id);
const filter = (reaction, user) => { // Ticket Subject Settings
return ['✅', '❎'].includes(reaction.emoji.name) && user.id !== msg.author.id; const subject = args.join(" ") || `${supportbot.Default_Ticket_Reason}`;
};
msg.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] }) // Ticket Limitiations
.then(collected => { const alreadyopen = new Discord.RichEmbed()
const reaction = collected.first(); .setDescription(`:x: Cannot create a ticket because **${supportbot.Ticket_Channel_Name}-${ticketNumberID}** already exists.`)
.setColor(supportbot.EmbedColour)
if (reaction.emoji.name === '❎') { // Ticket Creation
if (message.guild.channels.find(TicketChannel => TicketChannel.name === `${supportbot.Ticket_Channel_Name}-` + message.author.username)) return message.channel.send(alreadyopen);
const successEmbed = new Discord.RichEmbed() message.guild.createChannel(`${supportbot.Ticket_Channel_Name}-${ticketNumberID}`, {
.setDescription(`:tickets: <@${message.author.id}> You have canceled your support request.`) type: 'text',
.setColor(bot.settings.colour); }).then(TicketChannel => {
message.channel.send(successEmbed);
}
if (reaction.emoji.name === '✅') {
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}`, {
type: 'text',
}).then(TicketChannel => {
// Roles // Roles
let staff = message.guild.roles.find(supportRole => supportRole.name === `${bot.settings.staff}`) let staff = message.guild.roles.find(supportRole => supportRole.name === `${supportbot.StaffRole}`)
let everyone = message.guild.roles.find(everyoneRole => everyoneRole.name === "@everyone") let everyone = message.guild.roles.find(everyoneRole => everyoneRole.name === "@everyone")
let department = message.guild.roles.find(DepartmentRole => DepartmentRole.name === `${bot.settings.Department_Role_1}`) let department = message.guild.roles.find(DepartmentRole => DepartmentRole.name === `${supportbot.Department_Role_1}`)
let department2 = message.guild.roles.find(DepartmentRole => DepartmentRole.name === `${bot.settings.Department_Role_2}`) let department2 = message.guild.roles.find(DepartmentRole => DepartmentRole.name === `${supportbot.Department_Role_2}`)
let department3 = message.guild.roles.find(DepartmentRole => DepartmentRole.name === `${bot.settings.Department_Role_3}`) let department3 = message.guild.roles.find(DepartmentRole => DepartmentRole.name === `${supportbot.Department_Role_3}`)
// Permissions // Permissions
TicketChannel.overwritePermissions(everyone, { SEND_MESSAGES: false, READ_MESSAGES: false }) TicketChannel.overwritePermissions(everyone, { SEND_MESSAGES: false, READ_MESSAGES: false })
@@ -60,43 +45,44 @@ exports.run = (bot, message, args) => {
TicketChannel.overwritePermissions(department2, { SEND_MESSAGES: false, READ_MESSAGES: false }) TicketChannel.overwritePermissions(department2, { SEND_MESSAGES: false, READ_MESSAGES: false })
TicketChannel.overwritePermissions(department3, { SEND_MESSAGES: false, READ_MESSAGES: false }) TicketChannel.overwritePermissions(department3, { SEND_MESSAGES: false, READ_MESSAGES: false })
TicketChannel.overwritePermissions(staff, { SEND_MESSAGES: true, READ_MESSAGES: true }) TicketChannel.overwritePermissions(staff, { SEND_MESSAGES: true, READ_MESSAGES: true })
TicketChannel.overwritePermissions(message.author, { SEND_MESSAGES: true, READ_MESSAGES: true }) TicketChannel.overwritePermissions(message.author, { SEND_MESSAGES: false, READ_MESSAGES: true })
TicketChannel.overwritePermissions(bot.user, { SEND_MESSAGES: true, READ_MESSAGES: true }) TicketChannel.overwritePermissions(bot.user, { SEND_MESSAGES: true, READ_MESSAGES: true })
// Category // Category
let category = message.guild.channels.find(c => c.name === bot.settings.category); let category = message.guild.channels.find(c => c.name === supportbot.category);
if (category) { if (category) {
TicketChannel.setParent(category.id); TicketChannel.setParent(category.id);
} else { } else {
if (message.guild.channels.get(bot.settings.category)) { if (message.guild.channels.get(supportbot.category)) {
TicketChannel.setParent(message.guild.channels.get(bot.settings.category).id); TicketChannel.setParent(message.guild.channels.get(supportbot.category).id);
} }
} }
const ticketopened = new Discord.RichEmbed() const ticketopened = new Discord.RichEmbed()
.setDescription(`:white_check_mark: <@${message.author.id}> You ticket has been created <#${TicketChannel.id}>`) .setTitle(":white_check_mark: Support Ticket Created")
.setColor(bot.settings.colour) .setDescription(`<@${message.author.id}> your support ticket created successfully`)
.addField("Your Ticket:", `<#${TicketChannel.id}>`)
.setColor(supportbot.Ticket_Colour)
message.channel.send({embed: ticketopened}); message.channel.send({embed: ticketopened});
// Ticket Message - ( Able to edit this message via the settings.json file ) // 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 Department_1 = bot.settings.Ticket_Department_1; const Department_1 = supportbot.Ticket_Department_1;
const Department_2 = bot.settings.Ticket_Department_2; const Department_2 = supportbot.Ticket_Department_2;
const Department_3 = bot.settings.Ticket_Department_3; const Department_3 = supportbot.Ticket_Department_3;
const Emoji_1 = bot.settings.Ticket_Department_Emoji_1; const Emoji_1 = supportbot.Ticket_Department_Emoji_1;
const Emoji_2 = bot.settings.Ticket_Department_Emoji_2; const Emoji_2 = supportbot.Ticket_Department_Emoji_2;
const Emoji_3 = bot.settings.Ticket_Department_Emoji_3; const Emoji_3 = supportbot.Ticket_Department_Emoji_3;
const TicketMessage = new Discord.RichEmbed() const TicketMessage = new Discord.RichEmbed()
.setDescription(ticketMessage, true) .setDescription(ticketMessage, true)
.addField("Available Departments", `${Emoji_1} ${Department_1}\n${Emoji_2} ${Department_2}\n${Emoji_3} ${Department_3}`) .addField("Available Departments", `${Emoji_1} ${Department_1}\n${Emoji_2} ${Department_2}\n${Emoji_3} ${Department_3}`)
.setColor(bot.settings.colour) .setColor(supportbot.Ticket_Colour)
.setFooter(bot.settings.footer) .setFooter(supportbot.EmbedFooter)
if (subject != 'No Subject.') { if (subject != 'No Subject.') {
TicketChannel.setTopic(subject); TicketMessage.addField("Reason", subject);
} }
@@ -116,21 +102,21 @@ exports.run = (bot, message, args) => {
TicketChannel.overwritePermissions(staff, { SEND_MESSAGES: true, READ_MESSAGES: true }) TicketChannel.overwritePermissions(staff, { SEND_MESSAGES: true, READ_MESSAGES: true })
TicketChannel.overwritePermissions(department, { SEND_MESSAGES: true, READ_MESSAGES: true }) TicketChannel.overwritePermissions(department, { SEND_MESSAGES: true, READ_MESSAGES: true })
msg.channel.send("You have contacted out " + department + "\nPlease wait patiently for somone to reach out to you.") msg.channel.send("You have contacted out " + department + "\nPlease wait patiently for someone to reach out to you.")
} }
if (reaction.emoji.name === `${Emoji_2}`) { if (reaction.emoji.name === `${Emoji_2}`) {
TicketChannel.overwritePermissions(staff, { SEND_MESSAGES: true, READ_MESSAGES: true }) TicketChannel.overwritePermissions(staff, { SEND_MESSAGES: true, READ_MESSAGES: true })
TicketChannel.overwritePermissions(department2, { SEND_MESSAGES: true, READ_MESSAGES: true }) TicketChannel.overwritePermissions(department2, { SEND_MESSAGES: true, READ_MESSAGES: true })
msg.channel.send("You have contacted out " + department2 + "\nPlease wait patiently for somone to reach out to you.") msg.channel.send("You have contacted out " + department2 + "\nPlease wait patiently for someone to reach out to you.")
} }
if (reaction.emoji.name === `${Emoji_3}`) { if (reaction.emoji.name === `${Emoji_3}`) {
TicketChannel.overwritePermissions(staff, { SEND_MESSAGES: true, READ_MESSAGES: true }) TicketChannel.overwritePermissions(staff, { SEND_MESSAGES: true, READ_MESSAGES: true })
TicketChannel.overwritePermissions(department3, { SEND_MESSAGES: true, READ_MESSAGES: true }) TicketChannel.overwritePermissions(department3, { SEND_MESSAGES: true, READ_MESSAGES: true })
msg.channel.send("You have contacted out " + department3 + "\nPlease wait patiently for somone to reach out to you.") msg.channel.send("You have contacted out " + department3 + "\nPlease wait patiently for someone to reach out to you.")
} }
}); });
@@ -140,47 +126,25 @@ exports.run = (bot, message, args) => {
// Ticket Logging // Ticket Logging
const logEmbed = new Discord.RichEmbed() const logEmbed = new Discord.RichEmbed()
.setTitle(":ticket: Logistics of your Ticket") .setTitle(":ticket: Logistics of your Ticket")
.addField("Ticket ID", ID, true) .addField("Ticket ID", ticketNumberID, true)
.addField("User", `<@${message.author.id}>`, true) .addField("User", `<@${message.author.id}>`, true)
.addField("Channel", `ticket#${ID}`, true) .addField("Channel", `ticket#${ticketNumberID}`, true)
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
.setFooter(bot.settings.footer) .setFooter(supportbot.EmbedFooter)
if (subject != 'No Subject.') { if (subject != 'No Subject.') {
logEmbed.addField('Subject', subject, true); logEmbed.addField('Subject', subject, true);
} }
let logChannel = message.guild.channels.find(TicketChannel => TicketChannel.name === `${bot.settings.Ticket_Logs}`); let logChannel = message.guild.channels.find(TicketChannel => TicketChannel.name === `${supportbot.Ticket_Logs}`);
if(!logChannel) return message.channel.send(`:x: Error! Could not find the logs channel **${bot.settings.Ticket_Logs}**`); if(!logChannel) return message.channel.send(`:x: Error! Could not find the logs channel **${supportbot.Ticket_Logs}**`);
logChannel.send({embed: logEmbed}) logChannel.send({embed: logEmbed})
}).catch(err=>{console.error(err)}); }).catch(err=>{console.error(err)});
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Ticket_Command}`) };
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Ticket_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
})
})
};
exports.help = { exports.help = {
name: bot.settings.Ticket_Command, name: supportbot.Ticket_Command,
} };
+20 -30
View File
@@ -1,52 +1,42 @@
// SupportBot // SupportBot
// Command: Lockchat // Created by © 2020 Emerald Services
// Command: Say
const Discord = require("discord.js"); 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) => { exports.run = async(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.UnLockchat_Command}`);
let lockedRole = message.guild.roles.find(lc => lc.name === `${bot.settings.locked_role}`)
let staffGroup = message.guild.roles.find(staffRole => staffRole.name === `${supportbot.StaffRole}`)
let lockedRole = message.guild.roles.find(lc => lc.name === `${supportbot.locked_role}`)
const rolemissing = new Discord.RichEmbed() const rolemissing = new Discord.RichEmbed()
.setDescription(`:x: Looks like this server doesn't have the role **${bot.settings.staff}**`) .setDescription(`:x: Looks like this server doesn't have the role **${supportbot.StaffRole}**`)
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
if (!staffGroup) return message.reply(rolemissing).catch(err=>{console.error(err)}) if (!staffGroup) return message.reply(rolemissing).catch(err=>{console.error(err)})
const donothaverole = new Discord.RichEmbed() const donothaverole = new Discord.RichEmbed()
.setDescription(`:x: Sorry! You cannot use this command with the role **${bot.settings.staff}**`) .setDescription(`:x: Sorry! You cannot use this command with the role **${supportbot.StaffRole}**`)
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
if (!message.member.roles.has(staffGroup.id)) return message.reply(donothaverole) if (!message.member.roles.has(staffGroup.id)) return message.reply(donothaverole)
message.channel.overwritePermissions(lockedRole, { 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 }); message.channel.overwritePermissions(staffGroup, { READ_MESSAGES: true, SEND_MESSAGES: true });
const lockmsg = new Discord.RichEmbed() const lockmsg = new Discord.RichEmbed()
.setDescription(":white_check_mark: **Chat Un-Locked**") .setDescription(":white_check_mark: **Chat Un-Locked**")
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour);
message.channel.send(lockmsg) message.channel.send(lockmsg);
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.UnLockchat_Command}`) };
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.UnLockchat_Command, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**\nThis can be changed via ``settings.json```);
CommandLog.send(CMDLog);
}
exports.help = { exports.help = {
name: bot.settings.UnLockchat_Command, name: supportbot.UnLockchat_Command,
} }
+15
View File
@@ -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}
+46 -45
View File
@@ -4,27 +4,28 @@
// ___) | |_| | |_) | |_) | (_) | | | |_| |_) | (_) | |_ // ___) | |_| | |_) | |_) | (_) | | | |_| |_) | (_) | |_
// |____/ \__,_| .__/| .__/ \___/|_| \__|____/ \___/ \__| // |____/ \__,_| .__/| .__/ \___/|_| \__|____/ \___/ \__|
// |_| |_| // |_| |_|
// © 2020 Created by Emerald Services
// Resource: SupportBot // Licnese: MIT
// Developed by Emerald Services // SupportBot v5.1.1
// Version: 4.2.0
const Discord = require("discord.js"); const Discord = require("discord.js");
const fs = require("fs"); const fs = require("fs");
const bot = new Discord.Client(); const bot = new Discord.Client();
bot.commands = new Discord.Collection(); 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) => { fs.readdir("./commands/", (err, files) => {
if(err) console.log(err); if(err) console.log(err);
let jsfile = files.filter(f => f.split(".").pop() === "js") 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) =>{ jsfile.forEach((f, i) =>{
let props = require(`./commands/${f}`); 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); bot.commands.set(props.help.name, props);
}); });
@@ -36,66 +37,66 @@ fs.readdir("./sb-addons/", (err, files) => {
if(err) console.log(err); if(err) console.log(err);
let jsfile = files.filter(f => f.split(".").pop() === "js") 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://itzemerald.tk/`);
jsfile.forEach((f, i) =>{ jsfile.forEach((f, i) =>{
let props = require(`./sb-addons/${f}`); 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.addons.set(props.help.name, props);
}); });
}); });
bot.on("ready", async () => { bot.on("ready", async () => {
bot.user.setActivity(bot.settings.BotStatus, {type:"PLAYING"}); bot.user.setActivity(supportbot.BotActivity, {type: supportbot.ActvityType});
console.log(`\u001b[31m`, `------------[ SupportBot ]------------`) console.log(`\u001b[32m`, `―――――――――――――――――― SupportBot ――――――――――――――――――`)
console.log(`\u001b[32m`, `Thank you for using SupportBot\n If you have any issues\n contact our team and we will\n give you furthur instructions\nContact us on discord if you require any support discord.gg/SPKDBX9`) console.log(`\u001b[37m`, `Emerald Services has successfully connected to discord`)
console.log(`\u001b[31m`, `------------[ SupportBot ]------------`) 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[31m`, `\n\n------------[ SupportBot Stats ]------------`) console.log(`\u001b[32m`, `―――――――――――――――――― SupportBot ――――――――――――――――――`)
console.log(`\u001b[32m`, `Bot Username: ${bot.user.username}\nInvite Link: https://discordapp.com/api/oauth2/authorize?client_id=${bot.user.username}&permissions=8&scope=bot`)
console.log(`\u001b[31m`, `------------[ SupportBot Stats ]------------`)
}); });
bot.on("message", async message => { bot.on("message", async message => {
if(message.author.bot) return; if(message.author.bot) return;
if(message.channel.type === "dm") return; if(message.channel.type === "dm") return;
if (message.content.indexOf(bot.settings.prefix) !== 0) return; if (message.content.indexOf(supportbot.Prefix) !== 0) return;
let messageArray = message.content.split(" "); let messageArray = message.content.split(" ");
const args = message.content.slice(bot.settings.prefix.length).trim().split(/ +/g); const args = message.content.slice(supportbot.Prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase(); const command = args.shift().toLowerCase();
const cmd = bot.commands.get(command); const cmd = bot.commands.get(command);
if(!cmd) return; if(!cmd) return;
cmd.run(bot, message, args); cmd.run(bot, message, args);
message.delete();
}); });
bot.on("message", async message => { bot.on("message", async message => {
if(message.author.bot) return; if(message.author.bot) return;
if(message.channel.type === "dm") return; if(message.channel.type === "dm") return;
if (message.content.indexOf(bot.settings.prefix) !== 0) return; if (message.content.indexOf(supportbot.Prefix) !== 0) return;
let messageArray = message.content.split(" "); let messageArray = message.content.split(" ");
const args = message.content.slice(bot.settings.prefix.length).trim().split(/ +/g); const args = message.content.slice(supportbot.Prefix.length).trim().split(/ +/g);
const addon = args.shift().toLowerCase(); const addon = args.shift().toLowerCase();
const cmd = bot.addons.get(addon); const cmd = bot.addons.get(addon);
if(!cmd) return; if(!cmd) return;
cmd.run(bot, message, args); cmd.run(bot, message, args);
message.delete();
}); });
// [SupportBot] Welcome Message && Auto Join Role // [SupportBot] Welcome Message && Auto Join Role
bot.on("guildMemberAdd", (member) => { bot.on("guildMemberAdd", (member) => {
let channel = member.guild.channels.find(channel => channel.name === `${bot.settings.Welcome_Channel}`) let channel = member.guild.channels.find(channel => channel.name === `${supportbot.WelcomeChannel}`)
let autorole = member.guild.roles.find(autorole => autorole.name === `${bot.settings.Auto_Role}`) let autorole = member.guild.roles.find(autorole => autorole.name === `${supportbot.AutoRole}`)
const WelcomeMsg= new Discord.RichEmbed() const WelcomeMsg= new Discord.RichEmbed()
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
.setThumbnail(member.user.avatarURL) .setThumbnail(member.user.avatarURL)
.setDescription(`:wave: ${member.user.username}\n${bot.settings.Welcome_Message}`) .setDescription(`:wave: ${member.user.username}\n${supportbot.WelcomeMessage}`)
channel.send(WelcomeMsg); channel.send(WelcomeMsg);
member.addRole(autorole).catch(console.error); member.addRole(autorole).catch(console.error);
@@ -105,15 +106,15 @@ bot.on("guildMemberAdd", (member) => {
// [SupportBot] Leave Message // [SupportBot] Leave Message
bot.on("guildMemberRemove", (member) => { 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() const LeaveMsg= new Discord.RichEmbed()
.setColor(bot.settings.colour) .setColor(supportbot.EmbedColour)
.setThumbnail(member.user.avatarURL) .setThumbnail(member.user.avatarURL)
.setDescription(`:wave: ${member.user.username}\n${bot.settings.Leave_Message}`) .setDescription(`:wave: ${member.user.username}\n${supportbot.LeaveMessage}`)
channel.send(LeaveMsg); channel.send(LeaveMsg);
}); });
bot.login(bot.settings.token); bot.login(supportbot.Token);
-5
View File
@@ -1,5 +0,0 @@
{
"name": "SupportBot",
"version": "4.0",
"lockfileVersion": 1
}
+8 -30
View File
@@ -1,37 +1,15 @@
{ {
"name": "SupportBot", "name": "supportbot",
"version": "4.0", "version": "5.1.0",
"description": "SupportBot", "description": "a discord dbot that can you help with your servers support",
"main": "index.js", "main": "index.js",
"private": "true",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "-help"
"start": "node index.js"
},
"engines": {
"node": "12.6.0",
"npm": "6.9.0"
}, },
"author": "Emerald SRV",
"license": "MIT",
"dependencies": { "dependencies": {
"array-sort": "^1.0.0",
"discord.js": "^11.5.1", "discord.js": "^11.5.1",
"table": "^5.4.4" "js-yaml": "^3.13.1"
}, }
"repository": {
"type": "git",
"url": "https://github.com/EmeraldRusher/SupportBot.git"
},
"keywords": [
"SupportBot",
"Emerald Services"
],
"author": "Emerald Services",
"bugs": {
"url": "https://github.com/EmeraldRusher/SupportBot/issues"
},
"homepage": "https://discord.gg/hmWgxdF",
"contributors": [
"iJosGCS",
"RedstoneGamez"
]
} }
+3 -2
View File
@@ -3,8 +3,9 @@
const Discord = require("discord.js"); const Discord = require("discord.js");
const bot = new Discord.Client() 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) => { exports.run = async(bot, message, args) => {
message.delete(); message.delete();
@@ -14,5 +15,5 @@ exports.run = async(bot, message, args) => {
} }
exports.help = { exports.help = {
name: 'addon', name: someaddon.settings.Addon_Example_Command,
} }
+5
View File
@@ -0,0 +1,5 @@
{
"Addon_Example_Command": "addonexample"
}
-101
View File
@@ -1,101 +0,0 @@
{
"SupportBot": "v4.2.0",
"token": "BOT_TOKEN_HERE",
"prefix": "dev-",
"botname": "SupportBot",
"colour": "#13bd2a",
"footer": "Support Bot, By Emerald Services",
"BotStatus": "Support Bot",
"staff": "Staff",
"locked_role": "@everyone",
"everyone": "@everyone",
"Auto_Role": "Member",
"Department_Role_1": "Support",
"Department_Role_2": "Security",
"Department_Role_3": "Sales",
"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",
"Default_Ticket_Reason": "No Subject",
"Ticket_React_Message": ":mailbox: React to create your support ticket.",
"Ticket_Department_1": "Support",
"Ticket_Department_2": "Security",
"Ticket_Department_3": "Sales",
"Ticket_Department_Emoji_1": "🎧",
"Ticket_Department_Emoji_2": "🔐",
"Ticket_Department_Emoji_3": "💵",
"General_Category": "General",
"InformationCategory": "Information",
"StaffCategory": "Staff",
"Access_Channel": "welcome",
"GeneralChannel": "general",
"BotSpam_Channel": "bot-spam",
"Tickets_Channel": "open-a-ticket",
"StaffChat": "staff-chat",
"StaffCmds": "staff-commands",
"StaffVoice": "Staff Room",
"TicketsVoice1": "Support Lounge",
"TicketsVoice2": "Support Lounge",
"Commands_Log_Title": "SupportBot Logs",
"Command_Log_Channel": "command-logs",
"Announcement_Title": "SupportBot Announcement",
"Announcement_Channel": "announcements",
"Announcement_Tag_Role": "@everyone",
"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",
"LINKS_TITLE": "SupportBot Links",
"LINKS": {
"Discord": "https://discord.gg/",
"Twitter": "https://twitter.com/",
"Website": "https://example.com/",
"AddMore": "AddMoreIfYouWant"
},
"Announcement_Command": "announce",
"Say_Command": "say",
"Suggest_Command": "suggest",
"Ping_Command": "ping",
"Ticket_Command": "ticket",
"Remove_Command": "remove",
"Add_Command": "add",
"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",
"Setup_Command": "setup"
}
+1
View File
@@ -0,0 +1 @@
{}
+115
View File
@@ -0,0 +1,115 @@
# _________ __ __________ __
# / _____/__ ________ ______ ____________/ |\______ \ _____/ |_
# \_____ \| | \____ \\____ \ / _ \_ __ \ __\ | _// _ \ __\
# / \ | / |_> > |_> > <_> ) | \/| | | | ( <_> ) |
# /_______ /____/| __/| __/ \____/|__| |__| |______ /\____/|__|
# \/ |__| |__| \/
#
# SupportBot v5.1.1
# Created by © 2020 Emerald Services
# License: MIT
#Bot Indentification
Token: "Bot_Token_Here"
Prefix: "!"
Bot_Name: "SupportBot"
BotActivity: "SupportBot v5.1"
ActivityType: "PLAYING"
EmbedColour: "#4bbf5c"
EmbedFooter: "SupportBot | The #1 Supportive Discord Bot"
# Role Settings
AutoRole: "Member"
StaffRole: "Support"
locked_role: "@everyone"
everyone: "@everyone"
Department_Role_1: "Support"
Department_Role_2: "Security"
Department_Role_3: "Sales"
# Welcome & Leave
WelcomeChannel: "welcome"
WelcomeMessage: "Welcome to the server!"
LeaveChannel: "welcome"
LeaveMessage: "Thank you for visiting us!"
# Ticket Settings
category: "Tickets"
Ticket_Colour: "#000e42"
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"
# Ticket Department Settings
Ticket_Department_1: "Support"
Ticket_Department_2: "Security"
Ticket_Department_3: "Sales"
Ticket_Department_Emoji_1: "🎧"
Ticket_Department_Emoji_2: "🔐"
Ticket_Department_Emoji_3: "💵"
# 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"
-1
View File
@@ -1 +0,0 @@
node index.js
-1
View File
@@ -1 +0,0 @@
node index.js
+72
View File
@@ -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;