Bug fix so message updates will create guild entry
This commit is contained in:
parent
f7230ec0fb
commit
3c01d37bd5
@ -134,18 +134,28 @@ module.exports = {
|
||||
return queryParts.join('');
|
||||
break;
|
||||
case "setTreeMessage":
|
||||
// queryParts = [
|
||||
// `UPDATE guild_info SET tree_message_id = ${db.escape(this.treeMessageId)}, `,
|
||||
// `tree_channel_id = ${db.escape(this.treeChannelId)} `,
|
||||
// `WHERE guild_id = ${db.escape(this.guildId)}`
|
||||
// ];
|
||||
queryParts = [
|
||||
`UPDATE guild_info SET tree_message_id = ${db.escape(this.treeMessageId)}, `,
|
||||
`tree_channel_id = ${db.escape(this.treeChannelId)} `,
|
||||
`WHERE guild_id = ${db.escape(this.guildId)}`
|
||||
`INSERT INTO guild_info (guild_id, tree_message_id, tree_channel_id)`,
|
||||
`VALUES (${db.escape(this.guildId)}, ${db.escape(this.treeMessageId)}, ${db.escape(this.treeChannelId)})`,
|
||||
`ON DUPLICATE KEY UPDATE tree_message_id = ${db.escape(this.treeMessageId)}, tree_channel_id = ${db.escape(this.treeChannelId)}`
|
||||
];
|
||||
return queryParts.join('');
|
||||
break;
|
||||
case "setLeaderboardMessage":
|
||||
// queryParts = [
|
||||
// `UPDATE guild_info SET leaderboard_message_id = ${db.escape(this.leaderboardMessageId)}, `,
|
||||
// `leaderboard_channel_id = ${db.escape(this.leaderboardChannelId)} `,
|
||||
// `WHERE guild_id = ${db.escape(this.guildId)}`
|
||||
// ];
|
||||
queryParts = [
|
||||
`UPDATE guild_info SET leaderboard_message_id = ${db.escape(this.leaderboardMessageId)}, `,
|
||||
`leaderboard_channel_id = ${db.escape(this.leaderboardChannelId)} `,
|
||||
`WHERE guild_id = ${db.escape(this.guildId)}`
|
||||
`INSERT INTO guild_info (guild_id, leaderboard_message_id, leaderboard_channel_id)`,
|
||||
`VALUES (${db.escape(this.guildId)}, ${db.escape(this.leaderboardMessageId)}, ${db.escape(this.leaderboardChannelId)})`,
|
||||
`ON DUPLICATE KEY UPDATE leaderboard_message_id = ${db.escape(this.leaderboardMessageId)}, leaderboard_channel_id = ${db.escape(this.leaderboardChannelId)}`
|
||||
];
|
||||
return queryParts.join('');
|
||||
break;
|
||||
|
@ -686,6 +686,7 @@ const functions = {
|
||||
if (doDbUpdate) {
|
||||
const query = guildInfo.queryBuilder("setLeaderboardMessage");
|
||||
await dbfn.setGuildInfo(query);
|
||||
await functions.collectionBuilders.guildInfos(message.client);
|
||||
}
|
||||
await dbfn.uploadLeaderboard(isLeaderboard);
|
||||
// Update the comparison message
|
||||
@ -741,6 +742,7 @@ const functions = {
|
||||
if (doDbUpdate) {
|
||||
const query = guildInfo.queryBuilder("setTreeInfo");
|
||||
await dbfn.setGuildInfo(query);
|
||||
await functions.collectionBuilders.guildInfos(message.client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user