-
Notifications
You must be signed in to change notification settings - Fork 11
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
base: master
Are you sure you want to change the base?
Conversation
self, ctx, inputunit, outputunit | ||
): # the ctx parameter is short for 'context' | ||
"""type your input and output units""" | ||
save = convert(inputunit, outputunit) |
There was a problem hiding this comment.
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""" |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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.
change units