Mee6discord przygotowania

This commit is contained in:
Stanislaw
2022-03-10 22:59:33 +01:00
parent 60bf216d71
commit 8a3f9bb03c
14 changed files with 152 additions and 130 deletions

View File

@@ -1,95 +0,0 @@
{
"prefix": ".",
"hexBlue": "61f2ea",
"hexRed": "fb636b",
"iconurl": "https://i.imgur.com/4AmRDyX.png",
"timeout": 4000,
"rolesList": [
"tf2",
"liga",
"csgo",
"minecraft",
"rainbow-six",
"apex",
"genshin",
"valorant"
],
"embedFields": {
"witaj": [
{
"name": "Zasady",
"value": "Zasady serwera są spisane na kanale `regulamin`. Pamiętajcie, by tam zajrzeć."
},
{
"name": "Gractwo WWW",
"value": "http://gractwo.pl",
"inline": true
},
{
"name": "Gractwo DISCORD",
"value": "http://gractwo.pl/discord",
"inline": true
},
{
"name": "DISCORD bezpośredni",
"value": "discord.gg/NBXq95C",
"inline": true
},
{
"name": "Gractwo TWITTER",
"value": "http://gractwo.pl/twitter",
"inline": true
},
{
"name": "Gractwo YOUTUBE",
"value": "http://gractwo.pl/youtube",
"inline": true
},
{
"name": "Gractwo GITHUB",
"value": "http://gractwo.pl/github",
"inline": true
}
],
"regulamin": [
{
"name": "§1 Szacunek",
"value": "Na naszym serwerze obowiązuje szacunek do innych osób podczas niesatyrycznej dyskusji."
},
{
"name": "§2 Spam / Trolling",
"value": "Jeżeli będziesz bezużytecznie spamować lub nieprzyjmenie się zachowywać zostaniesz zbanowany."
},
{
"name": "§3 Bagno",
"value": "Kanał #bagno 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."
},
{
"name": "§4 Poprawne Kanały",
"value": "Rozmowy na dany temat powinny toczyć się w kanałach do tego przeznaczonych."
},
{
"name": "§5 Memy i Gify",
"value": "Memy i Gify nie są zbyt przyjemne dla oka bez kontekstu. Najlepiej jest nie postować ich, jeżeli nie pasują do prowadzonej aktualnie dyskusji."
},
{
"name": "§6 Reklamy",
"value": "Zakaz reklam bez zezwolenia moderatora lub administratora. Pozwolenia na reklamę muszą być wydane przed jej zamieszczeniem."
},
{
"name": "§7 Przestrzeganie Regulaminu",
"value": "Przestrzeganie regulaminu jest obowiązkowe, a to że go ktoś nie przeczytał nic nie zmienia."
},
{
"name": "§8 Obcowanie z botem",
"value": "Próby intencjonalnego łamania bota nie są mile widziane, tak jak nadużywanie go w celach spamu kanałów."
},
{
"name": "§9 Warunki Użytkowania Discord (ToS)",
"value": "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."
}
],
"pomocDesc": "Komenda objaśniająca bota i jego zastosowanie, a także dostępne komendy.\n\nBot Gractwa funkcjonuje jako własne rozwiązanie na problemy z administrowaniem serwera Discord. Umożliwia między innymi samo-nadawanie rolek od gier, lub odsłuchiwanie muzyki.\n\nPoniżej znajduje się lista dostępnych komend:",
"rolkiDesc": "Poniżej widnieją przyciski służące do przyznawania bądź odejmowanie sobie ról powiązanych z grami. Służą one do oznaczania wszystkich zainteresowanych daną grą na określonym kanale."
}
}

0
src/cmds/batch.js Normal file
View File

6
src/cmds/odznaki.js Normal file
View File

@@ -0,0 +1,6 @@
module.exports = {
name: "odznaki",
execute(cl, msg) {
},
};

View File

