mirror of
https://github.com/danbulant/Shasha
synced 2026-05-24 12:22:00 +00:00
use: setOnInsert
This commit is contained in:
parent
51b70ea2f7
commit
3f02eb70d0
2 changed files with 5 additions and 5 deletions
|
|
@ -36,13 +36,13 @@ module.exports = class quoteotd extends commando.Command {
|
|||
if (!this.client.channels.cache.get(data)) {
|
||||
return trySend(this.client, msg, 'Invalid/unknown channel provided! Try mentioning a channel or use `ChannelID`');
|
||||
} else {
|
||||
col.updateOne({document: msg.guild.id}, {$set: {"settings.quoteOTD.channel": data}}, { upsert: true });
|
||||
col.updateOne({document: msg.guild.id}, {$set: {"settings.quoteOTD.channel": data}, $setOnInsert: { document: msg.guild.id }}, { upsert: true });
|
||||
result = result+`Channel set to \`${this.client.channels.cache.get(data).name}\`\n`;
|
||||
}
|
||||
}
|
||||
if (startW.startsWith('text')) {
|
||||
data = arr.slice('text'.length).trim();
|
||||
col.updateOne({document: msg.guild.id}, {$set: {"settings.quoteOTD.footerText": data}}, { upsert: true });
|
||||
col.updateOne({document: msg.guild.id}, {$set: {"settings.quoteOTD.footerText": data}, $setOnInsert: { document: msg.guild.id }}, { upsert: true });
|
||||
result = result+`Footer text set to \`${data}\`\n`;
|
||||
}
|
||||
if (startW.startsWith('icon')) {
|
||||
|
|
@ -50,7 +50,7 @@ module.exports = class quoteotd extends commando.Command {
|
|||
if (!/^http/.test(data)) {
|
||||
return trySend(this.client, msg, 'Invalid icon url provided!');
|
||||
} else {
|
||||
col.updateOne({document: msg.guild.id}, {$set: {"settings.quoteOTD.footerIcon": data}}, { upsert: true });
|
||||
col.updateOne({document: msg.guild.id}, {$set: {"settings.quoteOTD.footerIcon": data}, $setOnInsert: { document: msg.guild.id }}, { upsert: true });
|
||||
result = result+`Footer icon set!\n`;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@ module.exports = class setfootq extends commando.Command {
|
|||
}
|
||||
async run(msg, args) {
|
||||
try {
|
||||
if (!msg.guild?.member(msg.author).hasPermission("MANAGE_GUILD" && !this.client.owners.includes(msg.author))) {
|
||||
if (msg.guild ? !msg.guild.member(msg.author).hasPermission("MANAGE_GUILD") : false && !this.client.owners.includes(msg.author.id)) {
|
||||
return trySend(this.client, msg, 'No lol');
|
||||
}
|
||||
const data = msg.guild ? "Guild" : "User";
|
||||
const col = database.collection(data);
|
||||
const doc = msg.guild?.id ?? msg.author.id;
|
||||
const oldQ = await col.findOne({document: doc});
|
||||
col.updateOne({document: doc}, {$set: {"settings.defaultEmbed.footerQuote": args.trim()}}, { upsert: true }, async (e) => {
|
||||
col.updateOne({document: doc}, {$set: {"settings.defaultEmbed.footerQuote": args.trim()}, $setOnInsert: { document: msg.guild?.id ?? msg.author.id }}, { upsert: true }, async (e) => {
|
||||
if (e) {
|
||||
return errLog(e, msg, this.client);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue