delete and start over for canary branch
This commit is contained in:
@@ -1,93 +0,0 @@
|
|||||||
const { Message } = require('discord.js');
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
name: 'admin',
|
|
||||||
description: 'Ukryte rzeczy dla adminów. Tajne sprawy.',
|
|
||||||
args: false,
|
|
||||||
guildOnly: true,
|
|
||||||
execute(msg, args, Discord, config, client) {
|
|
||||||
if (msg.member.roles.cache.find((role) => role.name == 'moderacja')) {
|
|
||||||
msg.delete();
|
|
||||||
switch (args[0]) {
|
|
||||||
case 'witaj': {
|
|
||||||
const witajEmbed = new Discord.MessageEmbed()
|
|
||||||
.setTitle('Witajcie w Gractwie!')
|
|
||||||
.setDescription(
|
|
||||||
'Jesteśmy grupą ludzi, których kręcą gry. Proste, nie?\nSerwer ten miał wcześniej tematykę Team Fortressową.'
|
|
||||||
)
|
|
||||||
.setColor(config.embedColor)
|
|
||||||
.addField(
|
|
||||||
'Zasady',
|
|
||||||
'Zasady serwera są spisane na kanale `#regulamin`. Pamiętajcie, by tam zajrzeć.'
|
|
||||||
)
|
|
||||||
.addField('Gractwo WWW', '`gractwo.pl`')
|
|
||||||
.addField(
|
|
||||||
'Gractwo DISCORD',
|
|
||||||
'`gractwo.pl/discord` lub `gractwo.pl/dc` lub `discord.gg/NBXq95C`'
|
|
||||||
)
|
|
||||||
.addField(
|
|
||||||
'Gractwo FACEBOOK',
|
|
||||||
'`gractwo.pl/facebook` lub `gractwo.pl/fb` lub `facebook.com/groups/gractwo`'
|
|
||||||
)
|
|
||||||
.attachFiles('./gractwo.png')
|
|
||||||
.setFooter('#witaj', 'attachment://gractwo.png')
|
|
||||||
.setTimestamp();
|
|
||||||
msg.channel.send(witajEmbed);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'rolki': {
|
|
||||||
const rolkiEmbed = new Discord.MessageEmbed()
|
|
||||||
.setTitle('Nadawanie Ról')
|
|
||||||
.setDescription(
|
|
||||||
'#rolki jest kanałem do przyznawania sobie ról.\nDostępne role: `tf2`, `liga`, `csgo`, `minecraft`, `rainbow-six`, `apex`, `genshin`.\n\nRole te służą do pingowania na poszczególnych kanałach, by zebrać ludzi chętnych do gry bądź zainteresowanych pewnym wydarzeniem.\n\nBy przydzielić sobie rolę, po prostu wpisz ją na czacie! Jest on czyszczony zaraz po. Aby pozbyć się roli, wystarczy wpisać jej nazwę jeszcze raz.'
|
|
||||||
)
|
|
||||||
.setColor(config.embedColor)
|
|
||||||
.attachFiles('./gractwo.png')
|
|
||||||
.setFooter('#rolki', 'attachment://gractwo.png')
|
|
||||||
.setTimestamp();
|
|
||||||
msg.channel.send(rolkiEmbed);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'botannouncement': {
|
|
||||||
const botAnnouncementEmbed = new Discord.MessageEmbed()
|
|
||||||
.setTitle('Hej,')
|
|
||||||
.setDescription(
|
|
||||||
'W ciągu ostatnich trzech dni zostałem stworzony ja - bot Gractwa.'
|
|
||||||
)
|
|
||||||
.setColor(config.embedColor)
|
|
||||||
.addField(
|
|
||||||
'Moja funkcja',
|
|
||||||
'Zastąpiłem wiadomości na kanałach `#witaj` i `#regulamin`, serwisuję również `#rolki`.'
|
|
||||||
)
|
|
||||||
.addField(
|
|
||||||
'Zmiany',
|
|
||||||
`Wraz z moim przybyciem zostało uproszczone nasze logo, w regulaminie czekają na Was dwie nowe zasady (niezbyt restrykcyjne ;3), forma serwera została uproszczona.`
|
|
||||||
)
|
|
||||||
.addField(
|
|
||||||
'Rolki? Co?',
|
|
||||||
`Rolki To!\n\nMogą one być wykorzystywane do zbierania osób do grania/rozmów. Było to coś o co poproszono naszą administrację już dawno temu. Dziś jest to już dla Was dostępne!`
|
|
||||||
)
|
|
||||||
.attachFiles('./gractwo.png')
|
|
||||||
.setFooter(`by j4mesen`, 'attachment://gractwo.png')
|
|
||||||
.setTimestamp();
|
|
||||||
msg.channel.send(botAnnouncementEmbed);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'riposta': {
|
|
||||||
msg.channel.send('mama twoja');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'everyone': {
|
|
||||||
msg.channel.send(`@everyone`);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
msg.reply('nie sprecyzowałeś!');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
msg.reply('chyba nie masz na to wystarczających permisji.');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
name: 'ping',
|
|
||||||
description: 'Pokazuje ping.',
|
|
||||||
args: false,
|
|
||||||
guildOnly: false,
|
|
||||||
execute(msg, args, Discord, config, client) {
|
|
||||||
msg.delete()
|
|
||||||
.catch(console.error);
|
|
||||||
const pingEmbed = new Discord.MessageEmbed()
|
|
||||||
.setTitle('Pong!')
|
|
||||||
.setColor(config.embedColor)
|
|
||||||
.setDescription(`Ping API wynosi ${client.ws.ping}`)
|
|
||||||
.attachFiles('./gractwo.png')
|
|
||||||
.setFooter(`Komenda wywołana przez ${msg.author.username}`, 'attachment://gractwo.png')
|
|
||||||
.setTimestamp();
|
|
||||||
msg.channel.send(pingEmbed);
|
|
||||||
console.log(`Responded to ping request by ${msg.author.username}`);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
name: 'regulamin',
|
|
||||||
description: 'Wyświetla regulamin / pojedyńcze zasady.',
|
|
||||||
args: false,
|
|
||||||
guildOnly: true,
|
|
||||||
execute(msg, args, Discord, config){
|
|
||||||
arg0 = args[0];
|
|
||||||
msg.delete()
|
|
||||||
.catch(console.error);
|
|
||||||
regulaminEmbedTitleArray = [
|
|
||||||
'Regulamin','§1 Szacunek','§2 Spam / Trolling',
|
|
||||||
'§3 Shitposting','§4 Poprawne Kanały','§5 Memy i Gify',
|
|
||||||
'§6 Reklamy','§7 Przestrzeganie Regulaminu','§8 Obcowanie z botem',
|
|
||||||
'§9 Warunki Użytkowania Discord (ToS)'
|
|
||||||
];
|
|
||||||
regulaminEmbedContentArray = [
|
|
||||||
'Regulamin naszego serwera prezentuje się następująco:',
|
|
||||||
'Na naszym serwerze obowiązuje szacunek do innych osób podczas niesatyrycznej dyskusji.',
|
|
||||||
'Jeżeli będziesz bezużytecznie spamować lub nieprzyjmenie się zachowywać zostaniesz zbanowany.',
|
|
||||||
'Kanał #shitposting jest najbardziej wyluzowanym kanałem na naszym serwerze. Nie oznacza to jednak, że nie jest monitorowany. Jeżeli czujesz, że rzecz którą chcesz tam umieścić jest nadzwyczajnie kontrowersyjna, zastanów się dwa razy przed wciśnięciem Enter.',
|
|
||||||
'Rozmowy na dany temat powinny toczyć się w kanałach do tego przeznaczonych.',
|
|
||||||
'Memy i Gify nie są zbyt przyjemne dla oka bez kontekstu. Najlepiej jest nie postować ich, jeżeli nie pasują do prowadzonej aktualnie dyskusji.',
|
|
||||||
'Zakaz reklam bez zezwolenia moderatora lub administratora. Pozwolenia na reklamę muszą być wydane przed jej zamieszczeniem.',
|
|
||||||
'Przestrzeganie regulaminu jest obowiązkowe, a to że go ktoś nie przeczytał nic nie zmienia.',
|
|
||||||
'Próby intencjonalnego łamania bota nie są mile widziane, tak jak nadużywanie go w celach spamu kanałów.',
|
|
||||||
'Nasz serwer, jak każdy inny, musi przestrzegać zasad zapisanych w warunkach użytkowania Discorda. Przypominamy o nich, bo choć nie są zbyt restrykcyjne, nie pozwalają na kilka określonych rzeczy.'
|
|
||||||
];
|
|
||||||
|
|
||||||
const num = parseInt(args[0]);
|
|
||||||
|
|
||||||
if(num > 0 && num < regulaminEmbedTitleArray.length){
|
|
||||||
const calyRegulaminEmbed = new Discord.MessageEmbed()
|
|
||||||
.setTitle(regulaminEmbedTitleArray[num])
|
|
||||||
.setDescription(regulaminEmbedContentArray[num])
|
|
||||||
.setColor(config.embedColor)
|
|
||||||
.attachFiles('./gractwo.png')
|
|
||||||
.setFooter(`Komenda wywołana przez ${msg.author.username}`, 'attachment://gractwo.png')
|
|
||||||
.setTimestamp();
|
|
||||||
msg.channel.send(calyRegulaminEmbed);
|
|
||||||
console.log(`Responded to request for a specific rule by ${msg.author.username}`);
|
|
||||||
}else{
|
|
||||||
const calyRegulaminEmbed = new Discord.MessageEmbed()
|
|
||||||
.setTitle(regulaminEmbedTitleArray[0])
|
|
||||||
.setDescription(regulaminEmbedContentArray[0])
|
|
||||||
.setColor(config.embedColor)
|
|
||||||
.attachFiles('./gractwo.png')
|
|
||||||
.setTimestamp();
|
|
||||||
for(i = 1; i < regulaminEmbedTitleArray.length; i++){
|
|
||||||
calyRegulaminEmbed
|
|
||||||
.addField(regulaminEmbedTitleArray[i],regulaminEmbedContentArray[i]);
|
|
||||||
}
|
|
||||||
if(args[0] == 'admin' && msg.member.roles.cache.find(role => role.name == 'Moderatorzy')){
|
|
||||||
calyRegulaminEmbed
|
|
||||||
.setFooter(`Ostatnio zaktualizowany`, 'attachment://gractwo.png');
|
|
||||||
}else{
|
|
||||||
calyRegulaminEmbed
|
|
||||||
.setFooter(`Komenda wywołana przez ${msg.author.username}`, 'attachment://gractwo.png')
|
|
||||||
}
|
|
||||||
msg.channel.send(calyRegulaminEmbed);
|
|
||||||
console.log(`Responded to request for the whole ruleset by ${msg.author.username}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
const fs = require('fs');
|
|
||||||
module.exports = {
|
|
||||||
name: 'urusai',
|
|
||||||
description: 'Mówi jemenikowi żeby zamknął dupę (na vc).',
|
|
||||||
args: false,
|
|
||||||
guildOnly: true,
|
|
||||||
async execute(msg, args, Discord, config, client) {
|
|
||||||
if (msg.member.voice.channel) {
|
|
||||||
const connection = await msg.member.voice.channel.join();
|
|
||||||
msg.delete()
|
|
||||||
.catch(console.error);
|
|
||||||
const jzdEmbed = new Discord.MessageEmbed()
|
|
||||||
.setTitle('Chotto matte! >w<')
|
|
||||||
.setColor(config.embedColor)
|
|
||||||
.setDescription(`Mówienie jemenikowi żeby zamknął dupę...`)
|
|
||||||
.attachFiles('./gractwo.png')
|
|
||||||
.setFooter(`Komenda wywołana przez ${msg.author.username}`, 'attachment://gractwo.png')
|
|
||||||
.setTimestamp();
|
|
||||||
msg.channel.send(jzdEmbed);
|
|
||||||
const dispatcher = connection.play(fs.createReadStream('./commands/urusai.mp3'));
|
|
||||||
dispatcher.on('speaking', speaking => {
|
|
||||||
if (speaking === 0) { msg.member.voice.channel.leave() }
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
msg.reply(`Najpierw musiałbyś być na kanale głosowym...`);
|
|
||||||
}
|
|
||||||
console.log(`Responded to urusai request by ${msg.author.username}`);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
Binary file not shown.
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"prefix": ".",
|
|
||||||
"embedColor":"61f2ea",
|
|
||||||
"embedColorFail":"0xfb636b"
|
|
||||||
}
|
|
||||||
187
index.js
187
index.js
@@ -1,187 +0,0 @@
|
|||||||
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'));
|
|
||||||
|
|
||||||
for (const file of commandFiles) {
|
|
||||||
const command = require(`./commands/${file}`);
|
|
||||||
client.commands.set(command.name, command);
|
|
||||||
}
|
|
||||||
|
|
||||||
client.once('ready', () => {
|
|
||||||
console.log(
|
|
||||||
'-------------------------------------\nTHE BOT IS READY TO GO.\n-------------------------------------'
|
|
||||||
);
|
|
||||||
client.user.setActivity('.ping', { type: 'LISTENING' });
|
|
||||||
});
|
|
||||||
|
|
||||||
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 */
|
|
||||||
|
|
||||||
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 == 'apex' ||
|
|
||||||
message.content == 'genshin'
|
|
||||||
) {
|
|
||||||
const role = message.member.guild.roles.cache.find(
|
|
||||||
(role) => role.name == message.content
|
|
||||||
);
|
|
||||||
if (
|
|
||||||
message.member.roles.cache.find((role) => role.name == message.content)
|
|
||||||
) {
|
|
||||||
message.member.roles.remove(role);
|
|
||||||
message.delete();
|
|
||||||
console.log(
|
|
||||||
`removed ${message.author.username}'s ${message.content} role.`
|
|
||||||
);
|
|
||||||
const removeRolesEmbed = new Discord.MessageEmbed()
|
|
||||||
.setTitle(
|
|
||||||
`Odebrano Ci rangę ${message.content}, ${message.author.username}.`
|
|
||||||
)
|
|
||||||
.setColor(config.embedColor)
|
|
||||||
.attachFiles('./gractwo.png')
|
|
||||||
.setFooter('#rolki', 'attachment://gractwo.png')
|
|
||||||
.setTimestamp();
|
|
||||||
message.channel
|
|
||||||
.send(removeRolesEmbed)
|
|
||||||
.then((message) => message.delete({ timeout: 3500 }))
|
|
||||||
.catch(console.error);
|
|
||||||
} else {
|
|
||||||
message.member.roles.add(role);
|
|
||||||
message.delete();
|
|
||||||
console.log(
|
|
||||||
`added ${message.content} role to ${message.author.username}.`
|
|
||||||
);
|
|
||||||
const addRolesEmbed = new Discord.MessageEmbed()
|
|
||||||
.setTitle(
|
|
||||||
`Przyznano Ci rangę ${message.content}, ${message.author.username}.`
|
|
||||||
)
|
|
||||||
.setColor(config.embedColor)
|
|
||||||
.attachFiles('./gractwo.png')
|
|
||||||
.setFooter('#rolki', 'attachment://gractwo.png')
|
|
||||||
.setTimestamp();
|
|
||||||
message.channel
|
|
||||||
.send(addRolesEmbed)
|
|
||||||
.then((message) => message.delete({ timeout: 3500 }))
|
|
||||||
.catch(console.error);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (
|
|
||||||
!message.member.roles.cache.find((role) => role.name == 'Moderatorzy')
|
|
||||||
) {
|
|
||||||
console.log(
|
|
||||||
`${message.author.username} spammed the rolki channel with a bad message`
|
|
||||||
);
|
|
||||||
message.delete();
|
|
||||||
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')
|
|
||||||
.setTimestamp();
|
|
||||||
message.channel
|
|
||||||
.send(rolkiWrongMessageEmbed)
|
|
||||||
.then((message) => message.delete({ timeout: 3500 }))
|
|
||||||
.catch(console.error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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(/ +/);
|
|
||||||
const commandName = args.shift().toLowerCase();
|
|
||||||
|
|
||||||
if (!client.commands.has(commandName)) return;
|
|
||||||
const command = client.commands.get(commandName);
|
|
||||||
|
|
||||||
if (command.guildOnly && message.channel.type === 'dm') {
|
|
||||||
return message.reply("I can't execute that command inside DMs!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (command.args && !args.length) {
|
|
||||||
return message.channel.send(
|
|
||||||
`You didn't provide any arguments, ${message.author}!`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
command.execute(message, args, Discord, config, client);
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
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 port = process.env.PORT || 3000;
|
|
||||||
|
|
||||||
let status;
|
|
||||||
|
|
||||||
const getStatus = () => {
|
|
||||||
let totalSeconds = process.uptime();
|
|
||||||
let realTotalSecs = Math.floor(totalSeconds % 60);
|
|
||||||
let days = Math.floor((totalSeconds % 31536000) / 86400);
|
|
||||||
let hours = Math.floor((totalSeconds / 3600) % 24);
|
|
||||||
let mins = Math.floor((totalSeconds / 60) % 60);
|
|
||||||
let used = process.memoryUsage().heapUsed / 1024 / 1024;
|
|
||||||
|
|
||||||
status = {
|
|
||||||
username: client.user.username,
|
|
||||||
avatar: client.user.avatarURL(),
|
|
||||||
status: client.user.presence.status,
|
|
||||||
activity:
|
|
||||||
client.user.presence.activities.length > 0
|
|
||||||
? `${client.user.presence.activities[0].type} ${client.user.presence.activities[0].name}`
|
|
||||||
: null,
|
|
||||||
members: client.users.cache.size,
|
|
||||||
uptime: {
|
|
||||||
days,
|
|
||||||
hours,
|
|
||||||
mins,
|
|
||||||
realTotalSecs,
|
|
||||||
},
|
|
||||||
memory: `${Math.round(used * 100) / 100}MB`,
|
|
||||||
ping: `${Math.floor(client.ws.ping)}ms`,
|
|
||||||
node: process.version,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
setInterval(getStatus, 30000);
|
|
||||||
|
|
||||||
http
|
|
||||||
.createServer(async (req, res) => {
|
|
||||||
res.statusCode = 200;
|
|
||||||
|
|
||||||
res.write(JSON.stringify(status));
|
|
||||||
res.end();
|
|
||||||
})
|
|
||||||
.listen(port, () => console.log(`Now listening on port ${port}`));
|
|
||||||
2394
package-lock.json
generated
2394
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
31
package.json
31
package.json
@@ -1,31 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "gractwo-bot",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "",
|
|
||||||
"engines": {
|
|
||||||
"node": "14.16.0"
|
|
||||||
},
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
|
||||||
"start": "node index.js"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/jakubmanczak/gractwo-bot.git"
|
|
||||||
},
|
|
||||||
"author": "j4mesen",
|
|
||||||
"license": "ISC",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/jakubmanczak/gractwo-bot/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/jakubmanczak/gractwo-bot#readme",
|
|
||||||
"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