Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

feat 💥: message operations with InteractionContext #683

Merged
merged 4 commits into from
Oct 27, 2022

Conversation

LordOfPolls
Copy link
Member

@LordOfPolls LordOfPolls commented Oct 21, 2022

What type of pull request is this?

  • Non-breaking code change
  • Breaking code change
  • Documentation change/addition
  • Tests change

Description

A nice chunky PR. Primarily this PR does three things:

  • Add support for editing and deleting messages with InteractionContext
  • Refactor Message.edit to use kwargs
  • Refactor Message.delete to be all round nicer

This adds support for editing and deleting ephemeral messages.

Deleting

message = await ctx.send("test", ephemeral=True)
await context.delete(message)
# or
await message.delete(context=ctx)
message = await ctx.send("test", ephemeral=True)
await context.edit(message, content="test edit")
# or
await message.edit(content="test edit", context=ctx)

Kwarg edit

Message.edit should really have been kwarg only this whole time. I will die on this hill.

Changes

  • Refactor message.delete
  • Add HTTP method for interaction message deletes
  • Add InteractionContext.delete
  • Add InteractionContext.edit
  • Add interaction deletion support to Message.delete
  • Add interaction edit support to Message.edit

Checklist

  • I've formatted my code with Black
  • I've ensured my code works on Python 3.10.x
  • I've tested my code

@LordOfPolls LordOfPolls added the New Feature::Discord Adding support for a new discord feature label Oct 21, 2022
@LordOfPolls LordOfPolls changed the title feat: support ephemeral delete feat: message operations with InteractionContext Oct 25, 2022
@LordOfPolls LordOfPolls changed the title feat: message operations with InteractionContext feat 💥: message operations with InteractionContext Oct 25, 2022
@LordOfPolls LordOfPolls added the New Feature::Library A new feature for the library label Oct 25, 2022
@LordOfPolls
Copy link
Member Author

Test fail related to check changes upstream. This pr passes all checks

@LordOfPolls LordOfPolls merged commit 46f172f into 2.x Oct 27, 2022
@LordOfPolls LordOfPolls deleted the ephemeral-delete branch October 27, 2022 17:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
New Feature::Discord Adding support for a new discord feature New Feature::Library A new feature for the library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants