fixed lacking perms on welcome role error + prevent welcome channel with no values

This commit is contained in:
Danya H 2024-06-08 14:58:25 +01:00
parent abb234e776
commit 0b7798a700
5 changed files with 36 additions and 8 deletions

View File

@ -168,25 +168,22 @@ export class CreateTicketSystem {
await threadChannel.members.add(owner)
// close interaction
await interaction.reply({
await interaction.editReply({
embeds: [
ticketCreatedEmbed({
username: interaction.user.username,
threadChannelId: threadChannel.id,
}),
],
ephemeral: true,
})
}
@ButtonComponent({ id: 'close-btn' })
async closeBtn(interaction: ButtonInteraction): Promise<void> {
await interaction.deferReply({ ephemeral: true })
if (!interaction.channel) {
await interaction.editReply('❌ Ticket channel does not exist')
return
}
await interaction.channel.delete()
await interaction.editReply('Deleted ticket')
}
}

View File

@ -1,4 +1,4 @@
import { Discord, Slash, SlashOption } from 'discordx'
import { Client, Discord, Slash, SlashOption } from 'discordx'
import {
ApplicationCommandOptionType,
CommandInteraction,
@ -7,6 +7,7 @@ import {
} from 'discord.js'
import { db, DBTableEnum } from '../../db'
import { logger } from '../../lib'
import { Workload } from '../../utils'
@Discord()
export class SetWelcomeChannel {
@ -33,6 +34,31 @@ export class SetWelcomeChannel {
interaction: CommandInteraction,
) {
await interaction.deferReply({ ephemeral: true })
const portfolioChannelId = await db.get(DBTableEnum.PORTFOLIO_CHANNEL)
if (!portfolioChannelId) {
logger.error(
'Missing portfolio channel',
'Set using /set-portfolio-channel',
)
await interaction.editReply(
'❌ Missing portfolio channel\nSet using /set-portfolio-channel',
)
return
}
const orderChannelId = await db.get(DBTableEnum.MAKE_AN_ORDER_CHANNEL)
if (!orderChannelId) {
logger.error(
'Missing make an order channel',
'Set using /set-order-channel',
)
await interaction.editReply(
'❌ Missing make an order channel\nSet using /set-order-channel',
)
return
}
await db
.set(DBTableEnum.WELCOME_CHANNEL, channel.id)
.catch(async () => {

View File

@ -1,6 +1,7 @@
import { ArgsOf, Discord, On } from 'discordx'
import { EmbedBuilder, channelMention, userMention } from 'discord.js'
import { db, DBTableEnum } from '../db'
import { logger } from '../lib'
@Discord()
export class GuildMemberAdd {
@ -34,7 +35,11 @@ export class GuildMemberAdd {
content: `What's up, ${userMention(member.id)}`,
})
try {
await member.roles.add(role)
} catch (e) {
logger.error('Role is too high', 'Bot role must be higher than the role it gives')
}
}
}
}

View File

@ -22,7 +22,7 @@ export const bot = new Client({
presence: {
status: 'online',
activities: [{ name: 'Designing...', type: 3 }],
activities: [{ name: 'Designing stuff', type: 4 }],
},
})

View File

@ -5,7 +5,7 @@ export function paymentsEmbed() {
{
name: 'Crypto:',
value:
'Wallet number: `TRdGKNPABvoTrdwHgfUTX65DbqbguTh6cc`\n' +
'Wallet number: `TEsLTpQnTgMHw4J1RaQHheYbCfuADXRns8`\n' +
'Crypto name: `USDT`\n' +
'Network name: `TRC20`',
},