fixed lacking perms on welcome role error + prevent welcome channel with no values
This commit is contained in:
parent
abb234e776
commit
0b7798a700
@ -168,25 +168,22 @@ export class CreateTicketSystem {
|
|||||||
await threadChannel.members.add(owner)
|
await threadChannel.members.add(owner)
|
||||||
|
|
||||||
// close interaction
|
// close interaction
|
||||||
await interaction.reply({
|
await interaction.editReply({
|
||||||
embeds: [
|
embeds: [
|
||||||
ticketCreatedEmbed({
|
ticketCreatedEmbed({
|
||||||
username: interaction.user.username,
|
username: interaction.user.username,
|
||||||
threadChannelId: threadChannel.id,
|
threadChannelId: threadChannel.id,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
ephemeral: true,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ButtonComponent({ id: 'close-btn' })
|
@ButtonComponent({ id: 'close-btn' })
|
||||||
async closeBtn(interaction: ButtonInteraction): Promise<void> {
|
async closeBtn(interaction: ButtonInteraction): Promise<void> {
|
||||||
await interaction.deferReply({ ephemeral: true })
|
|
||||||
if (!interaction.channel) {
|
if (!interaction.channel) {
|
||||||
await interaction.editReply('❌ Ticket channel does not exist')
|
await interaction.editReply('❌ Ticket channel does not exist')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
await interaction.channel.delete()
|
await interaction.channel.delete()
|
||||||
await interaction.editReply('Deleted ticket')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Discord, Slash, SlashOption } from 'discordx'
|
import { Client, Discord, Slash, SlashOption } from 'discordx'
|
||||||
import {
|
import {
|
||||||
ApplicationCommandOptionType,
|
ApplicationCommandOptionType,
|
||||||
CommandInteraction,
|
CommandInteraction,
|
||||||
@ -7,6 +7,7 @@ import {
|
|||||||
} from 'discord.js'
|
} from 'discord.js'
|
||||||
import { db, DBTableEnum } from '../../db'
|
import { db, DBTableEnum } from '../../db'
|
||||||
import { logger } from '../../lib'
|
import { logger } from '../../lib'
|
||||||
|
import { Workload } from '../../utils'
|
||||||
|
|
||||||
@Discord()
|
@Discord()
|
||||||
export class SetWelcomeChannel {
|
export class SetWelcomeChannel {
|
||||||
@ -33,6 +34,31 @@ export class SetWelcomeChannel {
|
|||||||
interaction: CommandInteraction,
|
interaction: CommandInteraction,
|
||||||
) {
|
) {
|
||||||
await interaction.deferReply({ ephemeral: true })
|
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
|
await db
|
||||||
.set(DBTableEnum.WELCOME_CHANNEL, channel.id)
|
.set(DBTableEnum.WELCOME_CHANNEL, channel.id)
|
||||||
.catch(async () => {
|
.catch(async () => {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { ArgsOf, Discord, On } from 'discordx'
|
import { ArgsOf, Discord, On } from 'discordx'
|
||||||
import { EmbedBuilder, channelMention, userMention } from 'discord.js'
|
import { EmbedBuilder, channelMention, userMention } from 'discord.js'
|
||||||
import { db, DBTableEnum } from '../db'
|
import { db, DBTableEnum } from '../db'
|
||||||
|
import { logger } from '../lib'
|
||||||
|
|
||||||
@Discord()
|
@Discord()
|
||||||
export class GuildMemberAdd {
|
export class GuildMemberAdd {
|
||||||
@ -34,7 +35,11 @@ export class GuildMemberAdd {
|
|||||||
content: `What's up, ${userMention(member.id)}`,
|
content: `What's up, ${userMention(member.id)}`,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
try {
|
||||||
await member.roles.add(role)
|
await member.roles.add(role)
|
||||||
|
} catch (e) {
|
||||||
|
logger.error('Role is too high', 'Bot role must be higher than the role it gives')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ export const bot = new Client({
|
|||||||
|
|
||||||
presence: {
|
presence: {
|
||||||
status: 'online',
|
status: 'online',
|
||||||
activities: [{ name: 'Designing...', type: 3 }],
|
activities: [{ name: 'Designing stuff', type: 4 }],
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ export function paymentsEmbed() {
|
|||||||
{
|
{
|
||||||
name: 'Crypto:',
|
name: 'Crypto:',
|
||||||
value:
|
value:
|
||||||
'Wallet number: `TRdGKNPABvoTrdwHgfUTX65DbqbguTh6cc`\n' +
|
'Wallet number: `TEsLTpQnTgMHw4J1RaQHheYbCfuADXRns8`\n' +
|
||||||
'Crypto name: `USDT`\n' +
|
'Crypto name: `USDT`\n' +
|
||||||
'Network name: `TRC20`',
|
'Network name: `TRC20`',
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user