mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-06-16 19:15:03 +00:00
fix: role buttons being re-sent
This commit is contained in:
parent
27474375c3
commit
0aae70561c
1 changed files with 2 additions and 1 deletions
|
@ -8,7 +8,8 @@ export async function applyAllRoleButtons(pluginData: GuildPluginData<RoleButton
|
||||||
const config = pluginData.config.get();
|
const config = pluginData.config.get();
|
||||||
for (const [configName, configItem] of Object.entries(config.buttons)) {
|
for (const [configName, configItem] of Object.entries(config.buttons)) {
|
||||||
// Use the hash of the config to quickly check if we need to update buttons
|
// Use the hash of the config to quickly check if we need to update buttons
|
||||||
const hash = createHash("md5").update(JSON.stringify(configItem)).digest("hex");
|
const configItemToHash = { ...configItem, name: configName }; // Add name property for backwards compatibility
|
||||||
|
const hash = createHash("md5").update(JSON.stringify(configItemToHash)).digest("hex");
|
||||||
const savedButtonsItem = savedRoleButtons.find((bt) => bt.name === configName);
|
const savedButtonsItem = savedRoleButtons.find((bt) => bt.name === configName);
|
||||||
if (savedButtonsItem?.hash === hash) {
|
if (savedButtonsItem?.hash === hash) {
|
||||||
// No changes
|
// No changes
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue