Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubaid7 authored Jun 29, 2021
1 parent dde7779 commit ffb715e
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
19 changes: 19 additions & 0 deletions Episode 50/commands/Main-Commands/Ticket/add.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
commands: ['add-user', 'add-ticket'], // You Can Keep Any Name
permissions: 'MANAGE_CHANNELS', // You Can Keep Any Permission
permissionError: 'You Cant Use This Command', // Optional
description: 'Add User To Ticket', // Optional

callback: async(message, args, client) => {

const user = message.mentions.members.first() || message.guild.members.cache.find(member => member.user.username.toLowerCase() === args.join(" ").toLowerCase()) || message.guild.members.cache.get(args[0]) || message.guild.members.cache.find(member => member.displayName.toLowerCase() === args.join(" ").toLowerCase())
if(!user) return message.reply(`Whom Do You Want To Add To Ticket?`) // If No User Is Provided
message.channel.updateOverwrite(user.user, {
VIEW_CHANNEL: true,
SEND_MESSAGES: true,
ATTACH_FILES: true,
READ_MESSAGE_HISTORY: true,
}) // Permissions
message.channel.send(`Added <@${user.id}> To <#${message.channel.id}>`)
}
}
16 changes: 16 additions & 0 deletions Episode 50/commands/Main-Commands/Ticket/remove.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
commands: ['remove-user', 'remove-ticket'], // You Can Keep Any Name
permissions: 'MANAGE_CHANNELS', // You Can Keep Any Permission
permissionError: 'You Cant Use This Command', // Optional
description: 'Remove User To Ticket', // Optional

callback: async(message, args, client) => {

const user = message.mentions.members.first() || message.guild.members.cache.find(member => member.user.username.toLowerCase() === args.join(" ").toLowerCase()) || message.guild.members.cache.get(args[0]) || message.guild.members.cache.find(member => member.displayName.toLowerCase() === args.join(" ").toLowerCase())
if(!user) return message.reply(`Whom Do You Want To Remove To Ticket?`) // If No User Is Provided
message.channel.updateOverwrite(user.user, {
VIEW_CHANNEL: false
}) // Permissions
message.channel.send(`Removed <@${user.id}> From <#${message.channel.id}>`)
}
}
26 changes: 25 additions & 1 deletion Episode 50/commands/Main-Commands/Ticket/stat.js
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@

const { MessageEmbed } = require('discord.js')
const db = require('quick.db') // npm i quick.db

module.exports = {
commands: ['stat-ticket', 'ticket-stat', 'stats-ticket', 'ticket-stats'], // You Can Keep Any Name
description: 'See How Many Tickets You Have Opened', // Optional

callback: async(message, args, client) => {

const user = message.mentions.members.first() || message.guild.members.cache.find(member => member.user.username.toLowerCase() === args.join(" ").toLowerCase()) || message.guild.members.cache.get(args[0]) || message.guild.members.cache.find(member => member.displayName.toLowerCase() === args.join(" ").toLowerCase()) || message.member
const total = db.fetch(`ticket-user-total_${user.id}`) // To Get Total Tickets Opened
const closed = db.fetch(`ticket-user-closed_${user.id}`) // To Get Ticket Which Were Closed
const opened = total - closed // Using Maths We Get Opened Tickets

const embed = new MessageEmbed()
.setAuthor(`Ticket Stats`, user.user.displayAvatarURL({ dynamic: true }))
.setTimestamp()
.setColor('RANDOM')
.setDescription(`
Total Tickets Opened: **${total}**
Opened Tickets: **${opened}**
`)
message.channel.send(embed)
}
}

0 comments on commit ffb715e

Please sign in to comment.