diff --git a/src/utils/misc.ts b/src/utils/misc.ts index 28c371c5b..ef6eff92c 100644 --- a/src/utils/misc.ts +++ b/src/utils/misc.ts @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import { Clipboard, Toasts } from "@webpack/common"; +import { Clipboard, ToastData, Toasts } from "@webpack/common"; import { DevsById } from "./constants"; @@ -36,15 +36,19 @@ export function sleep(ms: number): Promise { } export function copyWithToast(text: string, toastMessage = "Copied to clipboard!") { + const opts: Pick = { + message: toastMessage, + type: Toasts.Type.SUCCESS + }; if (Clipboard.SUPPORTS_COPY) { Clipboard.copy(text); } else { - toastMessage = "Your browser does not support copying to clipboard"; + opts.message = "Your browser does not support copying to clipboard"; + opts.type = Toasts.Type.FAILURE; } Toasts.show({ - message: toastMessage, id: Toasts.genId(), - type: Toasts.Type.SUCCESS + ...opts }); }