@@ -1,18 +1,18 @@
module.exports = {
name: 'ping',
execute(cl, msg) {
const embed = {
color: cl.cfg.hexBlue,
timestamp: new Date(),
footer: {
text: `Komenda wywołana przez ${msg.author.tag}`,
icon_url: cl.cfg.iconurl,
},
title: 'Pong!',
description: `Ping jednostronny wynosi ${
Date.now() - msg.createdTimestamp
}ms.`,
};
msg.channel.send({ embeds: [embed] });
},
name: "ping",
execute(cl, msg) {
const embed = {
color: cl.cfg.hexBlue,
timestamp: new Date(),
footer: {
text: `Komenda wywołana przez ${msg.author.tag}`,
icon_url: cl.cfg.iconurl,
},
title: "Pong!",
description: `Ping jednostronny wynosi ${
Date.now() - msg.createdTimestamp
}ms.`,
};
msg.channel.send({ embeds: [embed] });
},
};

View File

@@ -1,50 +0,0 @@
module.exports = {
name: 'play',
execute(cl, msg, args) {
const ytdl = require('ytdl-core');
const ytsr = require('ytsr');
const path = require('path');
const discord = require('discord.js');
const fs = require('fs')
const { joinVoiceChannel, createAudioPlayer, createAudioResource } = require('@discordjs/voice');
let connection;
let aplay;
let queue;
function link(msg) {
let request = msg.content.slice(path.basename(__filename).length + cl.cfg.prefix.length - 3);
if (request.trim() == "") {
msg.reply("Dej link albo tagi albo weź i spierdalaj");
} else if (request.trim().startsWith("https")) {
request = request.trim()
if (ytdl.validateURL(request)) {
msg.reply("Poprawny link");
let linked = './sound/' + msg.member.voice.channel.id + '.mp4'
ytdl(request).pipe(fs.createWriteStream(linked));
return linked;
} else {
msg.reply("Kurwo wenecka daj prawdziwy link a nie jaja sobie robisz");
}
} else {
msg.reply("Szukasz:" + request);
}
}
if (!connection) {
let vChannel = msg.member.voice.channel;
connection = joinVoiceChannel({
channelId: vChannel.id,
guildId: vChannel.guild.id,
adapterCreator: vChannel.guild.voiceAdapterCreator,
})
}
aplay = createAudioPlayer();
link(msg);
let song = createAudioResource('./sound/' + msg.member.voice.channel.id + '.mp4');
aplay.play(song);
connection.subscribe(aplay);
aplay.on('error', error => {
console.error(error);
});
}
}

4
src/cmds/profil.js Normal file
View File

@@ -0,0 +1,4 @@
module.exports = {
name: "profil",
execute(cl, msg) {},
};

4
src/cmds/ranking.js Normal file
View File

@@ -0,0 +1,4 @@
module.exports = {
name: "ranking",
execute(cl, msg) {},
};

View File

@@ -1,58 +0,0 @@
const discordjs = require('discord.js');
const fs = require('fs');
require('dotenv').config();
const cl = new discordjs.Client({
intents: [
discordjs.Intents.FLAGS.GUILDS,
discordjs.Intents.FLAGS.GUILD_MESSAGES,
discordjs.Intents.FLAGS.GUILD_VOICE_STATES,
],
});
cl.cfg = require('./cfg.json');
cl.cmds = new discordjs.Collection();
const cmdsFls = fs
.readdirSync(`./src/cmds`)
.filter((file) => file.endsWith(`.js`));
for (const Fl of cmdsFls) {
const cmd = require(`./cmds/${Fl}`);
console.log(`command: ` + cmd.name);
cl.cmds.set(cmd.name, cmd);
}
cl.on('messageCreate', (msg) => {
if (!msg.content.startsWith(cl.cfg.prefix) || msg.author.bot) return;
const args = msg.content.slice(cl.cfg.prefix.length).trim().split(/ +/);
const cmdName = args.shift().toLowerCase();
if (!cl.cmds.has(cmdName)) return;
const cmd = cl.cmds.get(cmdName);
try {
cmd.execute(cl, msg, args);
} catch (error) {
console.error(
`msgCommand error: ${cmdName} with args ${args} by ${msg.author.tag}\n--\n${error}\n--`
);
msg.reply(
`An error occured while trying to execute ${cmdName} with args ${args}`
);
console.log(error);
return;
}
console.log(`msgCommand: ${cmdName + args} by ${msg.author.tag}`);
});
cl.once('ready', () => {
console.clear();
console.log(`bot ready; logged in as ${cl.user.tag}\n--`);
cl.user.setActivity('.pomoc', { type: 'LISTENING' });
});
cl.login(process.env.token); // here comes the boooy
// hello boy
// welcome
// there he is
// he is here