Skip to content

Commit

Permalink
Made few changes to embed transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
yanukadeneth99 committed Aug 24, 2022
1 parent 659bcb7 commit 42024fc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
26 changes: 15 additions & 11 deletions responses/faucet_response.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Transfers the set dailyEth value to the requested user.
// Rate limited to daily
const ethers = require("ethers");
const { EmbedBuilder } = require('discord.js');
const { EmbedBuilder } = require("discord.js");
const getProvider = require("../utils/getProvider");
const getBalance = require("../utils/getBalance");
const transfer = require("../utils/transfer");
const getTxName = require("../utils/getTxName")
const getTxName = require("../utils/getTxName");
const handleRateLimiting = require("../utils/handleRateLimiting");
const { stats, networks, tokens, channels } = require("../config.json");

Expand Down Expand Up @@ -91,10 +91,12 @@ module.exports = async (keyv, interaction) => {
const embed = new EmbedBuilder()
.setColor("#3BA55C")
.setDescription(
`[View on ${networkName == "mumbai" ? "Polygonscan" : "Etherscan"}](${string}${tx.hash})`
);
`[View on ${
networkName == "mumbai" ? "Polygonscan" : "Etherscan"
}](${string}${tx.hash})`
);
await interaction.editReply({
content: `Transaction created.`,
content: `👨‍🏭 Working Hard, please wait...`,
embeds: [embed],
});
await tx.wait();
Expand Down Expand Up @@ -149,12 +151,14 @@ module.exports = async (keyv, interaction) => {
const embed = new EmbedBuilder()
.setColor("#3BA55C")
.setDescription(
`[View on ${networkName == "mumbai" ? "Polygonscan" : "Etherscan"}](${string}${tx.hash})`
);
await interaction.editReply({
content: `Transaction created.`,
embeds: [embed],
});
`[View on ${
networkName == "mumbai" ? "Polygonscan" : "Etherscan"
}](${string}${tx.hash})`
);
await interaction.editReply({
content: `👨‍🏭 Working Hard, please wait...`,
embeds: [embed],
});
await tx.wait();
await keyv.set(`${interaction.user.id}:${tokenName}`, Date.now());
}
Expand Down
14 changes: 8 additions & 6 deletions utils/getTxName.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module.exports = async(networkName)=> {
if(networkName == 'mumbai') {
return `https://${networkName}.polygonscan.com/tx/`
}
return `https://${networkName}.etherscan.io/tx/`
}
// Used in Faucet_response.js to display the transaction hash link

module.exports = (networkName) => {
if (networkName == "mumbai") {
return `https://${networkName}.polygonscan.com/tx/`;
}
return `https://${networkName}.etherscan.io/tx/`;
};

0 comments on commit 42024fc

Please sign in to comment.