Skip to content

Commit

Permalink
fix: check if the key is a decimal in checkScript
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtekgrinder committed Feb 8, 2024
1 parent 7c87d33 commit 4849f2a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion utils/checkRoles.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ const getChannel = (discordClient, channelName) => {
);
};

const isDecimal = (s) => {
s = s.toString();
var regex = /^[0-9]*\.?[0-9]+$/;
return regex.test(s) && !isNaN(parseFloat(s)) && isFinite(s);
}

const rolesChannel = "roles-on-chain";

const client = new Client({
Expand All @@ -33,7 +39,7 @@ client.on("ready", async () => {
let message = "";
await Promise.all(
keys.map(async (key) => {
if (!isNaN(parseInt(key))) {
if (!isDecimal(key)) {
message += `\n👨‍🎤 **Actor: ${key}**\n`;
const actorKeys = Object.keys(roles[chain][key]);
await Promise.all(
Expand Down

0 comments on commit 4849f2a

Please sign in to comment.