Merge pull request 'Add gurtleaveothers command' (#5) from pr/gurtleaveothers into master
Reviewed-on: #5
This commit is contained in:
commit
bd61f6d354
@ -1313,6 +1313,37 @@ def setup_commands(cog: "GurtCog"):
|
|||||||
|
|
||||||
command_functions.append(gurtresetpersonality)
|
command_functions.append(gurtresetpersonality)
|
||||||
|
|
||||||
|
# --- Gurt Leave Others Command (Owner Only) ---
|
||||||
|
@cog.bot.tree.command(
|
||||||
|
name="gurtleaveothers",
|
||||||
|
description="Leave all guilds except the designated one. (Owner only)",
|
||||||
|
)
|
||||||
|
async def gurtleaveothers(interaction: discord.Interaction):
|
||||||
|
"""Leave all guilds except the target guild."""
|
||||||
|
if interaction.user.id != cog.bot.owner_id:
|
||||||
|
await interaction.response.send_message(
|
||||||
|
"⛔ Only the bot owner can remove Gurt from guilds.",
|
||||||
|
ephemeral=True,
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
|
await interaction.response.defer(ephemeral=True)
|
||||||
|
|
||||||
|
target_id = 1360706427861209259
|
||||||
|
for guild in cog.bot.guilds:
|
||||||
|
if guild.id != target_id:
|
||||||
|
try:
|
||||||
|
await guild.owner.send(
|
||||||
|
"This bot was manually removed by the bot owner. If you have questions, contact the bot owner directly."
|
||||||
|
)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
await guild.leave()
|
||||||
|
|
||||||
|
await interaction.followup.send("✅ Done.", ephemeral=True)
|
||||||
|
|
||||||
|
command_functions.append(gurtleaveothers)
|
||||||
|
|
||||||
# --- Gurt Model Command (Owner Only) ---
|
# --- Gurt Model Command (Owner Only) ---
|
||||||
@cog.bot.tree.command(
|
@cog.bot.tree.command(
|
||||||
name="gurtmodel",
|
name="gurtmodel",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user