Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conversion command #77

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

tinysheep007
Copy link

change units

self, ctx, inputunit, outputunit
): # the ctx parameter is short for 'context'
"""type your input and output units"""
save = convert(inputunit, outputunit)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try and use variable names that accurately describe the data to which they refer. This benefits you and others who might try and read, edit, and/or improve your code in the future 🙂

async def convert(
self, ctx, inputunit, outputunit
): # the ctx parameter is short for 'context'
"""type your input and output units"""
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an accurate description of how the command works? It seems as though the input isn't just a unit, but is actually a quantity with a unit. Remember that although you have read the documentation or examples for the convert function you imported from unit-converter, your users have not, and neither have other programmers who may be viewing and working with your code. Make sure you use variable names and include documentation that is accurate to the way your code works! 😄

"""type your input and output units"""
save = convert(inputunit, outputunit)

await ctx.send(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be nice as an embed. Try the following after adding import discord to the top of your file

embed = discord.Embed(title="Unit Conversion")
embed.add_field(name="Input Quantity", value=inputunit)
embed.add_field(name="Output Unit", value=outputunit)
embed.add_field(name="Result", value=save)

await ctx.send(embed=embed)

Feel free to give it some colour if you'd like 🙂 it is up to you.

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.

2 participants