Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bot.on('message', async message => {
- if (message.author.bot) return;
- if (message.channel.type !== 'text') {
- let active = await db.fetch(`support_${message.author.id}`);
- let guild = bot.guilds.get(serverStats.guildID);
- let channel, found = true;
- try {
- if (active) bot.channels.get(active.channelID)
- .guild;
- } catch (e) {
- found = false;
- }
- if (!active || !found) {
- active = {};
- channel = await guild.createChannel(`${message.author.username}-${message.author.discriminator}`, {type: 'text'})
- channel.setParent(serverStats.ticketCategoryID)
- channel.setTopic(`!zakoncz aby zamknąć ticket | Wsparcie dla ${message.author.tag} | ID: ${message.author.id}`)
- channel.overwritePermissions('582227307352162335', { //Role id (kiedy ktos dolacza na serwer <<, niewiem jak to zmienic na @everyone. Tylko administarcja bedzie widziec kanal!
- VIEW_CHANNEL: false,
- SEND_MESSAGES: false,
- ADD_REACTIONS: false
- });
- channel.overwritePermissions('609808389454954507', { //Role id (kiedy ktos dolacza na serwer <<, niewiem jak to zmienic na @everyone. Tylko administarcja bedzie widziec kanal!
- VIEW_CHANNEL: true,
- SEND_MESSAGES: true,
- ADD_REACTIONS: true
- });
- channel.overwritePermissions('602249945696698419', { //Role id (kiedy ktos dolacza na serwer <<, niewiem jak to zmienic na @everyone. Tylko administarcja bedzie widziec kanal!
- VIEW_CHANNEL: true,
- SEND_MESSAGES: true,
- ADD_REACTIONS: true
- });
- channel.overwritePermissions('582584900742414489', { //Role id (kiedy ktos dolacza na serwer <<, niewiem jak to zmienic na @everyone. Tylko administarcja bedzie widziec kanal!
- VIEW_CHANNEL: true,
- SEND_MESSAGES: true,
- ADD_REACTIONS: true
- });
- let author = message.author;
- const newChannel = new Discord.RichEmbed()
- .setColor('RANDOM')
- .setAuthor(author.tag, author.avatarURL)
- .setFooter('Utworzono bilet pomocniczy!')
- .addField('Użytkownik', author)
- .addField('ID', author.id)
- await channel.send(newChannel);
- const newTicket = new Discord.RichEmbed()
- .setColor('RANDOM')
- .setAuthor(`Cześć, ${author.username}`, author.avatarURL)
- .setFooter('Utworzono bilet pomocniczy!')
- await author.send(newTicket);
- active.channelID = channel.id;
- active.targetID = author.id;
- }
- channel = bot.channels.get(active.channelID);
- const dm = new Discord.RichEmbed()
- .setColor('RANDOM')
- .setAuthor(`Dziękuje, ${message.author.username}`, message.author.avatarURL)
- .setFooter(`Twoja wiadomość została wysłana, support wkrótce się z tobą skontaktuje.`)
- await message.author.send(dm);
- if (message.content.startsWith('!complete')) return;
- const embed5 = new Discord.RichEmbed()
- .setColor('RANDOM')
- .setAuthor(message.author.tag, message.author.avatarURL)
- .setDescription(message.content)
- .setFooter(`Wiadomość otrzymana - ${message.author.tag}`)
- await channel.send(embed5);
- db.set(`support_${message.author.id}`, active);
- db.set(`supportChannel_${channel.id}`, message.author.id);
- return;
- }
- let support = await db.fetch(`supportChannel_${message.channel.id}`);
- if (support) {
- support = await db.fetch(`support_${support}`);
- let supportUser = bot.users.get(support.targetID);
- if (!supportUser) return message.channel.delete();
- if (message.content.toLowerCase() === '!zakoncz') {
- const complete = new Discord.RichEmbed()
- .setColor('RANDOM')
- .setAuthor(`Hej, ${supportUser.tag}`, supportUser.avatarURL)
- .setFooter('Zamknięty bilet')
- .setDescription('* Twój bilet został oznaczony jako kompletny. Jeśli chcesz go ponownie otworzyć lub utworzyć nowy, wyślij wiadomość do bota. *')
- supportUser.send(complete);
- message.channel.delete();
- db.delete(`support_${support.targetID}`);
- let inEmbed = new Discord.RichEmbed()
- .setTitle('Bilet Zamknięty!')
- .addField('Wsparcie użytkownika', `${supportUser.tag}`)
- .addField('Przez', message.author.tag)
- .setColor('RANDOM')
- const staffChannel = bot.channels.get('636304867761193010'); //stworzenie kanalu z logami wklej tu jego id
- staffChannel.send(inEmbed);
- }
- const embed4 = new Discord.RichEmbed()
- .setColor('RANDOM')
- .setAuthor(message.author.tag, message.author.avatarURL)
- .setFooter(`Wiadomość Otrzymana -- Support`)
- .setDescription(message.content)
- bot.users.get(support.targetID)
- .send(embed4);
- message.delete({
- timeout: 10000
- });
- embed4.setFooter(`Wiadomość Wysłana -- ${supportUser.tag}`)
- .setDescription(message.content);
- return message.channel.send(embed4);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement