mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-15 01:23:03 -04:00
Ignore Some Typing
This commit is contained in:
parent
54c3b33315
commit
d79aa162d2
3 changed files with 10 additions and 0 deletions
|
@ -50,7 +50,9 @@ const ChatBarIcon: ChatBarButton = ({ isMainChat }) => {
|
||||||
const listener: SendListener = async (_, message) => {
|
const listener: SendListener = async (_, message) => {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
const groupChannel = await DataStore.get("encryptcordChannelId");
|
const groupChannel = await DataStore.get("encryptcordChannelId");
|
||||||
|
// @ts-expect-error typing issue
|
||||||
if (getCurrentChannel().id !== groupChannel) {
|
if (getCurrentChannel().id !== groupChannel) {
|
||||||
|
// @ts-expect-error typing issue
|
||||||
sendBotMessage(getCurrentChannel().id, { content: `You must be in <#${groupChannel}> to send an encrypted message!\n> If you wish to send an unencrypted message, please click the button in the chatbar.` });
|
sendBotMessage(getCurrentChannel().id, { content: `You must be in <#${groupChannel}> to send an encrypted message!\n> If you wish to send an unencrypted message, please click the button in the chatbar.` });
|
||||||
message.content = "";
|
message.content = "";
|
||||||
return;
|
return;
|
||||||
|
@ -81,18 +83,24 @@ const ChatBarIcon: ChatBarButton = ({ isMainChat }) => {
|
||||||
<ChatBarButton
|
<ChatBarButton
|
||||||
tooltip={enabled ? "Send Unencrypted Messages" : "Send Encrypted Messages"}
|
tooltip={enabled ? "Send Unencrypted Messages" : "Send Encrypted Messages"}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
|
// @ts-expect-error typing issue
|
||||||
if (await DataStore.get("encryptcordGroup") === false || (await DataStore.get("encryptcordChannelId") !== getCurrentChannel().id)) {
|
if (await DataStore.get("encryptcordGroup") === false || (await DataStore.get("encryptcordChannelId") !== getCurrentChannel().id)) {
|
||||||
setButtonDisabled(true);
|
setButtonDisabled(true);
|
||||||
|
// @ts-expect-error typing issue
|
||||||
await sendTempMessage(getCurrentChannel().id, "", `join\`\`\`\n${await DataStore.get("encryptcordPublicKey")}\`\`\``, false);
|
await sendTempMessage(getCurrentChannel().id, "", `join\`\`\`\n${await DataStore.get("encryptcordPublicKey")}\`\`\``, false);
|
||||||
|
// @ts-expect-error typing issue
|
||||||
sendBotMessage(getCurrentChannel().id, { content: `*Checking for any groups in this channel...*\n> If none is found, a new one will be created <t:${Math.floor(Date.now() / 1000) + 5}:R>\n> [Tip] You can do \`/encryptcord leave\` to leave a group` });
|
sendBotMessage(getCurrentChannel().id, { content: `*Checking for any groups in this channel...*\n> If none is found, a new one will be created <t:${Math.floor(Date.now() / 1000) + 5}:R>\n> [Tip] You can do \`/encryptcord leave\` to leave a group` });
|
||||||
await sleep(5000);
|
await sleep(5000);
|
||||||
|
// @ts-expect-error typing issue
|
||||||
if (await DataStore.get("encryptcordGroup") === true && (await DataStore.get("encryptcordChannelId") !== getCurrentChannel().id)) {
|
if (await DataStore.get("encryptcordGroup") === true && (await DataStore.get("encryptcordChannelId") !== getCurrentChannel().id)) {
|
||||||
|
// @ts-expect-error typing issue
|
||||||
sendBotMessage(getCurrentChannel().id, { content: "*Leaving current group...*" });
|
sendBotMessage(getCurrentChannel().id, { content: "*Leaving current group...*" });
|
||||||
await leave("", { channel: { id: await DataStore.get("encryptcordChannelId") } });
|
await leave("", { channel: { id: await DataStore.get("encryptcordChannelId") } });
|
||||||
} else if (await DataStore.get("encryptcordGroup") === true) {
|
} else if (await DataStore.get("encryptcordGroup") === true) {
|
||||||
setButtonDisabled(false);
|
setButtonDisabled(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// @ts-expect-error typing issue
|
||||||
await startGroup("", { channel: { id: getCurrentChannel().id } });
|
await startGroup("", { channel: { id: getCurrentChannel().id } });
|
||||||
}
|
}
|
||||||
setEnabled(!enabled);
|
setEnabled(!enabled);
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { getCurrentChannel, sendMessage } from "@utils/discord";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
|
|
||||||
async function handleButtonClick() {
|
async function handleButtonClick() {
|
||||||
|
// @ts-expect-error typing issue
|
||||||
sendMessage(getCurrentChannel().id, { content: "meow" });
|
sendMessage(getCurrentChannel().id, { content: "meow" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -256,6 +256,7 @@ async function SendInChat(onClose) {
|
||||||
const preview = generateFileNamePreview(recentmessage.content);
|
const preview = generateFileNamePreview(recentmessage.content);
|
||||||
const imageName = `${preview} - ${recentmessage.author.username}`;
|
const imageName = `${preview} - ${recentmessage.author.username}`;
|
||||||
const file = new File([image], `${imageName}.png`, { type: "image/png" });
|
const file = new File([image], `${imageName}.png`, { type: "image/png" });
|
||||||
|
// @ts-expect-error typing issue
|
||||||
UploadHandler.promptToUpload([file], getCurrentChannel(), 0);
|
UploadHandler.promptToUpload([file], getCurrentChannel(), 0);
|
||||||
onClose();
|
onClose();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue