Skip to content

Commit

Permalink
Added error channels
Browse files Browse the repository at this point in the history
  • Loading branch information
yanukadeneth99 committed Aug 23, 2022
1 parent 50931ce commit 57f9ed5
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 45 deletions.
12 changes: 6 additions & 6 deletions events/interactionCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
async execute(client, interaction) {
try {
// Get the Log Channel
const logchannel = await client.channels.cache.get(channels.log);
const errorchannel = await client.channels.cache.get(channels.error);

//* Chat Command Interactions
if (interaction.isChatInputCommand()) {
Expand All @@ -33,7 +33,7 @@ module.exports = {
content: "👀 This Command does not exist!",
ephemeral: true,
});
logchannel.send(
errorchannel.send(
`[ERROR]\n${new Date(
Date.now()
).toUTCString()}\nInvalid Chat Command Passed\nBy : ${
Expand All @@ -56,7 +56,7 @@ module.exports = {
});
} catch (error) {
console.error(`Error Submitting Feedback : ${error}`);
logchannel.send(
errorchannel.send(
`[ERROR]\n${new Date(
Date.now()
).toUTCString()}\nSubmittingFeedback\n${error}`
Expand All @@ -73,7 +73,7 @@ module.exports = {
content: "👀 Invalid Modal Interaction!",
ephemeral: true,
});
logchannel.send(
errorchannel.send(
`[ERROR]\n${new Date(
Date.now()
).toUTCString()}\nInvalid Modal Interaction\nBy : ${
Expand All @@ -89,9 +89,9 @@ module.exports = {
return;
}
} catch (error) {
const logChannel = await client.channels.cache.get(channels.log);
const errorchannel = await client.channels.cache.get(channels.error);
console.error(`Error Handling Interaction : ${error}`);
logChannel.send(
errorchannel.send(
`[ERROR]\n${new Date(
Date.now()
).toUTCString()}\nInteraction Handling\n${error}`
Expand Down
16 changes: 8 additions & 8 deletions events/ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ module.exports = {
async execute(client) {
try {
// Morning Print of Waking Up
const logchannel = await client.channels.cache.get(channels.log);
logchannel.send(
`[LOGIN/RESTART]\n${new Date(
Date.now()
).toUTCString()}\nFaucet Bot Woken`
);
// const logchannel = await client.channels.cache.get(channels.log);
// logchannel.send(
// `[LOGIN/RESTART]\n${new Date(
// Date.now()
// ).toUTCString()}\nFaucet Bot Woken`
// );

// Setting Status of Bot
client.user.setActivity("Minting...", {
Expand All @@ -24,8 +24,8 @@ module.exports = {
console.log(`Ready! Logged in as ${client.user.tag}`);
} catch (error) {
console.error(`Error Starting BOT in ready : ${error}`);
const logchannel = await client.channels.cache.get(channels.log);
logchannel.send(
const errorchannel = await client.channels.cache.get(channels.error);
errorchannel.send(
`[ERROR]\n${new Date(Date.now()).toUTCString()}\nWaking BOT\n${error}`
);
}
Expand Down
26 changes: 13 additions & 13 deletions responses/balance_response.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@ module.exports = async (interaction) => {
);

// Log out the transaction
const logchannel = await interaction.client.channels.cache.get(
channels.log
);
logchannel.send(
`[BALANCE]\n${new Date(
Date.now()
).toUTCString()}\nNetwork : ${networkName.toUpperCase()}\nToken : ${tokenName.toUpperCase()}\nBy : ${
interaction.user.username
}`
);
// const logchannel = await interaction.client.channels.cache.get(
// channels.log
// );
// logchannel.send(
// `[BALANCE]\n${new Date(
// Date.now()
// ).toUTCString()}\nNetwork : ${networkName.toUpperCase()}\nToken : ${tokenName.toUpperCase()}\nBy : ${
// interaction.user.username
// }`
// );
} catch (error) {
console.error(`Error [RESPONCE - BALANCE] : ${error}`);
const logchannel = await interaction.client.channels.cache.get(
channels.log
const errorchannel = await interaction.client.channels.cache.get(
channels.error
);
logchannel.send(
errorchannel.send(
`[ERROR]\n${new Date(
Date.now()
).toUTCString()}\nGetting Balance\n${error}`
Expand Down
13 changes: 4 additions & 9 deletions responses/faucet_response.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const { stats, networks, channels } = require("../config.json");

// TODO : Apply Rate Limiting
// TODO : Make sure only verified members can do this (or any other role)
// BUG : Find why mumbai transfers doesnt work

module.exports = async (interaction) => {
// Initial Responce to client
Expand Down Expand Up @@ -42,12 +43,6 @@ module.exports = async (interaction) => {

// Transaction
const tx = await transfer(provider, usrAddress);
const logchannel = await interaction.client.channels.cache.get(
channels.log
);
logchannel.send(
`[TXOBJ]\n${new Date(Date.now()).toUTCString()}\nOBJ : ${tx}`
);
await tx.wait();
}
//* Non Native Transfer (ERC-20)
Expand Down Expand Up @@ -82,10 +77,10 @@ module.exports = async (interaction) => {
await interaction.editReply("💁 Transfer Successful, Happy Coding!");
} catch (error) {
console.error(`Error Transferring : ${error}`);
const logchannel = await interaction.client.channels.cache.get(
channels.log
const errorchannel = await interaction.client.channels.cache.get(
channels.error
);
logchannel.send(
errorchannel.send(
`[ERROR]\n${new Date(Date.now()).toUTCString()}\nTransferring\n${error}`
);
await interaction.editReply({
Expand Down
6 changes: 3 additions & 3 deletions responses/feedback_response.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ module.exports = async (interaction) => {
await interaction.showModal(modal);
} catch (error) {
console.error(`Error Creating Feedback Modal : ${error}`);
const logchannel = await interaction.client.channels.cache.get(
channels.log
const errorchannel = await interaction.client.channels.cache.get(
channels.error
);
logchannel.send(
errorchannel.send(
`[ERROR]\n${new Date(
Date.now()
).toUTCString()}\nBuilding Feedback Modal\n${error}`
Expand Down
6 changes: 3 additions & 3 deletions responses/info_response.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ module.exports = async (interaction) => {
}
} catch (error) {
console.error(`Error Getting Info : ${error}`);
const logchannel = await interaction.client.channels.cache.get(
channels.log
const errorchannel = await interaction.client.channels.cache.get(
channels.error
);
logchannel.send(
errorchannel.send(
`[ERROR]\n${new Date(Date.now()).toUTCString()}\nGettng Into\n${error}`
);
await interaction.editReply({
Expand Down
6 changes: 3 additions & 3 deletions responses/ping_response.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ module.exports = async (interaction) => {
);
} catch (error) {
console.error(`Error Getting Ping Response : ${error}`);
const logchannel = await interaction.client.channels.cache.get(
channels.log
const errorchannel = await interaction.client.channels.cache.get(
channels.error
);
logchannel.send(
errorchannel.send(
`[ERROR]\n${new Date(
Date.now()
).toUTCString()}\nGetting Ping Response\n${error}`
Expand Down
1 change: 1 addition & 0 deletions utils/transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Pass the token Name and Network Name if the transaction is meant to be using a ERC20 token

// TODO : Handle nounce and gas fees
// FIXME : Find issue with Matic Transfers

const ethers = require("ethers");
const { stats, tokens } = require("../config.json");
Expand Down

0 comments on commit 57f9ed5

Please sign in to comment.