dockerization
This commit is contained in:
23
.github/deploy.yaml
vendored
Normal file
23
.github/deploy.yaml
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
name: Deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["master"]
|
||||||
|
pull_request:
|
||||||
|
branches: ["master"]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: self-hosted
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Build image
|
||||||
|
run: docker build -t ${{ github.repository }} .
|
||||||
|
- name: Deploy image
|
||||||
|
run: |
|
||||||
|
docker stop muzykant || true
|
||||||
|
docker rm muzykant || true
|
||||||
|
docker stop muzykant2 || true
|
||||||
|
docker rm muzykant2 || true
|
||||||
|
docker run -d -e "DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN_1 }}" -e "PREFIX=";" --restart always --name muzykant ${{ github.repository }}
|
||||||
|
docker run -d -e "DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN_2 }}" -e "PREFIX=":" --restart always --name muzykant2 ${{ github.repository }}
|
||||||
6
Dockerfile
Normal file
6
Dockerfile
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
FROM node:16.10.0
|
||||||
|
WORKDIR /app
|
||||||
|
COPY ./ ./
|
||||||
|
RUN npm install
|
||||||
|
CMD ["node", "index.js"]
|
||||||
@@ -1,30 +1,45 @@
|
|||||||
module.exports = (client, message) => {
|
module.exports = (client, message) => {
|
||||||
if (message.author.bot || message.channel.type === 'dm') return;
|
if (message.author.bot || message.channel.type === "dm") return;
|
||||||
|
|
||||||
const prefix = client.config.app.px;
|
const prefix = process.env.PREFIX;
|
||||||
|
|
||||||
if (message.content.indexOf(prefix) !== 0) return;
|
if (message.content.indexOf(prefix) !== 0) return;
|
||||||
|
|
||||||
const args = message.content.slice(prefix.length).trim().split(/ +/g);
|
const args = message.content.slice(prefix.length).trim().split(/ +/g);
|
||||||
const command = args.shift().toLowerCase();
|
const command = args.shift().toLowerCase();
|
||||||
|
|
||||||
const cmd = client.commands.get(command) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(command));
|
const cmd =
|
||||||
|
client.commands.get(command) ||
|
||||||
|
client.commands.find((cmd) => cmd.aliases && cmd.aliases.includes(command));
|
||||||
|
|
||||||
const DJ = client.config.opt.DJ;
|
const DJ = client.config.opt.DJ;
|
||||||
|
|
||||||
if (cmd && DJ.enabled && DJ.commands.includes(cmd.name)) {
|
if (cmd && DJ.enabled && DJ.commands.includes(cmd.name)) {
|
||||||
const roleDJ = message.guild.roles.cache.find(x => x.name === DJ.roleName);
|
const roleDJ = message.guild.roles.cache.find(
|
||||||
|
(x) => x.name === DJ.roleName
|
||||||
|
);
|
||||||
|
|
||||||
if (!message.member._roles.includes(roleDJ.id)) {
|
if (!message.member._roles.includes(roleDJ.id)) {
|
||||||
return message.channel.send(`This command is reserved for members with the ${DJ.roleName} role on the server ${message.author}... try again ? ❌`);
|
return message.channel.send(
|
||||||
}
|
`This command is reserved for members with the ${DJ.roleName} role on the server ${message.author}... try again ? ❌`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (cmd && cmd.voiceChannel) {
|
if (cmd && cmd.voiceChannel) {
|
||||||
if (!message.member.voice.channel) return message.channel.send(`You're not in a voice channel ${message.author}... try again ? ❌`);
|
if (!message.member.voice.channel)
|
||||||
|
return message.channel.send(
|
||||||
|
`You're not in a voice channel ${message.author}... try again ? ❌`
|
||||||
|
);
|
||||||
|
|
||||||
if (message.guild.me.voice.channel && message.member.voice.channel.id !== message.guild.me.voice.channel.id) return message.channel.send(`You are not in the same voice channel ${message.author}... try again ? ❌`);
|
if (
|
||||||
}
|
message.guild.me.voice.channel &&
|
||||||
|
message.member.voice.channel.id !== message.guild.me.voice.channel.id
|
||||||
|
)
|
||||||
|
return message.channel.send(
|
||||||
|
`You are not in the same voice channel ${message.author}... try again ? ❌`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (cmd) cmd.execute(client, message, args);
|
if (cmd) cmd.execute(client, message, args);
|
||||||
};
|
};
|
||||||
|
|||||||
26
main.js
26
main.js
@@ -1,21 +1,21 @@
|
|||||||
const { Player } = require('discord-player');
|
const { Player } = require("discord-player");
|
||||||
const { Client, Intents } = require('discord.js');
|
const { Client, Intents } = require("discord.js");
|
||||||
|
|
||||||
global.client = new Client({
|
global.client = new Client({
|
||||||
intents: [
|
intents: [
|
||||||
Intents.FLAGS.GUILDS,
|
Intents.FLAGS.GUILDS,
|
||||||
Intents.FLAGS.GUILD_MEMBERS,
|
Intents.FLAGS.GUILD_MEMBERS,
|
||||||
Intents.FLAGS.GUILD_MESSAGES,
|
Intents.FLAGS.GUILD_MESSAGES,
|
||||||
Intents.FLAGS.GUILD_VOICE_STATES
|
Intents.FLAGS.GUILD_VOICE_STATES,
|
||||||
],
|
],
|
||||||
disableMentions: 'everyone',
|
disableMentions: "everyone",
|
||||||
});
|
});
|
||||||
|
|
||||||
client.config = require('./config');
|
client.config = require("./config");
|
||||||
|
|
||||||
global.player = new Player(client, client.config.opt.discordPlayer);
|
global.player = new Player(client, client.config.opt.discordPlayer);
|
||||||
|
|
||||||
require('./src/loader');
|
require("./src/loader");
|
||||||
require('./src/events');
|
require("./src/events");
|
||||||
|
|
||||||
client.login(client.config.app.token);
|
client.login(process.env.DISCORD_TOKEN);
|
||||||
|
|||||||
Reference in New Issue
Block a user