feat(plugins): Remove ChatBar Button Properly

This commit is contained in:
thororen1234 2024-12-01 20:49:54 -05:00
parent 847a32765f
commit 4c9908c647
3 changed files with 8 additions and 11 deletions

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { addChatBarButton, ChatBarButton } from "@api/ChatButtons"; import { addChatBarButton, ChatBarButton, removeChatBarButton } from "@api/ChatButtons";
import { import {
ApplicationCommandInputType, ApplicationCommandInputType,
ApplicationCommandOptionType, ApplicationCommandOptionType,
@ -12,7 +12,6 @@ import {
} from "@api/Commands"; } from "@api/Commands";
import * as DataStore from "@api/DataStore"; import * as DataStore from "@api/DataStore";
import { addPreSendListener, removePreSendListener, SendListener } from "@api/MessageEvents"; import { addPreSendListener, removePreSendListener, SendListener } from "@api/MessageEvents";
import { removeButton } from "@api/MessagePopover";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { sleep } from "@utils/misc"; import { sleep } from "@utils/misc";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
@ -273,7 +272,7 @@ export default definePlugin({
await DataStore.set("encryptcordGroupMembers", {}); await DataStore.set("encryptcordGroupMembers", {});
}, },
async stop() { async stop() {
removeButton("Encryptcord"); removeChatBarButton("Encryptcord");
if (await DataStore.get("encryptcordGroup") === true) { if (await DataStore.get("encryptcordGroup") === true) {
await leave("", { channel: { id: await DataStore.get("encryptcordChannelId") } }); await leave("", { channel: { id: await DataStore.get("encryptcordChannelId") } });
} }

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { addChatBarButton, ChatBarButton } from "@api/ChatButtons"; import { addChatBarButton, ChatBarButton, removeChatBarButton } from "@api/ChatButtons";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { getCurrentChannel, sendMessage } from "@utils/discord"; import { getCurrentChannel, sendMessage } from "@utils/discord";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
@ -27,7 +27,6 @@ export default definePlugin({
description: "Adds a chatbar button to meow in chat", description: "Adds a chatbar button to meow in chat",
authors: authors:
[Devs.Samwich], [Devs.Samwich],
start() { start: () => addChatBarButton("Meow", ChatBarIcon),
addChatBarButton("vc-meow", ChatBarIcon); stop: () => removeChatBarButton("Meow")
}
}); });

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { addChatBarButton, ChatBarButton } from "@api/ChatButtons"; import { addChatBarButton, ChatBarButton, removeChatBarButton } from "@api/ChatButtons";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { getCurrentChannel, sendMessage } from "@utils/discord"; import { getCurrentChannel, sendMessage } from "@utils/discord";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
@ -26,7 +26,6 @@ export default definePlugin({
name: "Woof", name: "Woof",
description: "Adds a chatbar button to woof in chat", description: "Adds a chatbar button to woof in chat",
authors: [Devs.Samwich], authors: [Devs.Samwich],
start() { start: () => addChatBarButton("Woof", ChatBarIcon),
addChatBarButton("vc-woof", ChatBarIcon); stop: () => removeChatBarButton("Woof")
}
}); });