adjust witaj & rolki embeds

This commit is contained in:
2021-10-05 16:35:56 +02:00
parent b4f0ae5815
commit ec8f822845
2 changed files with 56 additions and 39 deletions

View File

@@ -30,6 +30,11 @@
"value": "http://gractwo.pl/discord", "value": "http://gractwo.pl/discord",
"inline": true "inline": true
}, },
{
"name": "DISCORD bezpośredni",
"value": "discord.gg/NBXq95C",
"inline": true
},
{ {
"name": "Gractwo TWITTER", "name": "Gractwo TWITTER",
"value": "http://gractwo.pl/twitter", "value": "http://gractwo.pl/twitter",
@@ -44,11 +49,6 @@
"name": "Gractwo GITHUB", "name": "Gractwo GITHUB",
"value": "http://gractwo.pl/github", "value": "http://gractwo.pl/github",
"inline": true "inline": true
},
{
"name": "Gractwo FACEBOOK",
"value": "http://gractwo.pl/fb",
"inline": true
} }
], ],
"regulamin": [ "regulamin": [
@@ -89,6 +89,7 @@
"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." "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:" "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."
} }
} }

View File

@@ -1,4 +1,10 @@
const { MessageActionRow, MessageButton, ButtonInteraction, Interaction, Client } = require('discord.js'); const {
MessageActionRow,
MessageButton,
ButtonInteraction,
Interaction,
Client,
} = require('discord.js');
module.exports = { module.exports = {
name: 'embed', name: 'embed',
@@ -7,18 +13,20 @@ module.exports = {
// not intended outside of specific scenarios // not intended outside of specific scenarios
const embed = { const embed = {
color: cl.cfg.hexBlue, color: cl.cfg.hexBlue,
timestamp: new Date(), // timestamp: new Date(),
footer: { // footer: {
text: `Komenda wywołana przez ${msg.author.tag}`, // text: `Komenda wywołana przez ${msg.author.tag}`,
icon_url: cl.cfg.iconurl, // icon_url: cl.cfg.iconurl,
}, // },
}; };
switch (args[0]) { switch (args[0]) {
case 'witaj': case 'witaj':
embed.title = 'Witajcie w Gractwie!'; embed.author = {
name: 'Witajcie w Gractwie!',
icon_url: 'https://i.imgur.com/4AmRDyX.png',
};
embed.description = embed.description =
'Jesteśmy grupą ludzi których kręcą gry. Proste, nie?\nSerwer ten miał wcześniej tematykę Team Fortressową.'; 'Jesteśmy grupą ludzi których kręcą gry. Proste, nie?\nSerwer ten miał wcześniej tematykę Team Fortressową.';
embed.footer.text = '#witaj';
embed.fields = cl.cfg.embedFields.witaj; embed.fields = cl.cfg.embedFields.witaj;
readyMsg = { embeds: [embed] }; readyMsg = { embeds: [embed] };
break; break;
@@ -31,9 +39,13 @@ module.exports = {
readyMsg = { embeds: [embed] }; readyMsg = { embeds: [embed] };
break; break;
case 'rolki': case 'rolki':
embed.title = 'Rolki'; embed.author = { name: 'Rolki' };
embed.description = '#rolki jest kanałem do przyznawania sobie ról.'; embed.description = cl.cfg.embedFields.rolkiDesc;
embed.footer.text = '#rolki'; embed.footer = {
text: `Komenda wywołana przez ${msg.author.tag}`,
icon_url: cl.cfg.iconurl,
};
embed.timestamp = new Date();
// code responsible for making lists of buttons out of cl.cfg.rolesList // code responsible for making lists of buttons out of cl.cfg.rolesList
// & including them in the readyMsg // & including them in the readyMsg
let i = 1, let i = 1,
@@ -67,27 +79,31 @@ module.exports = {
} }
msg.channel.send(readyMsg); msg.channel.send(readyMsg);
if(args[0] === "rolki") if (args[0] === 'rolki') {
{ cl.on('interactionCreate', (inter) => {
cl.on('interactionCreate', inter => { if (!inter.isButton()) return;
if(!inter.isButton()) return; const role = inter.member.guild.roles.cache.find(
const role = inter.member.guild.roles.cache.find((role) => role.name == inter.customId); (role) => role.name == inter.customId
if(!role) return; );
if(!inter.member.roles.cache.find((role) => role.name == inter.customId)) if (!role) return;
{ if (
inter.member.roles.add(role) !inter.member.roles.cache.find((role) => role.name == inter.customId)
inter.reply("Gratulacje, dodalismy ci tą bezużyteczną rangę",{timeout:cl.cfg.timeout}) ) {
.then (inter.deleteReply()) inter.member.roles.add(role);
inter
.reply('Gratulacje, dodalismy ci tą bezużyteczną rangę', {
timeout: cl.cfg.timeout,
})
.then(inter.deleteReply());
} else {
inter.member.roles.remove(role);
inter
.reply('Gratulacje, odebraliśmy ci tą bezużyteczną rangę', {
timeout: cl.cfg.timeout,
})
.then(inter.deleteReply());
} }
else });
{
inter.member.roles.remove(role)
inter.reply("Gratulacje, odebraliśmy ci tą bezużyteczną rangę",{timeout:cl.cfg.timeout})
.then (inter.deleteReply())
} }
}
)
}
}, },
}; };