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 {
constructor(client) {
const i18n = client.i18n.get();
super(client, {
internal: true,
name: 'new',
description: 'Create a new support ticket',
name: i18n('commands.new.name'),
description: i18n('commands.new.description'),
options: [
// {
// name: 'category',
// name: i18n('commands.new.options.category.name'),
// type: OptionTypes.STRING,
// description: 'The category you would like to create a new ticket for',
// description: i18n('commands.new.options.topic.description'),
// required: true,
// },
{
name: 'topic',
name: i18n('commands.new.options.topic.name'),
type: OptionTypes.STRING,
description: 'The topic of the ticket',
description: i18n('commands.new.options.topic.description'),
required: false,
}
]

View File

@ -173,6 +173,75 @@ module.exports = async (log) => {
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();
return sequelize;

View File

@ -3,9 +3,20 @@
"bot": {
"version": "Discord Tickets v%s by eartharoid"
},
"cmd": {
"commands": {
"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",

View File

@ -26,8 +26,8 @@ module.exports = {
debug: false,
defaults: {
colour: '#009999',
locale: 'en-GB',
log_messages: true, // required for transcripts/archives
locale: 'en-GB', // can **not** be set for each server
log_messages: true, // transcripts/archives will be empty if false
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.__',
},