Created
August 18, 2021 14:18
-
-
Save buzzkillb/0dd63ca0fd9c13d001a637e7ee0291ad to your computer and use it in GitHub Desktop.
unxitime.js
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
const Discord = require("discord.js"); | |
const config = require("./config.json"); | |
//global.theTime = 0; | |
const client = new Discord.Client(); | |
const prefix = "!"; | |
client.on('ready', () => { | |
console.log(`Logged in as ${client.user.tag}!`); | |
client.user.setActivity('Mastering Rugpulls'); | |
}); | |
const Web3 = require("web3"); | |
const ABI = [ | |
{ | |
"type" : "function", | |
"name" : "presaleStartTime", | |
"inputs" : [], | |
"outputs" : [{"name":"","type":"uint256"}], | |
"stateMutability" : "view", | |
"payable" : false, | |
"constant" : true // for backward-compatibility | |
}, | |
{ | |
"type" : "function", | |
"name" : "minEthContribution", | |
"inputs" : [], | |
"outputs" : [{"name":"","type":"uint256"}], | |
"stateMutability" : "view", | |
"payable" : false, | |
"constant" : true // for backward-compatibility | |
}, | |
{ | |
"type" : "function", | |
"name" : "maxEthContribution", | |
"inputs" : [], | |
"outputs" : [{"name":"","type":"uint256"}], | |
"stateMutability" : "view", | |
"payable" : false, | |
"constant" : true // for backward-compatibility | |
}, | |
{ | |
"type" : "function", | |
"name" : "CheckSoftCap", | |
"inputs" : [], | |
"outputs" : [{"name":"","type":"uint256"}], | |
"stateMutability" : "view", | |
"payable" : false, | |
"constant" : true // for backward-compatibility | |
}, | |
{ | |
"type" : "function", | |
"name" : "cap", | |
"inputs" : [], | |
"outputs" : [{"name":"","type":"uint256"}], | |
"stateMutability" : "view", | |
"payable" : false, | |
"constant" : true // for backward-compatibility | |
}, | |
{ | |
"type" : "function", | |
"name" : "token", | |
"inputs" : [], | |
"outputs" : [{"name":"","type":"uint256"}], | |
"stateMutability" : "view", | |
"payable" : false, | |
"constant" : true // for backward-compatibility | |
} | |
]; | |
// [!!mute @User 12h Posting too many good memes] | |
// 0 1 2 3 5 6 7 8 | |
// !!mute <user> <time> <reason> \ | |
client.on('message', async (message) => { | |
if (message.author.bot) return; | |
if (message.content.indexOf(prefix) !== 0) return; | |
const args = message.content.slice(prefix.length).trim().split(/ +/g); | |
const command = args.shift().toLowerCase(); | |
switch (command) { | |
case 'ping': { | |
message.channel.send('Pong!').catch(console.error); | |
break; | |
} | |
case 'myname': { | |
const name = message.member.displayName; | |
message.delete(); | |
message.channel.send(`Your name is ${name}.`); | |
break; | |
} | |
case 'say': { | |
// !!say My name is Jeff | |
const response = args.join(' '); | |
message.delete(); | |
//message.channel.send(theTime); | |
break; | |
} | |
case 'unixtime': { | |
// !unixtime <PRESALE_CONTRACT> | |
const response = args[0]; | |
startTime(response); | |
async function startTime(response) { | |
// const web3 = new Web3('wss://bsc-ws-node.nariox.org:443'); | |
const web3 = new Web3('https://bsc-dataseed.binance.org/'); | |
const contract = new web3.eth.Contract(ABI, response); | |
const unixTimeTriforce = await contract.methods.presaleStartTime().call(); | |
const tokenName = await contract.methods.token().call(); | |
const minContribution = (await contract.methods.minEthContribution().call())/1000000000000000000; | |
const maxContribution = (await contract.methods.maxEthContribution().call())/1000000000000000000; | |
const softCap = await contract.methods.CheckSoftCap().call(); | |
const someCap = (await contract.methods.cap().call())/1000000000000000000; | |
console.log("time: " + unixTimeTriforce); | |
message.channel.send("unixtime: `" + unixTimeTriforce + "` for " + response); | |
message.channel.send("min: " + minContribution + " max: " + maxContribution + " sc: " + softCap + " hc: " + someCap); | |
return | |
} | |
message.delete(); | |
break; | |
} | |
default: | |
message.channel.send('This command is unknown!'); | |
break; | |
} | |
}); | |
client.login(config.BOT_TOKEN); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment