mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 00:10:58 -05:00
Update suggestion schema
This commit is contained in:
parent
9aca68efa4
commit
796360e6dc
@ -30,7 +30,7 @@ export default {
|
|||||||
console.log(e.message);
|
console.log(e.message);
|
||||||
interaction.reply({content: 'Failed to send suggestion, try again later.', ephemeral: true})
|
interaction.reply({content: 'Failed to send suggestion, try again later.', ephemeral: true})
|
||||||
})
|
})
|
||||||
await client.suggestion._content.create({_id: suggestionID, idea: suggestionText, user: {_id: interaction.user.id, tag: interaction.user.username}, state: 'Pending'});
|
await client.suggestion._content.create({_id: suggestionID, idea: suggestionText, user: {_id: interaction.user.id, name: interaction.user.username}, state: 'Pending'});
|
||||||
interaction.reply({content: `Suggestion sent, here is your suggestion ID to take note of it: \`${suggestionID}\``, ephemeral: true})
|
interaction.reply({content: `Suggestion sent, here is your suggestion ID to take note of it: \`${suggestionID}\``, ephemeral: true})
|
||||||
},
|
},
|
||||||
approve: async()=>{
|
approve: async()=>{
|
||||||
@ -42,7 +42,7 @@ export default {
|
|||||||
.setColor(client.config.embedColorGreen)
|
.setColor(client.config.embedColorGreen)
|
||||||
.setAuthor({name: interaction.user.username, iconURL: interaction.user.avatarURL({size: 256})})
|
.setAuthor({name: interaction.user.username, iconURL: interaction.user.avatarURL({size: 256})})
|
||||||
.setTitle('Your suggestion has been approved.')
|
.setTitle('Your suggestion has been approved.')
|
||||||
.setDescription(`> **Your suggestion:**\n${theirIdea}\n> **Their message:**\n${replyInDM.length === null ? '*No message from them.*' : replyInDM}`)
|
.setDescription(`> **Your suggestion:**\n${theirIdea}\n> **Their message:**\n${replyInDM}`)
|
||||||
.setFooter({text: `Timestamp: ${timeFormatting} | Suggestion ID: ${suggestionIDReply}`})
|
.setFooter({text: `Timestamp: ${timeFormatting} | Suggestion ID: ${suggestionIDReply}`})
|
||||||
]}).catch((err:Discord.DiscordjsErrorCodes)=>{if (err) return (client.channels.resolve('1040018521746325586') as Discord.TextChannel).send(dmFail)});
|
]}).catch((err:Discord.DiscordjsErrorCodes)=>{if (err) return (client.channels.resolve('1040018521746325586') as Discord.TextChannel).send(dmFail)});
|
||||||
await client.suggestion._content.findByIdAndUpdate(suggestionIDReply, {state: 'Approved'});
|
await client.suggestion._content.findByIdAndUpdate(suggestionIDReply, {state: 'Approved'});
|
||||||
@ -57,7 +57,7 @@ export default {
|
|||||||
.setColor(client.config.embedColorRed)
|
.setColor(client.config.embedColorRed)
|
||||||
.setAuthor({name: interaction.user.username, iconURL: interaction.user.avatarURL({size: 256})})
|
.setAuthor({name: interaction.user.username, iconURL: interaction.user.avatarURL({size: 256})})
|
||||||
.setTitle('Your suggestion has been rejected.')
|
.setTitle('Your suggestion has been rejected.')
|
||||||
.setDescription(`> **Your suggestion:**\n${theirIdea}\n> **Their message:**\n${replyInDM.length === null ? '*No message from them.*' : replyInDM}`)
|
.setDescription(`> **Your suggestion:**\n${theirIdea}\n> **Their message:**\n${replyInDM}`)
|
||||||
.setFooter({text: `Timestamp: ${timeFormatting} | Suggestion ID: ${suggestionIDReply}`})
|
.setFooter({text: `Timestamp: ${timeFormatting} | Suggestion ID: ${suggestionIDReply}`})
|
||||||
]}).catch((err:Discord.DiscordjsErrorCodes)=>{if (err) return (client.channels.resolve('1040018521746325586') as Discord.TextChannel).send(dmFail)});
|
]}).catch((err:Discord.DiscordjsErrorCodes)=>{if (err) return (client.channels.resolve('1040018521746325586') as Discord.TextChannel).send(dmFail)});
|
||||||
await client.suggestion._content.findByIdAndUpdate(suggestionIDReply, {state: 'Rejected'});
|
await client.suggestion._content.findByIdAndUpdate(suggestionIDReply, {state: 'Rejected'});
|
||||||
@ -89,6 +89,7 @@ export default {
|
|||||||
.addStringOption(x=>x
|
.addStringOption(x=>x
|
||||||
.setName('message')
|
.setName('message')
|
||||||
.setDescription('(Optional) Include a message with your approval')
|
.setDescription('(Optional) Include a message with your approval')
|
||||||
|
.setRequired(true)
|
||||||
.setMaxLength(256)))
|
.setMaxLength(256)))
|
||||||
.addSubcommand(x=>x
|
.addSubcommand(x=>x
|
||||||
.setName('reject')
|
.setName('reject')
|
||||||
@ -100,5 +101,6 @@ export default {
|
|||||||
.addStringOption(x=>x
|
.addStringOption(x=>x
|
||||||
.setName('message')
|
.setName('message')
|
||||||
.setDescription('(Optional) Include a message with your rejection')
|
.setDescription('(Optional) Include a message with your rejection')
|
||||||
|
.setRequired(true)
|
||||||
.setMaxLength(256)))
|
.setMaxLength(256)))
|
||||||
}
|
}
|
@ -5,7 +5,7 @@ const Schema = mongoose.model('suggestion', new mongoose.Schema({
|
|||||||
_id: {type: String, required:true},
|
_id: {type: String, required:true},
|
||||||
idea: {type: String, required:true},
|
idea: {type: String, required:true},
|
||||||
user: {required:true, type: new mongoose.Schema({
|
user: {required:true, type: new mongoose.Schema({
|
||||||
tag: {type: String},
|
name: {type: String},
|
||||||
_id: {type: String}
|
_id: {type: String}
|
||||||
}, {versionKey: false})},
|
}, {versionKey: false})},
|
||||||
state: {type: String, required:true}
|
state: {type: String, required:true}
|
||||||
|
Loading…
Reference in New Issue
Block a user