Add funny gif after sending !rank
Also added dotenv for easier local development and added .env to gitignore
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
/node_modules
|
/node_modules
|
||||||
|
.env
|
||||||
62
index.js
62
index.js
@@ -1,39 +1,40 @@
|
|||||||
const Discord = require('discord.js');
|
require("dotenv").config();
|
||||||
const config = require('./config.json');
|
const Discord = require("discord.js");
|
||||||
const fs = require('fs');
|
const config = require("./config.json");
|
||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
const client = new Discord.Client();
|
const client = new Discord.Client();
|
||||||
client.commands = new Discord.Collection();
|
client.commands = new Discord.Collection();
|
||||||
|
|
||||||
const commandFiles = fs
|
const commandFiles = fs
|
||||||
.readdirSync('./commands')
|
.readdirSync("./commands")
|
||||||
.filter((file) => file.endsWith('.js'));
|
.filter((file) => file.endsWith(".js"));
|
||||||
|
|
||||||
for (const file of commandFiles) {
|
for (const file of commandFiles) {
|
||||||
const command = require(`./commands/${file}`);
|
const command = require(`./commands/${file}`);
|
||||||
client.commands.set(command.name, command);
|
client.commands.set(command.name, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
client.once('ready', () => {
|
client.once("ready", () => {
|
||||||
console.log(
|
console.log(
|
||||||
'-------------------------------------\nTHE BOT IS READY TO GO.\n-------------------------------------'
|
"-------------------------------------\nTHE BOT IS READY TO GO.\n-------------------------------------"
|
||||||
);
|
);
|
||||||
client.user.setActivity('.ping', { type: 'LISTENING' });
|
client.user.setActivity(".ping", { type: "LISTENING" });
|
||||||
});
|
});
|
||||||
|
|
||||||
client.on('message', (message) => {
|
client.on("message", (message) => {
|
||||||
/* OMITTING THE COMMAND HANDLER TO CATCH ANY AND ALL MESSAGES IN THE '#rolki' CHANNEL
|
/* OMITTING THE COMMAND HANDLER TO CATCH ANY AND ALL MESSAGES IN THE '#rolki' CHANNEL
|
||||||
MAKING 'tf2' A VIABLE COMMAND WITHOUT A PREFIX */
|
MAKING 'tf2' A VIABLE COMMAND WITHOUT A PREFIX */
|
||||||
// command handler is downward from this if statement
|
|
||||||
if (message.channel.name == 'rolki') {
|
if (message.channel.name == "rolki") {
|
||||||
if (message.author.bot) return;
|
if (message.author.bot) return;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
message.content == 'tf2' ||
|
message.content == "tf2" ||
|
||||||
message.content == 'liga' ||
|
message.content == "liga" ||
|
||||||
message.content == 'csgo' ||
|
message.content == "csgo" ||
|
||||||
message.content == 'minecraft' ||
|
message.content == "minecraft" ||
|
||||||
message.content == 'rainbow-six'
|
message.content == "rainbow-six"
|
||||||
) {
|
) {
|
||||||
const role = message.member.guild.roles.cache.find(
|
const role = message.member.guild.roles.cache.find(
|
||||||
(role) => role.name == message.content
|
(role) => role.name == message.content
|
||||||
@@ -51,8 +52,8 @@ client.on('message', (message) => {
|
|||||||
`Odebrano Ci rangę ${message.content}, ${message.author.username}.`
|
`Odebrano Ci rangę ${message.content}, ${message.author.username}.`
|
||||||
)
|
)
|
||||||
.setColor(config.embedColor)
|
.setColor(config.embedColor)
|
||||||
.attachFiles('./gractwo.png')
|
.attachFiles("./gractwo.png")
|
||||||
.setFooter('#rolki', 'attachment://gractwo.png')
|
.setFooter("#rolki", "attachment://gractwo.png")
|
||||||
.setTimestamp();
|
.setTimestamp();
|
||||||
message.channel
|
message.channel
|
||||||
.send(removeRolesEmbed)
|
.send(removeRolesEmbed)
|
||||||
@@ -69,8 +70,8 @@ client.on('message', (message) => {
|
|||||||
`Przyznano Ci rangę ${message.content}, ${message.author.username}.`
|
`Przyznano Ci rangę ${message.content}, ${message.author.username}.`
|
||||||
)
|
)
|
||||||
.setColor(config.embedColor)
|
.setColor(config.embedColor)
|
||||||
.attachFiles('./gractwo.png')
|
.attachFiles("./gractwo.png")
|
||||||
.setFooter('#rolki', 'attachment://gractwo.png')
|
.setFooter("#rolki", "attachment://gractwo.png")
|
||||||
.setTimestamp();
|
.setTimestamp();
|
||||||
message.channel
|
message.channel
|
||||||
.send(addRolesEmbed)
|
.send(addRolesEmbed)
|
||||||
@@ -79,7 +80,7 @@ client.on('message', (message) => {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (
|
if (
|
||||||
!message.member.roles.cache.find((role) => role.name == 'Moderatorzy')
|
!message.member.roles.cache.find((role) => role.name == "Moderatorzy")
|
||||||
) {
|
) {
|
||||||
console.log(
|
console.log(
|
||||||
`${message.author.username} spammed the rolki channel with a bad message`
|
`${message.author.username} spammed the rolki channel with a bad message`
|
||||||
@@ -88,8 +89,8 @@ client.on('message', (message) => {
|
|||||||
const rolkiWrongMessageEmbed = new Discord.MessageEmbed()
|
const rolkiWrongMessageEmbed = new Discord.MessageEmbed()
|
||||||
.setTitle(`To nie jest kanał na pisanie, ${message.author.username}`)
|
.setTitle(`To nie jest kanał na pisanie, ${message.author.username}`)
|
||||||
.setColor(config.embedColorFail)
|
.setColor(config.embedColorFail)
|
||||||
.attachFiles('./gractwo.png')
|
.attachFiles("./gractwo.png")
|
||||||
.setFooter('#rolki', 'attachment://gractwo.png')
|
.setFooter("#rolki", "attachment://gractwo.png")
|
||||||
.setTimestamp();
|
.setTimestamp();
|
||||||
message.channel
|
message.channel
|
||||||
.send(rolkiWrongMessageEmbed)
|
.send(rolkiWrongMessageEmbed)
|
||||||
@@ -100,6 +101,15 @@ client.on('message', (message) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (message.content.toLowerCase() === "!rank")
|
||||||
|
message.channel.send({
|
||||||
|
files: [
|
||||||
|
"https://cdn.discordapp.com/attachments/281070649374670849/871103257580281876/tenor.gif",
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
// command handler is downward from comment
|
||||||
|
|
||||||
if (!message.content.startsWith(config.prefix) || message.author.bot) return;
|
if (!message.content.startsWith(config.prefix) || message.author.bot) return;
|
||||||
|
|
||||||
const args = message.content.slice(config.prefix.length).trim().split(/ +/);
|
const args = message.content.slice(config.prefix.length).trim().split(/ +/);
|
||||||
@@ -108,7 +118,7 @@ client.on('message', (message) => {
|
|||||||
if (!client.commands.has(commandName)) return;
|
if (!client.commands.has(commandName)) return;
|
||||||
const command = client.commands.get(commandName);
|
const command = client.commands.get(commandName);
|
||||||
|
|
||||||
if (command.guildOnly && message.channel.type === 'dm') {
|
if (command.guildOnly && message.channel.type === "dm") {
|
||||||
return message.reply("I can't execute that command inside DMs!");
|
return message.reply("I can't execute that command inside DMs!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,14 +132,14 @@ client.on('message', (message) => {
|
|||||||
command.execute(message, args, Discord, config, client);
|
command.execute(message, args, Discord, config, client);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
message.reply('there was an error trying to execute that command.');
|
message.reply("there was an error trying to execute that command.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
client.login(process.env.BOT_TOKEN).then(() => getStatus());
|
client.login(process.env.BOT_TOKEN).then(() => getStatus());
|
||||||
|
|
||||||
// Funne API hehehehe
|
// Funne API hehehehe
|
||||||
const http = require('http');
|
const http = require("http");
|
||||||
const port = process.env.PORT || 3000;
|
const port = process.env.PORT || 3000;
|
||||||
|
|
||||||
let status;
|
let status;
|
||||||
|
|||||||
1389
package-lock.json
generated
1389
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -23,6 +23,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/opus": "^0.5.0",
|
"@discordjs/opus": "^0.5.0",
|
||||||
"discord.js": "^12.5.1",
|
"discord.js": "^12.5.1",
|
||||||
|
"dotenv": "^10.0.0",
|
||||||
"ffmpeg-static": "^4.3.0",
|
"ffmpeg-static": "^4.3.0",
|
||||||
"request": "2.81.0",
|
"request": "2.81.0",
|
||||||
"ytdl-core": "^4.5.0"
|
"ytdl-core": "^4.5.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user