-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}>`) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}>`) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |