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

[V3 General] Changed urban dictionary for my embed version #1871

Merged
merged 9 commits into from
Aug 7, 2018
Merged

[V3 General] Changed urban dictionary for my embed version #1871

merged 9 commits into from
Aug 7, 2018

Conversation

lionirdeadman
Copy link
Contributor

@lionirdeadman lionirdeadman commented Jun 15, 2018

Type

  • Bugfix
  • Enhancement
  • New feature

Description of the changes

Replaced the old urban dictionary command to an embed version I made which adds:

  • The author name
  • Thumb ups
  • Thumb downs
  • Reaction menu to see the different definitions

@palmtree5 palmtree5 added the V3 label Jun 16, 2018
@Tobotimus Tobotimus changed the title Changed urban dictionary for my embed version [V3 General] Changed urban dictionary for my embed version Jun 25, 2018
@lionirdeadman
Copy link
Contributor Author

I'll update my branch (to include the changes made to V3/develop) after the code is reviewed if you don't mind.

I don't really want to update this branch all the time while I wait for review, hope you understand.

@Tobotimus Tobotimus added this to the Beta 18 milestone Jun 28, 2018
Copy link
Member

@Tobotimus Tobotimus left a comment

Choose a reason for hiding this comment

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

Hi, thanks for your contribution! 🎉

I like the new menu interface, much better than the old one! However there are a couple things which need to be changed in your code before we'll accept this 😃

Once you've made the changes, please post a comment to let us know.

async def urban(self, ctx, *, search_terms: str, definition_number: int = 1):
"""Urban Dictionary search
async def urban(self, ctx, *, word):
"""Searches for urban dictionary entries using the unofficial urbandictionary api"""
Copy link
Member

Choose a reason for hiding this comment

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

This help string is a bit long. Try to make the first line shorter than 72 characters, but the user should still know exactly what the command does from that line. Any further detail should be expanded after two line-breaks.


Definition number must be between 1 and 10"""
data = None
Copy link
Member

Choose a reason for hiding this comment

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

Early declaration of variable here is unnecessary

except:
await ctx.send(_("Error."))
await ctx.send("No Urban dictionary were found or there was an error in the process")
Copy link
Member

Choose a reason for hiding this comment

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

You'll want to return here

Copy link
Member

Choose a reason for hiding this comment

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

Also, this sentence isn't quite grammatically correct, and needs to be wrapped in _()

embed.url = ud["permalink"]
embed.description = (
ud["definition"] + "\n \n **Example : **" + ud.get("example", "N/A")
)
Copy link
Member

@Tobotimus Tobotimus Jun 28, 2018

Choose a reason for hiding this comment

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

Please use "".format() instead of concatenating strings, and also add back in the i18n call (which is surrounding the string with _()).

+ " Down / "
+ str(ud["thumbs_up"])
+ " Up , Powered by urban dictionary"
)
Copy link
Member

Choose a reason for hiding this comment

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

Please use "".format() here too

@lionirdeadman
Copy link
Contributor Author

lionirdeadman commented Jun 28, 2018

I think I've changed everything you asked for. Thanks for the review. :)

Could it be in Beta 17 or is it feature-freezed? 🤔

@lionirdeadman
Copy link
Contributor Author

lionirdeadman commented Jun 28, 2018

Had to come up with a fix for the 2048 character limit of descriptions, I hadn't thought of it.

Everything should be good now though.

@lionirdeadman
Copy link
Contributor Author

Just commenting again since this is supposed to be for B18 according to the tag so I'd like a review again. Thank you.

@Kowlin
Copy link
Member

Kowlin commented Jul 25, 2018

I'm going to place this on hold to review with other core developers. See what they think.

@Kowlin Kowlin modified the milestones: Beta 18, Future release Jul 25, 2018
@mikeshardmind
Copy link
Contributor

This is sleek, and I like it a lot. The only problem I have with it is that it does not respect the core embed requested setting. It might be better to break this out into 2 separate functions, (old code and new) and have the appropriate one based on that setting called when the command is invoked.

@lionirdeadman
Copy link
Contributor Author

I don't know how to respect the embed setting, if you could give me pointers, I'd be glad to do it, @mikeshardmind.

Feel free to PM me in Discord instead of commenting here so we can do this faster! 😄

@mikeshardmind
Copy link
Contributor

There's a helper method in context for this since this particular command always should respond in the same location it was called from.

if await ctx.embed_requested():
    #  output version using an embed
else:
    #  output version without an embed

@lionirdeadman
Copy link
Contributor Author

lionirdeadman commented Jul 30, 2018

I think I did it properly so this should be done now! (sorry for the wait, I was a bit busy)

@mikeshardmind
Copy link
Contributor

Looks solid. 👍

Copy link
Member

@Tobotimus Tobotimus left a comment

Choose a reason for hiding this comment

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

Alright, thanks @lionirdeadman for the PR and thanks @mikeshardmind for reviewing. This has really jazzed up the urban command.

A small word of advice @lionirdeadman for any future PR's, try not to change too much code unnecessarily. This command has essentially been rewritten from the ground up when looking at the diff - but in retrospect it only aimed to change the output format (not any HTTP request / backend stuff). Changing more than necessary gives the reviewers more work than necessary, hence why this has taken almost 2 months to be merged! However I'll let it slide and I hope you're glad this has finally had its green button pressed :)

@Tobotimus Tobotimus merged commit 9d4f9ef into Cog-Creators:V3/develop Aug 7, 2018
@lionirdeadman
Copy link
Contributor Author

I had already made that code in a cog, I simply modified it slightly for this PR. I'll try not to do that again though if that makes things harder for you guys.

And yeah, I'm pretty happy it got merged. ^^

@lionirdeadman lionirdeadman deleted the V3/develop branch August 10, 2018 03:24
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.

None yet

5 participants