mirror of
https://github.com/neoarz/Syntrel.git
synced 2025-12-25 11:40:12 +01:00
refactory(say): now works in dms and priv channels
This commit is contained in:
@@ -47,12 +47,17 @@ class Say(commands.Cog, name="say"):
|
|||||||
|
|
||||||
interaction = getattr(context, "interaction", None)
|
interaction = getattr(context, "interaction", None)
|
||||||
if interaction is not None:
|
if interaction is not None:
|
||||||
await interaction.response.defer(ephemeral=True)
|
is_in_guild = context.guild is not None
|
||||||
|
await interaction.response.defer(ephemeral=is_in_guild)
|
||||||
|
try:
|
||||||
await context.channel.send(message, allowed_mentions=allowed_mentions)
|
await context.channel.send(message, allowed_mentions=allowed_mentions)
|
||||||
|
if is_in_guild:
|
||||||
try:
|
try:
|
||||||
await interaction.delete_original_response()
|
await interaction.delete_original_response()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
except discord.Forbidden:
|
||||||
|
await interaction.followup.send(message, allowed_mentions=allowed_mentions)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
await context.message.delete()
|
await context.message.delete()
|
||||||
@@ -94,12 +99,17 @@ class Say(commands.Cog, name="say"):
|
|||||||
|
|
||||||
interaction = getattr(context, "interaction", None)
|
interaction = getattr(context, "interaction", None)
|
||||||
if interaction is not None:
|
if interaction is not None:
|
||||||
await interaction.response.defer(ephemeral=True)
|
is_in_guild = context.guild is not None
|
||||||
|
await interaction.response.defer(ephemeral=is_in_guild)
|
||||||
|
try:
|
||||||
await context.channel.send(embed=embed, allowed_mentions=allowed_mentions)
|
await context.channel.send(embed=embed, allowed_mentions=allowed_mentions)
|
||||||
|
if is_in_guild:
|
||||||
try:
|
try:
|
||||||
await interaction.delete_original_response()
|
await interaction.delete_original_response()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
except discord.Forbidden:
|
||||||
|
await interaction.followup.send(embed=embed, allowed_mentions=allowed_mentions)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
await context.message.delete()
|
await context.message.delete()
|
||||||
|
|||||||
Reference in New Issue
Block a user