Archivos de Código
!cuestionario
$onInteraction
$nomention
$onlyIf[$checkContains[$customID;si;no;finalizar]==true;]
$jsonParse[$getUserVar[encuesta;$botID;$guildID]]
$if[$customID==si]
$if[$checkContains[$json[no;voteUsers];$authorID]==true]
$jsonSetString[no;voteUsers;$replaceText[$json[no;voteUsers];$authorID.;;-1]]
$jsonSetString[no;cant;$calculate[$json[no;cant] - 1]]
$endif
$if[$checkContains[$json[yes;voteUsers];$authorID]==false]
$jsonSetString[yes;voteUsers;$json[yes;voteUsers]$authorID.]
$jsonSetString[yes;cant;$calculate[$json[yes;cant] + 1]]
$else
$jsonSetString[yes;voteUsers;$replaceText[$json[yes;voteUsers];$authorID.;;-1]]
$jsonSetString[yes;cant;$calculate[$json[yes;cant] - 1]]
$endif
$title[$getEmbedData[$channelID;$messageID;1;title]]
$description[$getEmbedData[$channelID;$messageID;1;description]]
$color[ffffff]
$removeButtons
$addButton[no;si;Sí ($json[yes;cant]);success;no;]
$addButton[no;no;No ($json[no;cant]);danger;no;]
$addButton[no;finalizar;Finalizar encuesta;primary;no]
$setUserVar[encuesta;$jsonStringify;$botID;$guildID]
$endif
$if[$customID==no]
$if[$checkContains[$json[yes;voteUsers];$authorID]==true]
$jsonSetString[yes;voteUsers;$replaceText[$json[yes;voteUsers];$authorID.;;-1]]
$jsonSetString[yes;cant;$calculate[$json[yes;cant] - 1]]
$endif
$if[$checkContains[$json[no;voteUsers];$authorID]==false]
$jsonSetString[no;voteUsers;$json[no;voteUsers]$authorID.]
$jsonSetString[no;cant;$calculate[$json[no;cant] + 1]]
$else
$jsonSetString[no;voteUsers;$replaceText[$json[no;voteUsers];$authorID.;;-1]]
$jsonSetString[no;cant;$calculate[$json[no;cant] - 1]]
$stop
$endif
$title[$getEmbedData[$channelID;$messageID;1;title]]
$description[$getEmbedData[$channelID;$messageID;1;description]]
$color[ffffff]
$removeButtons
$addButton[no;si;Sí ($json[yes;cant]);success;no;]
$addButton[no;no;No ($json[no;cant]);danger;no;]
$addButton[no;finalizar;Finalizar encuesta;primary;no]
$setUserVar[encuesta;$jsonStringify;$botID;$guildID]
$endif
$if[$customID==finalizar]
$if[$checkUserPerms[$authorID;managechannels]==false]
$ephemeral
$removeAllComponents
Necesitas el permiso `Gestionar canales` para terminar esta encuesta.
$stop
$endif
$if[$json[yes;cant]>$json[no;cant]]
$var[final;Gano "Sí"]
$elseif[$json[yes;cant]<$json[no;cant]]
$var[final;Gano "No"]
$elseif[$json[yes;cant]==$json[no;cant]]
$var[final;Quedó empate]
$endif
$removeAllComponents
$title[Encuesta finalizada.]
$description[$getEmbedData[$channelID;$messageID;1;description]]
$addField[Valores finales:;
Si: $json[yes;cant]
No: $json[no;cant]
Resultado: $var[final]]
$color[ffffff]
$setUserVar[encuesta;{};$botID;$guildID]
$endif
Comentarios (1)
Inicia sesión para comentar
Aura ✋🥸🤚