Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Sayrix/ticket-bot
Browse files Browse the repository at this point in the history
  • Loading branch information
Sayrix committed Apr 16, 2023
2 parents e957039 + fa332cd commit d0f8636
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 19 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Ticket Bot is a open source project of an ticket discord bot using [discord.js](

## 📄 Documentation

The documentation is available [here](https://ticket-bot.pages.dev/)
The documentation is available [here](https://doc.ticket.pm/)

## 💬 Discord

Expand All @@ -30,4 +30,4 @@ You can see all perks here: https://github.com/sponsors/Sayrix


## License
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FSayrix%2FTicket-Bot.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FSayrix%2FTicket-Bot?ref=badge_large)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FSayrix%2FTicket-Bot.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FSayrix%2FTicket-Bot?ref=badge_large)
2 changes: 1 addition & 1 deletion config/config.example.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"user": "mysql", // The user of the MySQL database
"password": "password", // The password of the MySQL database
"database": "ticketbot", // The name of the MySQL database
"table": "json", // The name of the table where the tickets will be saved
"table": "json" // The name of the table where the tickets will be saved
},

"closeTicketCategoryId": "", // The id of the category where a closed ticket will be moved to. Leave blank to disable this feature
Expand Down
26 changes: 14 additions & 12 deletions events/ready.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-process-exit */
/* eslint-disable no-unused-vars */
const readline = require("readline");
const axios = require("axios");
Expand Down Expand Up @@ -26,7 +27,7 @@ module.exports = {
async execute(client) {
if (!client.config.guildId) {
console.log("⚠️⚠️⚠️ Please add the guild id in the config.jsonc file. ⚠️⚠️⚠️");
throw 0;
process.exit(0);
}

await client.guilds.fetch(client.config.guildId);
Expand All @@ -39,27 +40,28 @@ module.exports = {
console.log(
"\n⚠️⚠️⚠️ I don't have the Administrator permission, to prevent any issues please add the Administrator permission to me. ⚠️⚠️⚠️"
);
throw 0;
}
process.exit(0);
};

async function sendEmbedToOpen() {
const embedMessageId = await client.db.get("temp.openTicketMessageId");
await client.channels
.fetch(client.config.openTicketChannelId)
.catch((e) =>
console.error("The channel to open tickets is not found!\n", e)
);
.catch(() => {
console.error("The channel to open tickets is not found!");
process.exit(0);
});
const openTicketChannel = await client.channels.cache.get(
client.config.openTicketChannelId
);
if (!openTicketChannel) {
console.error("The channel to open tickets is not found!");
throw 0;
process.exit(0);
}

if (!openTicketChannel.isTextBased()) {
console.error("The channel to open tickets is not a channel!");
throw 0;
process.exit(0);
}

let embed = client.embeds.openTicket;
Expand Down Expand Up @@ -169,21 +171,21 @@ module.exports = {

client.on("connectFailed", (e) => {
setTimeout(connect, 10000);
// console.log(`❌ WebSocket Error: ${e.toString()}`);
console.log(`❌ WebSocket Error: ${e.toString()}`);
});

client.on("connect", (connection) => {
connection.on("error", (e) => {
setTimeout(connect, 10000);
// console.log(`❌ WebSocket Error: ${e.toString()}`);
console.log(`❌ WebSocket Error: ${e.toString()}`);
});

connection.on("close", (e) => {
setTimeout(connect, 10000);
// console.log(`❌ WebSocket Error: ${e.toString()}`);
console.log(`❌ WebSocket Error: ${e.toString()}`);
});

// console.log("✅ Connected to WebSocket server.");
console.log("✅ Connected to WebSocket server.");

setInterval(() => {
connection.sendUTF("heartbeat");
Expand Down
70 changes: 70 additions & 0 deletions locales/cs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"embeds": {
"openTicket": {
"title": "Otevřít ticket",
"description": "Kliknutím na tlačítko otevřete ticket",
"footer": {
"text": "is.gd/ticketbot"
}
},
"ticketOpened": {
"title": "Ticket CATEGORYNAME",
"description": "Náš tým vám brzy odpoví!",
"footer": {
"text": "is.gd/ticketbot"
}
},
"ticketClosed": {
"title": "Ticket byl uzavřen",
"description": "Ticket uzavřel CLOSERNAME z důvodu: `REASON`"
},
"ticketClosedDM": {
"title": "Ticket byl uzavřen",
"description": "Ticket n°TICKETCOUNT byl uzavřen. Uzavřel ho CLOSERNAME z důvodu: `REASON`\n\nZde máš přepis ticketu: TRANSCRIPTURL",
"footer": {
"text": "is.gd/ticketbot"
}
}
},
"modals": {
"reasonTicketOpen": {
"title": "Otevřít ticket",
"label": "Zadej důvod k otevření ticketu",
"placeholder": "Prosím zadej důvod k otevření ticketu"
},
"reasonTicketClose": {
"title": "Zavřít ticket",
"label": "Zadej důvod k zavření ticketu",
"placeholder": "Prosím zadej důvod k zavření ticketu"
}
},
"buttons": {
"close": {
"label": "Zavřít ticket",
"emoji": "🔒"
},
"claim": {
"label": "Vzít",
"emoji": "🙋"
}
},
"ticketOpenedMessage": "Ticket byl otevřen! TICKETCHANNEL",
"ticketOnlyClaimableByStaff": "Pouze admin půže vzít ticket",
"ticketAlreadyClaimed": "Ticket už je sebrán jiným adminem!",
"ticketClaimedMessage": "> Ticket vzal USER",
"ticketOnlyClosableByStaff": "Pouze admin může zavřít ticket!",
"ticketAlreadyClosed": "Ticket už je uzavřen!",
"ticketCreatingTranscript": "> Vytvářím přepis...",
"ticketTranscriptCreated": "> Přepis byl vytvořen! TRANSCRIPTURL",
"ticketLimitReached": "Můžeš mít pouze TICKETLIMIT otevřených ticketu!",

"other": {
"openTicketButtonMSG": "Otevřít ticket",
"deleteTicketButtonMSG": "Smazat ticket",
"selectTicketTypePlaceholder": "Vyber typ ticketu",
"claimedBy": "**Tento ticket vzal**: USER",
"noReasonGiven": "Důvod nebyl udán!",
"unavailable": "Nedostupné"
}
}

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ticket-bot",
"version": "2.1.0",
"version": "2.1.2",
"description": "Bot with a ticket system using Discord.js v14",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -32,13 +32,13 @@
"fs-extra": "^11.1.1",
"jsonc": "^2.0.0",
"mysql2": "^3.2.0",
"quick.db": "^9.0.10",
"quick.db": "^9.1.3",
"readline": "^1.3.0",
"ticket-bot-transcript-uploader": "^1.2.0",
"ticket-bot-transcript-uploader": "^1.3.0",
"websocket": "^1.0.34"
},
"devDependencies": {
"eslint": "^8.36.0",
"eslint": "^8.37.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
Expand Down

0 comments on commit d0f8636

Please sign in to comment.