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

Treating None embeds and views as not having embeds and views in send_message #671

Merged
merged 1 commit into from
Jan 1, 2022

Conversation

TurqW
Copy link
Contributor

@TurqW TurqW commented Dec 30, 2021

Summary

When you call ctx.respond (sending messages, not editing them) and other similar methods, you currently have to put them in an if block to decide whether to include embeds and/or views. With this PR, they'll be able to correctly handle a None, allowing usage of a variable or ternary expression. For instance,

if msg != NO_REMINDERS_MESSAGE:
    view =MyView()
    await ctx.respond(msg, view=view, ephemeral=True)
else:
    await ctx.respond(msg, ephemeral=True)

can now be simplified to:

view = None if msg == NO_REMINDERS_MESSAGE else MyView()
await ctx.respond(msg, view=view, ephemeral=True)

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why (N/A)
  • This PR fixes an issue. (Debatable)
  • This PR adds something new (e.g. new method or parameters). (Debatable)
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, typehinting, examples, ...)

@Lulalaby Lulalaby added feature request New feature request priority: low Low Priority status: awaiting review Awaiting review from a maintainer labels Dec 30, 2021
@Lulalaby Lulalaby added this to the v2.1 milestone Dec 30, 2021
@Dorukyum
Copy link
Member

Dorukyum commented Jan 1, 2022

You could pass utils.MISSING but I guess this is also fine.

@Lulalaby Lulalaby merged commit 640c73a into Pycord-Development:master Jan 1, 2022
VincentRPS pushed a commit to VincentRPS/pycord that referenced this pull request Jan 22, 2022
@VincentRPS VincentRPS modified the milestones: v2.1, v2.0 Jan 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature request priority: low Low Priority status: awaiting review Awaiting review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants