generated from Baipyrus/DiscordJS-Template
refactor: auto format
This commit is contained in:
parent
79d69b7360
commit
73fe43a392
@ -1,138 +1,138 @@
|
||||
import {
|
||||
SlashCommandBuilder,
|
||||
PermissionFlagsBits,
|
||||
AutocompleteInteraction,
|
||||
ChatInputCommandInteraction
|
||||
} from 'discord.js';
|
||||
|
||||
/** @param {ChatInputCommandInteraction} interaction */
|
||||
async function createResponse(interaction) {}
|
||||
|
||||
/** @param {ChatInputCommandInteraction} interaction */
|
||||
async function addResponse(interaction) {}
|
||||
|
||||
/** @param {ChatInputCommandInteraction} interaction */
|
||||
async function removeResponse(interaction) {}
|
||||
|
||||
/** @param {ChatInputCommandInteraction} interaction */
|
||||
async function listResponse(interaction) {}
|
||||
|
||||
/** @param {ChatInputCommandInteraction} interaction */
|
||||
async function infoResponse(interaction) {}
|
||||
|
||||
/** @param {AutocompleteInteraction} interaction */
|
||||
async function addAutocomplete(interaction) {}
|
||||
|
||||
/** @param {AutocompleteInteraction} interaction */
|
||||
async function removeAutocomplete(interaction) {}
|
||||
|
||||
/** @param {AutocompleteInteraction} interaction */
|
||||
async function infoAutocomplete(interaction) {}
|
||||
|
||||
export const data = new SlashCommandBuilder()
|
||||
.setName('response')
|
||||
.setDMPermission(false)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages)
|
||||
.setDescription('Event based responses to specific messages with keywords.')
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName('create')
|
||||
.setDescription('Creates a new event based response.')
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('keyword')
|
||||
.setDescription('The keyword to trigger the response.')
|
||||
.setRequired(true)
|
||||
)
|
||||
)
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName('add')
|
||||
.setDescription('Registers a response to a keyword.')
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('keyword')
|
||||
.setDescription('The keyword to trigger the response.')
|
||||
.setAutocomplete(true)
|
||||
.setRequired(true)
|
||||
)
|
||||
)
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName('remove')
|
||||
.setDescription('Unregisters a response to a keyword.')
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('type')
|
||||
.setDescription('The type of data to be removed.')
|
||||
.setRequired(true)
|
||||
.addChoices(
|
||||
{ name: 'Keyword', value: 'keyword' },
|
||||
{ name: 'Response', value: 'response' }
|
||||
)
|
||||
)
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('name')
|
||||
.setDescription('The name of the data to be removed.')
|
||||
.setAutocomplete(true)
|
||||
.setRequired(true)
|
||||
)
|
||||
)
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand.setName('list').setDescription('Lists all registered keywords.')
|
||||
)
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName('info')
|
||||
.setDescription('Shows information about a registered keyword.')
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('keyword')
|
||||
.setDescription('The keyword to show the details of.')
|
||||
.setAutocomplete(true)
|
||||
.setRequired(true)
|
||||
)
|
||||
);
|
||||
/** @param {ModalSubmitInteraction} interaction */
|
||||
export async function modalSubmit(interaction) {
|
||||
// Only executable in 'add' subcommand
|
||||
}
|
||||
/** @param {AutocompleteInteraction} interaction */
|
||||
export async function autocomplete(interaction) {
|
||||
const { options } = interaction;
|
||||
|
||||
switch (options.getSubcommand()) {
|
||||
case 'add':
|
||||
addAutocomplete(interaction);
|
||||
break;
|
||||
case 'remove':
|
||||
removeAutocomplete(interaction);
|
||||
break;
|
||||
case 'info':
|
||||
infoAutocomplete(interaction);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/** @param {ChatInputCommandInteraction} interaction */
|
||||
export async function execute(interaction) {
|
||||
const { options } = interaction;
|
||||
|
||||
switch (options.getSubcommand()) {
|
||||
case 'create':
|
||||
createResponse(interaction);
|
||||
break;
|
||||
case 'add':
|
||||
addResponse(interaction);
|
||||
break;
|
||||
case 'remove':
|
||||
removeResponse(interaction);
|
||||
break;
|
||||
case 'list':
|
||||
listResponse(interaction);
|
||||
break;
|
||||
case 'info':
|
||||
infoResponse(interaction);
|
||||
break;
|
||||
}
|
||||
}
|
||||
import {
|
||||
SlashCommandBuilder,
|
||||
PermissionFlagsBits,
|
||||
AutocompleteInteraction,
|
||||
ChatInputCommandInteraction
|
||||
} from 'discord.js';
|
||||
|
||||
/** @param {ChatInputCommandInteraction} interaction */
|
||||
async function createResponse(interaction) {}
|
||||
|
||||
/** @param {ChatInputCommandInteraction} interaction */
|
||||
async function addResponse(interaction) {}
|
||||
|
||||
/** @param {ChatInputCommandInteraction} interaction */
|
||||
async function removeResponse(interaction) {}
|
||||
|
||||
/** @param {ChatInputCommandInteraction} interaction */
|
||||
async function listResponse(interaction) {}
|
||||
|
||||
/** @param {ChatInputCommandInteraction} interaction */
|
||||
async function infoResponse(interaction) {}
|
||||
|
||||
/** @param {AutocompleteInteraction} interaction */
|
||||
async function addAutocomplete(interaction) {}
|
||||
|
||||
/** @param {AutocompleteInteraction} interaction */
|
||||
async function removeAutocomplete(interaction) {}
|
||||
|
||||
/** @param {AutocompleteInteraction} interaction */
|
||||
async function infoAutocomplete(interaction) {}
|
||||
|
||||
export const data = new SlashCommandBuilder()
|
||||
.setName('response')
|
||||
.setDMPermission(false)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages)
|
||||
.setDescription('Event based responses to specific messages with keywords.')
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName('create')
|
||||
.setDescription('Creates a new event based response.')
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('keyword')
|
||||
.setDescription('The keyword to trigger the response.')
|
||||
.setRequired(true)
|
||||
)
|
||||
)
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName('add')
|
||||
.setDescription('Registers a response to a keyword.')
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('keyword')
|
||||
.setDescription('The keyword to trigger the response.')
|
||||
.setAutocomplete(true)
|
||||
.setRequired(true)
|
||||
)
|
||||
)
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName('remove')
|
||||
.setDescription('Unregisters a response to a keyword.')
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('type')
|
||||
.setDescription('The type of data to be removed.')
|
||||
.setRequired(true)
|
||||
.addChoices(
|
||||
{ name: 'Keyword', value: 'keyword' },
|
||||
{ name: 'Response', value: 'response' }
|
||||
)
|
||||
)
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('name')
|
||||
.setDescription('The name of the data to be removed.')
|
||||
.setAutocomplete(true)
|
||||
.setRequired(true)
|
||||
)
|
||||
)
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand.setName('list').setDescription('Lists all registered keywords.')
|
||||
)
|
||||
.addSubcommand((subcommand) =>
|
||||
subcommand
|
||||
.setName('info')
|
||||
.setDescription('Shows information about a registered keyword.')
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('keyword')
|
||||
.setDescription('The keyword to show the details of.')
|
||||
.setAutocomplete(true)
|
||||
.setRequired(true)
|
||||
)
|
||||
);
|
||||
/** @param {ModalSubmitInteraction} interaction */
|
||||
export async function modalSubmit(interaction) {
|
||||
// Only executable in 'add' subcommand
|
||||
}
|
||||
/** @param {AutocompleteInteraction} interaction */
|
||||
export async function autocomplete(interaction) {
|
||||
const { options } = interaction;
|
||||
|
||||
switch (options.getSubcommand()) {
|
||||
case 'add':
|
||||
addAutocomplete(interaction);
|
||||
break;
|
||||
case 'remove':
|
||||
removeAutocomplete(interaction);
|
||||
break;
|
||||
case 'info':
|
||||
infoAutocomplete(interaction);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/** @param {ChatInputCommandInteraction} interaction */
|
||||
export async function execute(interaction) {
|
||||
const { options } = interaction;
|
||||
|
||||
switch (options.getSubcommand()) {
|
||||
case 'create':
|
||||
createResponse(interaction);
|
||||
break;
|
||||
case 'add':
|
||||
addResponse(interaction);
|
||||
break;
|
||||
case 'remove':
|
||||
removeResponse(interaction);
|
||||
break;
|
||||
case 'list':
|
||||
listResponse(interaction);
|
||||
break;
|
||||
case 'info':
|
||||
infoResponse(interaction);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1,33 +1,33 @@
|
||||
import { DataTypes, Deferrable, Sequelize } from 'sequelize';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Keyword
|
||||
* @property {string} id A universally unique id, generated by sequelize.
|
||||
* @property {string} guild A Discord guild ID as a foreign key reference.
|
||||
* @property {string} name The name of the keyword.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The definition of the `Keyword` table in the database.
|
||||
* @param {Sequelize} sequelize
|
||||
*/
|
||||
export default function (sequelize) {
|
||||
return sequelize.define('Keywords', {
|
||||
id: {
|
||||
defaultValue: DataTypes.UUIDV4,
|
||||
type: DataTypes.UUID,
|
||||
primaryKey: true
|
||||
},
|
||||
guild: {
|
||||
type: DataTypes.STRING,
|
||||
references: {
|
||||
deferrable: Deferrable.INITIALLY_IMMEDIATE,
|
||||
model: 'Guilds',
|
||||
key: 'id'
|
||||
}
|
||||
},
|
||||
name: {
|
||||
type: DataTypes.STRING
|
||||
}
|
||||
});
|
||||
}
|
||||
import { DataTypes, Deferrable, Sequelize } from 'sequelize';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Keyword
|
||||
* @property {string} id A universally unique id, generated by sequelize.
|
||||
* @property {string} guild A Discord guild ID as a foreign key reference.
|
||||
* @property {string} name The name of the keyword.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The definition of the `Keyword` table in the database.
|
||||
* @param {Sequelize} sequelize
|
||||
*/
|
||||
export default function (sequelize) {
|
||||
return sequelize.define('Keywords', {
|
||||
id: {
|
||||
defaultValue: DataTypes.UUIDV4,
|
||||
type: DataTypes.UUID,
|
||||
primaryKey: true
|
||||
},
|
||||
guild: {
|
||||
type: DataTypes.STRING,
|
||||
references: {
|
||||
deferrable: Deferrable.INITIALLY_IMMEDIATE,
|
||||
model: 'Guilds',
|
||||
key: 'id'
|
||||
}
|
||||
},
|
||||
name: {
|
||||
type: DataTypes.STRING
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,37 +1,37 @@
|
||||
import { DataTypes, Deferrable, Sequelize } from 'sequelize';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Response
|
||||
* @property {string} id A universally unique id, generated by sequelize.
|
||||
* @property {string} keyword A universally unique id referencing a `Keyword`.
|
||||
* @property {string} name The name of the response.
|
||||
* @property {string} response The response data itself.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The definition of the `Response` table in the database.
|
||||
* @param {Sequelize} sequelize
|
||||
*/
|
||||
export default function (sequelize) {
|
||||
return sequelize.define('Responses', {
|
||||
id: {
|
||||
defaultValue: DataTypes.UUIDV4,
|
||||
type: DataTypes.UUID,
|
||||
primaryKey: true
|
||||
},
|
||||
keyword: {
|
||||
type: DataTypes.UUID,
|
||||
references: {
|
||||
deferrable: Deferrable.INITIALLY_IMMEDIATE,
|
||||
model: 'Keywords',
|
||||
key: 'id'
|
||||
}
|
||||
},
|
||||
name: {
|
||||
type: DataTypes.STRING
|
||||
},
|
||||
response: {
|
||||
type: DataTypes.STRING
|
||||
}
|
||||
});
|
||||
}
|
||||
import { DataTypes, Deferrable, Sequelize } from 'sequelize';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Response
|
||||
* @property {string} id A universally unique id, generated by sequelize.
|
||||
* @property {string} keyword A universally unique id referencing a `Keyword`.
|
||||
* @property {string} name The name of the response.
|
||||
* @property {string} response The response data itself.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The definition of the `Response` table in the database.
|
||||
* @param {Sequelize} sequelize
|
||||
*/
|
||||
export default function (sequelize) {
|
||||
return sequelize.define('Responses', {
|
||||
id: {
|
||||
defaultValue: DataTypes.UUIDV4,
|
||||
type: DataTypes.UUID,
|
||||
primaryKey: true
|
||||
},
|
||||
keyword: {
|
||||
type: DataTypes.UUID,
|
||||
references: {
|
||||
deferrable: Deferrable.INITIALLY_IMMEDIATE,
|
||||
model: 'Keywords',
|
||||
key: 'id'
|
||||
}
|
||||
},
|
||||
name: {
|
||||
type: DataTypes.STRING
|
||||
},
|
||||
response: {
|
||||
type: DataTypes.STRING
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user