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
|
||||
.env
|
||||
62
index.js
62
index.js
@@ -1,39 +1,40 @@
|
||||
const Discord = require('discord.js');
|
||||
const config = require('./config.json');
|
||||
const fs = require('fs');
|
||||
require("dotenv").config();
|
||||
const Discord = require("discord.js");
|
||||
const config = require("./config.json");
|
||||
const fs = require("fs");
|
||||
|
||||
const client = new Discord.Client();
|
||||
client.commands = new Discord.Collection();
|
||||
|
||||
const commandFiles = fs
|
||||
.readdirSync('./commands')
|
||||
.filter((file) => file.endsWith('.js'));
|
||||
.readdirSync("./commands")
|
||||
.filter((file) => file.endsWith(".js"));
|
||||
|
||||
for (const file of commandFiles) {
|
||||
const command = require(`./commands/${file}`);
|
||||
client.commands.set(command.name, command);
|
||||
}
|
||||
|
||||
client.once('ready', () => {
|
||||
client.once("ready", () => {
|
||||
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
|
||||
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.content == 'tf2' ||
|
||||
message.content == 'liga' ||
|
||||
message.content == 'csgo' ||
|
||||
message.content == 'minecraft' ||
|
||||
message.content == 'rainbow-six'
|
||||
message.content == "tf2" ||
|
||||
message.content == "liga" ||
|
||||
message.content == "csgo" ||
|
||||
message.content == "minecraft" ||
|
||||
message.content == "rainbow-six"
|
||||
) {
|
||||
const role = message.member.guild.roles.cache.find(
|
||||
(role) => role.name == message.content
|
||||
@@ -51,8 +52,8 @@ client.on('message', (message) => {
|
||||
`Odebrano Ci rangę ${message.content}, ${message.author.username}.`
|
||||
)
|
||||
.setColor(config.embedColor)
|
||||
.attachFiles('./gractwo.png')
|
||||
.setFooter('#rolki', 'attachment://gractwo.png')
|
||||
.attachFiles("./gractwo.png")
|
||||
.setFooter("#rolki", "attachment://gractwo.png")
|
||||
.setTimestamp();
|
||||
message.channel
|
||||
.send(removeRolesEmbed)
|
||||
@@ -69,8 +70,8 @@ client.on('message', (message) => {
|
||||
`Przyznano Ci rangę ${message.content}, ${message.author.username}.`
|
||||
)
|
||||
.setColor(config.embedColor)
|
||||
.attachFiles('./gractwo.png')
|
||||
.setFooter('#rolki', 'attachment://gractwo.png')
|
||||
.attachFiles("./gractwo.png")
|
||||
.setFooter("#rolki", "attachment://gractwo.png")
|
||||
.setTimestamp();
|
||||
message.channel
|
||||
.send(addRolesEmbed)
|
||||
@@ -79,7 +80,7 @@ client.on('message', (message) => {
|
||||
}
|
||||
} else {
|
||||
if (
|
||||
!message.member.roles.cache.find((role) => role.name == 'Moderatorzy')
|
||||
!message.member.roles.cache.find((role) => role.name == "Moderatorzy")
|
||||
) {
|
||||
console.log(
|
||||
`${message.author.username} spammed the rolki channel with a bad message`
|
||||
@@ -88,8 +89,8 @@ client.on('message', (message) => {
|
||||
const rolkiWrongMessageEmbed = new Discord.MessageEmbed()
|
||||
.setTitle(`To nie jest kanał na pisanie, ${message.author.username}`)
|
||||
.setColor(config.embedColorFail)
|
||||
.attachFiles('./gractwo.png')
|
||||
.setFooter('#rolki', 'attachment://gractwo.png')
|
||||
.attachFiles("./gractwo.png")
|
||||
.setFooter("#rolki", "attachment://gractwo.png")
|
||||
.setTimestamp();
|
||||
message.channel
|
||||
.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;
|
||||
|
||||
const args = message.content.slice(config.prefix.length).trim().split(/ +/);
|
||||
@@ -108,7 +118,7 @@ client.on('message', (message) => {
|
||||
if (!client.commands.has(commandName)) return;
|
||||
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!");
|
||||
}
|
||||
|
||||
@@ -122,14 +132,14 @@ client.on('message', (message) => {
|
||||
command.execute(message, args, Discord, config, client);
|
||||
} catch (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());
|
||||
|
||||
// Funne API hehehehe
|
||||
const http = require('http');
|
||||
const http = require("http");
|
||||
const port = process.env.PORT || 3000;
|
||||
|
||||
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": {
|
||||
"@discordjs/opus": "^0.5.0",
|
||||
"discord.js": "^12.5.1",
|
||||
"dotenv": "^10.0.0",
|
||||
"ffmpeg-static": "^4.3.0",
|
||||
"request": "2.81.0",
|
||||
"ytdl-core": "^4.5.0"
|
||||
|
||||
Reference in New Issue
Block a user