This commit is contained in:
Isaac 2021-03-15 21:12:58 +00:00
parent 96562aa474
commit b904a4ad3d
11 changed files with 113 additions and 32 deletions

View File

@ -4,21 +4,22 @@ const Command = require('../modules/commands/command');
module.exports = class NewCommand extends Command { module.exports = class NewCommand extends Command {
constructor(client) { constructor(client) {
const i18n = client.i18n.get();
super(client, { super(client, {
internal: true, internal: true,
name: 'new', name: i18n('commands.new.name'),
description: 'Create a new support ticket', description: i18n('commands.new.description'),
options: [ options: [
// { // {
// name: 'category', // name: i18n('commands.new.options.category.name'),
// type: OptionTypes.STRING, // type: OptionTypes.STRING,
// description: 'The category you would like to create a new ticket for', // description: i18n('commands.new.options.topic.description'),
// required: true, // required: true,
// }, // },
{ {
name: 'topic', name: i18n('commands.new.options.topic.name'),
type: OptionTypes.STRING, type: OptionTypes.STRING,
description: 'The topic of the ticket', description: i18n('commands.new.options.topic.description'),
required: false, required: false,
} }
] ]

View File

@ -173,6 +173,75 @@ module.exports = async (log) => {
tableName: DB_TABLE_PREFIX + 'messages' tableName: DB_TABLE_PREFIX + 'messages'
}); });
// eslint-disable-next-line no-unused-vars
const UserEntity = sequelize.define('UserEntity', {
user: {
type: DataTypes.CHAR(18),
allowNull: false,
unique: 'id_ticket'
},
ticket: {
type: DataTypes.STRING,
allowNull: false,
unique: 'id_ticket',
references: {
model: Ticket,
key: 'id'
},
},
avatar: DataTypes.STRING,
username: DataTypes.STRING,
discriminator: DataTypes.STRING,
display_name: DataTypes.STRING,
colour: DataTypes.INTEGER,
bot: DataTypes.BOOLEAN
}, {
tableName: DB_TABLE_PREFIX + 'user_entities'
});
// eslint-disable-next-line no-unused-vars
const ChannelEntity = sequelize.define('ChannelEntity', {
channel: {
type: DataTypes.CHAR(18),
allowNull: false,
unique: 'id_ticket'
},
ticket: {
type: DataTypes.STRING,
allowNull: false,
unique: 'id_ticket',
references: {
model: Ticket,
key: 'id'
},
},
name: DataTypes.STRING,
}, {
tableName: DB_TABLE_PREFIX + 'channel_entities'
});
// eslint-disable-next-line no-unused-vars
const RoleEntity = sequelize.define('RoleEntity', {
role: {
type: DataTypes.CHAR(18),
allowNull: false,
unique: 'id_ticket'
},
ticket: {
type: DataTypes.STRING,
allowNull: false,
unique: 'id_ticket',
references: {
model: Ticket,
key: 'id'
},
},
name: DataTypes.STRING,
colour: DataTypes.INTEGER,
}, {
tableName: DB_TABLE_PREFIX + 'role_entities'
});
sequelize.sync(); sequelize.sync();
return sequelize; return sequelize;

View File

@ -3,9 +3,20 @@
"bot": { "bot": {
"version": "Discord Tickets v%s by eartharoid" "version": "Discord Tickets v%s by eartharoid"
}, },
"cmd": { "commands": {
"new": { "new": {
"name": "new",
"description": "Create a new support ticket",
"options": {
"category": {
"name": "category",
"description": "The category you would like to create a new ticket for"
},
"topic": {
"name": "topic",
"description": "The topic of the ticket"
}
}
} }
}, },
"no_perm": "❌ You do not have the permissions required to use this command:\n%s", "no_perm": "❌ You do not have the permissions required to use this command:\n%s",

View File

@ -26,8 +26,8 @@ module.exports = {
debug: false, debug: false,
defaults: { defaults: {
colour: '#009999', colour: '#009999',
locale: 'en-GB', locale: 'en-GB', // can **not** be set for each server
log_messages: true, // required for transcripts/archives log_messages: true, // transcripts/archives will be empty if false
prefix: '-', prefix: '-',
ticket_welcome: 'Hello {{name}}, thank you for creating a ticket. A member of staff will soon be available to assist you.\n\n__All messages in this channel are stored for future reference.__', ticket_welcome: 'Hello {{name}}, thank you for creating a ticket. A member of staff will soon be available to assist you.\n\n__All messages in this channel are stored for future reference.__',
}, },