Merge pull request #2 from voidf1sh/v1.0.2-dev

This commit is contained in:
Skylar Grant 2023-01-23 18:16:34 -05:00 committed by GitHub
commit 37c0436b51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 10 deletions

View File

@ -19,8 +19,8 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Build the Docker image - name: Build the Docker image
run: docker build . --file Dockerfile --tag v0idf1sh/treeanalyzer run: docker build . --file Dockerfile --tag v0idf1sh/silvanus
- name: Log into Docker Hub - name: Log into Docker Hub
run: docker login -u $DHUB_UNAME -p $DHUB_PWORD run: docker login -u $DHUB_UNAME -p $DHUB_PWORD
- name: Push image to Docker Hub - name: Push image to Docker Hub
run: docker push v0idf1sh/treeanalyzer run: docker push v0idf1sh/silvanus

View File

@ -2,10 +2,10 @@
"help": { "help": {
"info": "This bot will analyze your tree (from the Grow A Tree Bot by Limbo Labs) and compare its growth to other trees displayed on the leaderboard.\n\nThis bot assumes that there is a single </tree:972648557796524032> message and a single </top trees:1051840665362894950> message that everyone uses. If everyone creates their own </tree:972648557796524032> and </top trees:1051840665362894950>, the reference messages will have to be updated every time, or old data will be displayed.", "info": "This bot will analyze your tree (from the Grow A Tree Bot by Limbo Labs) and compare its growth to other trees displayed on the leaderboard.\n\nThis bot assumes that there is a single </tree:972648557796524032> message and a single </top trees:1051840665362894950> message that everyone uses. If everyone creates their own </tree:972648557796524032> and </top trees:1051840665362894950>, the reference messages will have to be updated every time, or old data will be displayed.",
"setup": "To begin analyzing your Tree, first you must set up the reference messages.\n\n1. Run </setup:1065407649363005561> in the channel(s) that contain your server's tree and leaderboard messages.\n2. Now simply run </compare:1065346941166297128> where you want your analysis to be visible.", "setup": "To begin analyzing your Tree, first you must set up the reference messages.\n\n1. Run </setup:1065407649363005561> in the channel(s) that contain your server's tree and leaderboard messages.\n2. Now simply run </compare:1065346941166297128> where you want your analysis to be visible.",
"permissions": "At a minimum, Grow A Tree Analyzer requires permissions to `Send Messages` and `Send Messages in Threads` if applicable. If Analyzer is given permission to `Manage Messages`, the bot will delete the `.settree` and `.setranks` messages to reduce spam." "permissions": "At a minimum, Silvanus requires permissions to `Send Messages` and `Send Messages in Threads` if applicable. If Analyzer is given permission to `Manage Messages`, the bot will delete the `.settree` and `.setranks` messages to reduce spam."
}, },
"embeds": { "embeds": {
"footer": "Grow A Tree Analyzer is not affiliated with Grow A Tree or Limbo Labs", "footer": "Silvanus is not affiliated with Grow A Tree or Limbo Labs",
"color": "0x55FF55" "color": "0x55FF55"
}, },
"emoji": { "emoji": {

View File

@ -150,12 +150,13 @@ const functions = {
let difference = parseFloat(e.height).toFixed(1) - treeHeight; let difference = parseFloat(e.height).toFixed(1) - treeHeight;
const absDifference = parseFloat(Math.abs(difference)).toFixed(1); const absDifference = parseFloat(Math.abs(difference)).toFixed(1);
if (difference > 0) { if (difference > 0) {
replyString += `${absDifference}ft shorter than rank #${e.rank}\n`; replyString += `#${e.rank} - ${absDifference}ft shorter `;
} else if (difference < 0) { } else if (difference < 0) {
replyString += `${absDifference}ft taller than rank #${e.rank}\n`; replyString += `#${e.rank} - ${absDifference}ft taller `;
} else if (difference == 0) { } else if (difference == 0) {
replyString += `Same height as rank #${e.rank}\n`; replyString += `#${e.rank} - Same height `;
} }
replyString += `[${functions.getWaterTime(e.height)}m]\n`;
}); });
return 'Here\'s how your tree compares: \n' + replyString; return 'Here\'s how your tree compares: \n' + replyString;
} else { } else {
@ -236,6 +237,9 @@ const functions = {
} else { } else {
return "Your guild hasn't been set up yet."; return "Your guild hasn't been set up yet.";
} }
},
getWaterTime(size) {
return Math.floor((Math.pow(size * 0.07 + 5, 1.1) / 60));
} }
}; };

View File

@ -1,6 +1,6 @@
{ {
"name": "treeanalyzer", "name": "treeanalyzer",
"version": "1.0.1", "version": "1.0.2",
"description": "Analyze Grow A Tree", "description": "Analyze Grow A Tree",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {

View File

@ -13,7 +13,6 @@ module.exports = {
async execute(interaction) { async execute(interaction) {
await interaction.deferReply(); await interaction.deferReply();
const treeHeight = interaction.options.getString('height'); const treeHeight = interaction.options.getString('height');
const waterTime = Math.floor(Math.floor(Math.pow(treeHeight * 0.07 + 5, 1.1)) / 60); await interaction.editReply(`A tree that is ${treeHeight}ft tall will have a watering time of ${fn.getWaterTime(treeHeight)} minutes.`);
await interaction.editReply(`A tree that is ${treeHeight}ft tall will have a watering time of ${waterTime} minutes.`);
}, },
}; };