mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-24 23:38:32 +00:00
Made join button unspammable
This commit is contained in:
parent
0ffe846cf6
commit
1237687e07
1 changed files with 5 additions and 1 deletions
|
@ -41,6 +41,7 @@ interface IMessageCreate {
|
|||
// Chat Bar Icon Component
|
||||
const ChatBarIcon: ChatBarButton = ({ isMainChat }) => {
|
||||
[enabled, setEnabled] = useState(false);
|
||||
let [buttonDisabled, setButtonDisabled] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const listener: SendListener = async (_, message) => {
|
||||
|
@ -78,6 +79,7 @@ const ChatBarIcon: ChatBarButton = ({ isMainChat }) => {
|
|||
tooltip={enabled ? "Send Unencrypted Messages" : "Send Encrypted Messages"}
|
||||
onClick={async () => {
|
||||
if (await DataStore.get('encryptcordGroup') == false || (await DataStore.get('encryptcordChannelId') != getCurrentChannel().id)) {
|
||||
setButtonDisabled(true);
|
||||
await sendTempMessage(getCurrentChannel().id, "", `join\`\`\`\n${await DataStore.get("encryptcordPublicKey")}\`\`\``, false);
|
||||
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>` });
|
||||
await sleep(5000);
|
||||
|
@ -90,12 +92,14 @@ const ChatBarIcon: ChatBarButton = ({ isMainChat }) => {
|
|||
await startGroup("", { channel: { id: getCurrentChannel().id } });
|
||||
}
|
||||
setEnabled(!enabled);
|
||||
setButtonDisabled(false);
|
||||
}}
|
||||
buttonProps={{
|
||||
style: {
|
||||
transition: 'transform 0.3s ease-in-out',
|
||||
transform: `rotate(${enabled ? 0 : 15}deg)`,
|
||||
}
|
||||
},
|
||||
disabled: buttonDisabled
|
||||
}}
|
||||
>
|
||||
<svg
|
||||
|
|
Loading…
Add table
Reference in a new issue