Skip to content

Commit

Permalink
feat(server): add server experss for vercel (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
osiic authored Sep 24, 2023
1 parent f09602e commit bb79130
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 7 deletions.
10 changes: 5 additions & 5 deletions events/interactionCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ module.exports = {
}
} else if (interaction.isButton()) {
// respond to the button

try {
await interaction.deferReply({ ephemeral: true });

switch (interaction.customId) {
case "open-ticket":
try {
| let channel = await interaction.guild.channels.create({
let channel = await interaction.guild.channels.create({
name: `t-${interaction.user.username}`,
type: ChannelType.GuildText,
permissionOverwrites: [
Expand All @@ -83,7 +83,6 @@ module.exports = {
},
],
});

const ticketEmbed = new EmbedBuilder()
.setColor(0x0099ff)
.setTitle("Open Ticket")
Expand Down Expand Up @@ -128,8 +127,9 @@ module.exports = {
console.error(`Error executing ${interaction.customId}`);
console.error(error);
}
} else if (interaction.isStringSelectMenu()) {
// respond to the select menu
}
// else if (interaction.isStringSelectMenu()) {
// // respond to the select menu
// }
},
};
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require("dotenv").config();
require("./lib/express.js");

const { DISCORD_TOKEN, APPLICATION_ID, GUILD_ID } = process.env;
const fs = require("node:fs");
Expand Down
14 changes: 14 additions & 0 deletions lib/express.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//ExpressJS
const express = require("express");
const app = express();
const port = 3000;

//<========== Start Expressjs ==========>
app.get("/", (req, res) => {
res.send("Bot in ready");
});

app.listen(port, () =>
console.log(`Example app listening on port http://127.0.0.1:${port}/`),
);
//<========== End Expressjs ==========>
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Discord Bot Ticket Advance yang cocok untuk server store",
"main": "index.js",
"scripts": {
"test": "node .",
"start": "node .",
"dev": "nodemon ."
},
"keywords": [],
Expand All @@ -13,7 +13,8 @@
"dependencies": {
"@prisma/client": "5.3.1",
"discord.js": "^14.13.0",
"dotenv": "^16.3.1"
"dotenv": "^16.3.1",
"express": "^4.18.2"
},
"devDependencies": {
"eslint": "^8.48.0",
Expand Down
14 changes: 14 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"builds": [
{
"src": "./index.js",
"use": "@vercel/node"
}
],
"routes": [
{
"src": "/(.*)",
"dest": "/"
}
]
}

0 comments on commit bb79130

Please sign in to comment.