Skip to content

Conversation

gspxrk
Copy link
Contributor

@gspxrk gspxrk commented Jun 3, 2022

Please describe the changes this PR makes and why it should be merged:
Simple ping command that every bot should have

Status and versioning classification:
Nodejs v17.8.0

@DarrenOfficial
Copy link
Collaborator

Use camelCase please.

@DarrenOfficial
Copy link
Collaborator

embed1, embed, ect. Is uninformative.

@brianferri
Copy link
Contributor

Please check for mismatched parentheses and scopes, seems there's a few syntax errors too.

@brianferri
Copy link
Contributor

dunno how to suggest edits to a commit, or if that is even possible so I'll just put this here:
it's untested and just based on what was already done, fixing the small things.

const SlashCommand = require("../../lib/SlashCommand");
const { MessageEmbed } = require("discord.js");

const command = new SlashCommand()
.setName("ping")
.setDescription("View the bot's latency")
.setRun(async (client, interaction, options) => {	
	let msg = await interaction.reply({
		embeds: [new MessageEmbed()
			.setDescription("🏓 | Fetching ping...")
			.setColor("#6F8FAF")
		]
	})
	
	let zap = "⚡"
	let green = "🟢"
	let red = "🔴"
	let yellow = "🟡"
	
	var latState = zap;
	var apiState = zap;
	
	let apiPing = Math.round(client.ws.latPing)
	let latPing = `${Date.now() - msg.createdTimestamp}`
	const uptimeCount = moment.duration(client.uptime).format(" D [days], H [hrs], m [mins], s [secs]");
	
	if (apiPing >= 40 && apiPing < 200) {
		apiState = green;
	} else if (apiPing >= 200 && apiPing < 400) {
		apiState = yellow;
	} else if (apiPing >= 400) {
		apiState = red;
	}
	
	if (latPing >= 40 && latPing < 200) {
		latState = green;
	} else if (latPing >= 200 && latPing < 400) {
		latState = yellow;
	} else if (latPing >= 400) {
		latState = red;
	}
	
	msg.edit({ 
		embeds: [new MessageEmbed()
			.setTitle("🏓 | Pong!")
			.addField("API Latency", `${apiState} | ${apiPing}ms`, true)
			.addField("Message Latency", `${latState} | ${latPing}ms`, true)
			.addField("Uptime", `⏲️ | ${uptimeCount}`, true)
			.setColor("#6F8FAF")
			.setFooter({
				text: `Requested by ${interaction.user.username}`,
				iconURL: (message.author.avatarURL())
			})
		] 
	})	
});

@DarrenOfficial
Copy link
Collaborator

Please check for mismatched parentheses and scopes, seems there's a few syntax errors too.

This shouldn't happen, @XstreamSpeed Please check your commit / changes first before making a pull request.

@gspxrk
Copy link
Contributor Author

gspxrk commented Jun 4, 2022

Yeah, all of my recent pull requests are not tested. I don't have much time to do so, I'm preparing for 10th rn.

@SudhanPlayz
Copy link
Owner

this is music bot, why does this needed?

@DarrenOfficial
Copy link
Collaborator

this is music bot, why does this needed?

That's what I said

@DarrenOfficial
Copy link
Collaborator

Yeah, all of my recent pull requests are not tested. I don't have much time to do so, I'm preparing for 10th rn.

Then don't make those pull request(s), stop wasting maintainers time. If you want to contribute to FOSS. Test 👏🏼 your 👏🏼 commit 👏🏼 first 👏🏼 before 👏🏼 making 👏🏼 a 👏🏼 pull 👏🏼 request.

@DarrenOfficial
Copy link
Collaborator

I'm just going to close this.

@gspxrk
Copy link
Contributor Author

gspxrk commented Jun 4, 2022

Alright dawg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants