Last active
June 8, 2023 16:03
-
-
Save qwertyad1/c788354205b0025b88986de11016f08b to your computer and use it in GitHub Desktop.
This is some code for the assyst discord bot.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function maxIdx(list) { | |
| let maxNumber = -Infinity; | |
| let maxIndex = -1; | |
| for (let i = 0; i < list.length; i++) { | |
| if (list[i] > maxNumber) { | |
| maxNumber = list[i]; | |
| maxIndex = i; | |
| } | |
| } | |
| return { max: maxNumber, index: maxIndex }; | |
| } | |
| fetch( "https://arewepomeloyet.com/api/v1/pomelos" ).then(r => JSON.parse(r.text()).stats).then(function (data) { | |
| let l = data.length | |
| let a = [] | |
| let o = 0 | |
| let c = 0 | |
| while (l > 0) { | |
| c = c + data[o].totalCount | |
| a.push(data[o].totalCount) | |
| o = o + 1 | |
| l = l - 1 | |
| } | |
| let m = maxIdx(a) | |
| return ` | |
| \`\`\`There are more than ${c} discord users with pomelo usernames.\`\`\` | |
| \`\`\`The most common account date is ${data[m.index].date} with ${m.max} users with pomelo\`\`\` | |
| \`\`\`if you have any suggestions, comment on my github gists page:\`\`\` | |
| > <https://gist.github.com/qwertykid/c788354205b0025b88986de11016f08b> | |
| ` | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if you want to set this up in your server use the command
you can then use the command with
-t pomelo-countif you dont have the bot click here.