Skip to content

Commit

Permalink
change interaction.edit_original_message to interaction.edit_original…
Browse files Browse the repository at this point in the history
…_response

interaction.edit_original_message was deprecated in Pycord 2.2.0. Pycord-Development/pycord#1609
  • Loading branch information
celsiusnarhwal committed Jan 2, 2023
1 parent 89aa271 commit 27eb35f
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 119 deletions.
4 changes: 2 additions & 2 deletions cogs/about/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ async def back(self, button: Button, interaction: Interaction):
# embed.set_author(name="About", icon_url=original_message.author.display_avatar.url)
#
# await interaction.response.defer()
# await interaction.edit_original_message(embed=embed, attachments=[], view=InviteView(ctx=self.ctx))
# await interaction.edit_original_response(embed=embed, attachments=[], view=InviteView(ctx=self.ctx))

async def show_about(self, interaction: Interaction = None):
with support.Assets.about():
Expand All @@ -174,7 +174,7 @@ async def show_about(self, interaction: Interaction = None):
about_embed.set_image(url="attachment://bot_logo.png")
if interaction:
await interaction.response.defer()
await interaction.edit_original_message(
await interaction.edit_original_response(
embed=about_embed, file=bot_logo, attachments=[], view=self
)
else:
Expand Down
2 changes: 1 addition & 1 deletion cogs/cah/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CAHGame(HostedMultiplayerGame):
def __init__(self, cards: dict, settings: CAHGameSettings, *args, **kwargs):
super().__init__(*args, **kwargs)

self.min_players = 3
self.min_players = 2

self.cardset = CAHCardSet(cards)
self.settings: CAHGameSettings = settings
Expand Down
33 changes: 17 additions & 16 deletions cogs/cah/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async def submit(self, button: Button, interaction: Interaction):
lambda x: isinstance(x, Select), self.children
)

await interaction.edit_original_message(
await interaction.edit_original_response(
content="Creating your Cards Against Humanity game...",
embed=None,
view=None,
Expand Down Expand Up @@ -88,7 +88,7 @@ async def submit(self, button: Button, interaction: Interaction):
description=msg,
color=support.Color.red(),
)
await interaction.edit_original_message(
await interaction.edit_original_response(
content=None, embed=embed, view=None
)

Expand Down Expand Up @@ -128,7 +128,7 @@ async def get_packs(self):
name="Cards Against Humanity", icon_url=self.ctx.me.display_avatar.url
)

await self.ctx.interaction.edit_original_message(embed=embed, view=self)
await self.ctx.interaction.edit_original_response(embed=embed, view=self)

await self.wait()

Expand Down Expand Up @@ -179,7 +179,7 @@ async def interaction_check(self, interaction: Interaction) -> bool:
)

await interaction.response.defer()
await self.ctx.interaction.edit_original_message(embed=embed, view=self)
await self.ctx.interaction.edit_original_response(embed=embed, view=self)
else:
self.submission = self.candidates[0]
await self.finish()
Expand Down Expand Up @@ -221,7 +221,7 @@ async def finish(self):
embed.set_author(
name="Cards Against Humanity", icon_url=self.ctx.me.display_avatar.url
)
await self.ctx.interaction.edit_original_message(embed=embed, view=None)
await self.ctx.interaction.edit_original_response(embed=embed, view=None)

self.stop()

Expand Down Expand Up @@ -328,7 +328,7 @@ async def vote(self):
+ "\n\nPlease wait for the other players to finish."
)

await self.ctx.interaction.edit_original_message(embed=embed, view=None)
await self.ctx.interaction.edit_original_response(embed=embed, view=None)

return self.selection

Expand Down Expand Up @@ -369,7 +369,7 @@ async def interaction_check(self, interaction: Interaction) -> bool:

async def open_status_center(self):
"""
Sends the UNO Status Center menu in chat.
Sends the CAH Status Center menu in chat.
"""
status_menu = self.get_menu()
self.add_item(status_menu)
Expand Down Expand Up @@ -433,15 +433,16 @@ def players(self):
inline=False,
)

other_players = [p for p in self.game.players if p.user != self.game.host]
embed.add_field(
name="Other Players",
value="\n".join(
f"— {player.user.name} ({player.user.mention})"
for player in other_players
),
inline=False,
)
match [p for p in self.game.players if p.user != self.game.host]:
case other_players if other_players:
embed.add_field(
name="Other Players",
value="\n".join(
f"— {player.user.name} ({player.user.mention})"
for player in other_players
),
inline=False,
)

return embed

Expand Down
8 changes: 4 additions & 4 deletions cogs/chess/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ async def promotion():

if interaction:
await interaction.response.defer()
await interaction.edit_original_message(
await interaction.edit_original_response(
embed=select_menu.embed,
file=board_png,
attachments=[],
Expand Down Expand Up @@ -483,7 +483,7 @@ async def promotion():
with chess.get_board_png(**self.image_data) as board_png:
embed.set_image(url=f"attachment://{board_png.filename}")
await interaction.response.defer()
await interaction.edit_original_message(
await interaction.edit_original_response(
embed=embed, file=board_png, attachments=[], view=self
)

Expand Down Expand Up @@ -762,7 +762,7 @@ async def present(self, interaction: Interaction = None):
with chess.get_board_png(**self.image_data) as board_png:
if interaction:
await interaction.response.defer()
await interaction.edit_original_message(
await interaction.edit_original_response(
file=board_png, attachments=[], view=self
)
else:
Expand Down Expand Up @@ -1253,7 +1253,7 @@ def refresh_page(self):
async def present(self, interaction):
with chess.get_board_png(**self.image_data) as board_png:
await interaction.response.defer()
await interaction.edit_original_message(
await interaction.edit_original_response(
file=board_png, attachments=[], view=self
)

Expand Down
Loading

0 comments on commit 27eb35f

Please sign in to comment.