[CodeFactor] Apply fixes

This commit is contained in:
codefactor-io 2022-03-06 18:41:50 +00:00 committed by Axel Olausson Holtenäs
parent 675ffe3225
commit 98d478187d
No known key found for this signature in database
GPG key ID: E3AE7E194AE017ED
2 changed files with 35 additions and 90 deletions

View file

@ -26,8 +26,7 @@ module.exports = async (interaction) => {
// eslint-disable-next-line max-len
guild.credits.workTimeout = workTimeout !== null ? workTimeout : guild.credits.workTimeout;
// eslint-disable-next-line max-len
guild.credits.minimumLength =
minimumLength !== null ? minimumLength : guild.credits.minimumLength;
guild.credits.minimumLength = minimumLength !== null ? minimumLength : guild.credits.minimumLength;
await guild.save();
const embed = {

View file

@ -25,124 +25,70 @@ module.exports = {
data: new SlashCommandBuilder()
.setName('credits')
.setDescription('Manage your credits.')
.addSubcommand((subcommand) =>
subcommand
.addSubcommand((subcommand) => subcommand
.setName('give')
.setDescription('Give credits to a user. (ADMIN)')
.addUserOption((option) =>
option.setName('user').setDescription('The user you want to pay.').setRequired(true)
)
.addIntegerOption((option) =>
option.setName('amount').setDescription('The amount you will pay.').setRequired(true)
)
)
.addSubcommand((subcommand) =>
subcommand
.addUserOption((option) => option.setName('user').setDescription('The user you want to pay.').setRequired(true))
.addIntegerOption((option) => option.setName('amount').setDescription('The amount you will pay.').setRequired(true)))
.addSubcommand((subcommand) => subcommand
.setName('take')
.setDescription('Take credits from a user. (ADMIN)')
.addUserOption((option) =>
option
.addUserOption((option) => option
.setName('user')
.setDescription('The user you want to take credits from.')
.setRequired(true)
)
.addIntegerOption((option) =>
option.setName('amount').setDescription('The amount you will take.').setRequired(true)
)
)
.addSubcommand((subcommand) =>
subcommand
.setRequired(true))
.addIntegerOption((option) => option.setName('amount').setDescription('The amount you will take.').setRequired(true)))
.addSubcommand((subcommand) => subcommand
.setName('balance')
.setDescription("Check a user's balance.")
.addUserOption((option) =>
option
.addUserOption((option) => option
.setName('user')
.setDescription('The user whose balance you want to check.')
.setRequired(false)
)
)
.addSubcommand((subcommand) =>
subcommand
.setRequired(false)))
.addSubcommand((subcommand) => subcommand
.setName('redeem')
.setDescription('Redeem your credits.')
.addIntegerOption((option) =>
option.setName('amount').setDescription('How much credit you want to withdraw.')
)
)
.addSubcommand((subcommand) =>
subcommand
.addIntegerOption((option) => option.setName('amount').setDescription('How much credit you want to withdraw.')))
.addSubcommand((subcommand) => subcommand
.setName('gift')
.setDescription('Gift someone credits from your credits.')
.addUserOption((option) =>
option.setName('user').setDescription('The user you want to pay.').setRequired(true)
)
.addIntegerOption((option) =>
option.setName('amount').setDescription('The amount you will pay.').setRequired(true)
)
.addStringOption((option) => option.setName('reason').setDescription('Your reason.'))
)
.addSubcommand((subcommand) =>
subcommand.setName('top').setDescription('Check the top balance.')
)
.addSubcommand((subcommand) =>
subcommand
.addUserOption((option) => option.setName('user').setDescription('The user you want to pay.').setRequired(true))
.addIntegerOption((option) => option.setName('amount').setDescription('The amount you will pay.').setRequired(true))
.addStringOption((option) => option.setName('reason').setDescription('Your reason.')))
.addSubcommand((subcommand) => subcommand.setName('top').setDescription('Check the top balance.'))
.addSubcommand((subcommand) => subcommand
.setName('transfer')
.setDescription('Transfer credits from a user to another user. (ADMIN)')
.addUserOption((option) =>
option
.addUserOption((option) => option
.setName('from')
.setDescription('The user you want to take credits from.')
.setRequired(true)
)
.addUserOption((option) =>
option
.setRequired(true))
.addUserOption((option) => option
.setName('to')
.setDescription('The user you want to give credits to.')
.setRequired(true)
)
.addIntegerOption((option) =>
option.setName('amount').setDescription('The amount you will transfer.').setRequired(true)
)
)
.addSubcommand((subcommand) =>
subcommand
.setRequired(true))
.addIntegerOption((option) => option.setName('amount').setDescription('The amount you will transfer.').setRequired(true)))
.addSubcommand((subcommand) => subcommand
.setName('set')
.setDescription('Set credits on a user. (ADMIN)')
.addUserOption((option) =>
option
.addUserOption((option) => option
.setName('user')
.setDescription('The user you want to set credits on.')
.setRequired(true)
)
.addIntegerOption((option) =>
option.setName('amount').setDescription('The amount you will set.').setRequired(true)
)
)
.addSubcommand((subcommand) =>
subcommand
.setRequired(true))
.addIntegerOption((option) => option.setName('amount').setDescription('The amount you will set.').setRequired(true)))
.addSubcommand((subcommand) => subcommand
.setName('settings')
.setDescription('Manage credit settings. (ADMIN)')
.addBooleanOption((option) => option.setName('status').setDescription('Toggle credits.'))
.addStringOption((option) => option.setName('url').setDescription('Controlpanel.gg URL.'))
.addStringOption((option) =>
option.setName('token').setDescription('Controlpanel.gg token.')
)
.addStringOption((option) => option.setName('token').setDescription('Controlpanel.gg token.'))
.addNumberOption((option) => option.setName('rate').setDescription('Credits rate.'))
.addNumberOption((option) =>
option.setName('minimum-length').setDescription('Minimum length for credits.')
)
.addNumberOption((option) =>
option.setName('work-rate').setDescription('Work rate (rate).')
)
.addNumberOption((option) =>
option
.addNumberOption((option) => option.setName('minimum-length').setDescription('Minimum length for credits.'))
.addNumberOption((option) => option.setName('work-rate').setDescription('Work rate (rate).'))
.addNumberOption((option) => option
.setName('work-timeout')
.setDescription('Timeout between working for credits (milliseconds).')
)
.addNumberOption((option) =>
option.setName('timeout').setDescription('Timeout between credits (milliseconds).')
)
)
.setDescription('Timeout between working for credits (milliseconds).'))
.addNumberOption((option) => option.setName('timeout').setDescription('Timeout between credits (milliseconds).')))
.addSubcommand((subcommand) => subcommand.setName('work').setDescription('Work for credits.')),
async execute(interaction) {
const guild = await guilds.findOne({ guildId: interaction.member.guild.id });