Skip to content

Commit

Permalink
embed edit
Browse files Browse the repository at this point in the history
  • Loading branch information
yashsolanki22 committed Aug 24, 2022
1 parent d8e9a31 commit 659bcb7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
22 changes: 22 additions & 0 deletions responses/faucet_response.js
Original file line number Diff line number Diff line change
@@ -1,9 +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 getProvider = require("../utils/getProvider");
const getBalance = require("../utils/getBalance");
const transfer = require("../utils/transfer");
const getTxName = require("../utils/getTxName")
const handleRateLimiting = require("../utils/handleRateLimiting");
const { stats, networks, tokens, channels } = require("../config.json");

Expand Down Expand Up @@ -85,6 +87,16 @@ module.exports = async (keyv, interaction) => {
Date.now()
).toUTCString()}\n${JSON.stringify(tx)}`
);
const string = await getTxName(networkName);
const embed = new EmbedBuilder()
.setColor("#3BA55C")
.setDescription(
`[View on ${networkName == "mumbai" ? "Polygonscan" : "Etherscan"}](${string}${tx.hash})`
);
await interaction.editReply({
content: `Transaction created.`,
embeds: [embed],
});
await tx.wait();
await keyv.set(`${interaction.user.id}:${networkName}`, Date.now());
}
Expand Down Expand Up @@ -133,6 +145,16 @@ module.exports = async (keyv, interaction) => {
Date.now()
).toUTCString()}\n${JSON.stringify(tx)}`
);
const string = await getTxName(networkName);
const embed = new EmbedBuilder()
.setColor("#3BA55C")
.setDescription(
`[View on ${networkName == "mumbai" ? "Polygonscan" : "Etherscan"}](${string}${tx.hash})`
);
await interaction.editReply({
content: `Transaction created.`,
embeds: [embed],
});
await tx.wait();
await keyv.set(`${interaction.user.id}:${tokenName}`, Date.now());
}
Expand Down
6 changes: 6 additions & 0 deletions utils/getTxName.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = async(networkName)=> {
if(networkName == 'mumbai') {
return `https://${networkName}.polygonscan.com/tx/`
}
return `https://${networkName}.etherscan.io/tx/`
}

0 comments on commit 659bcb7

Please sign in to comment.