mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-25 07:48: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
|
// Chat Bar Icon Component
|
||||||
const ChatBarIcon: ChatBarButton = ({ isMainChat }) => {
|
const ChatBarIcon: ChatBarButton = ({ isMainChat }) => {
|
||||||
[enabled, setEnabled] = useState(false);
|
[enabled, setEnabled] = useState(false);
|
||||||
|
let [buttonDisabled, setButtonDisabled] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const listener: SendListener = async (_, message) => {
|
const listener: SendListener = async (_, message) => {
|
||||||
|
@ -78,6 +79,7 @@ const ChatBarIcon: ChatBarButton = ({ isMainChat }) => {
|
||||||
tooltip={enabled ? "Send Unencrypted Messages" : "Send Encrypted Messages"}
|
tooltip={enabled ? "Send Unencrypted Messages" : "Send Encrypted Messages"}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
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);
|
||||||
await sendTempMessage(getCurrentChannel().id, "", `join\`\`\`\n${await DataStore.get("encryptcordPublicKey")}\`\`\``, false);
|
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>` });
|
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);
|
await sleep(5000);
|
||||||
|
@ -90,12 +92,14 @@ const ChatBarIcon: ChatBarButton = ({ isMainChat }) => {
|
||||||
await startGroup("", { channel: { id: getCurrentChannel().id } });
|
await startGroup("", { channel: { id: getCurrentChannel().id } });
|
||||||
}
|
}
|
||||||
setEnabled(!enabled);
|
setEnabled(!enabled);
|
||||||
|
setButtonDisabled(false);
|
||||||
}}
|
}}
|
||||||
buttonProps={{
|
buttonProps={{
|
||||||
style: {
|
style: {
|
||||||
transition: 'transform 0.3s ease-in-out',
|
transition: 'transform 0.3s ease-in-out',
|
||||||
transform: `rotate(${enabled ? 0 : 15}deg)`,
|
transform: `rotate(${enabled ? 0 : 15}deg)`,
|
||||||
}
|
},
|
||||||
|
disabled: buttonDisabled
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
|
|
Loading…
Add table
Reference in a new issue