|
|
@@ -1,18 +1,23 @@
|
|
|
from discord.ext import commands
|
|
|
import discord
|
|
|
from discord import app_commands
|
|
|
-import time
|
|
|
+#import time
|
|
|
from typing import Optional
|
|
|
-from query.channel import get_interact
|
|
|
+#from query.channel import get_interact
|
|
|
from query.user import ignore_user, unignore_user, is_ignored
|
|
|
from common.logging import report
|
|
|
-from local_settings import OUTPUT_CHANNEL
|
|
|
+#from local_settings import OUTPUT_CHANNEL
|
|
|
from common.settings import check_ignore
|
|
|
|
|
|
+
|
|
|
+async def setup(bot: commands.Bot) -> None:
|
|
|
+ await bot.add_cog(GeneralCommands(bot))
|
|
|
+
|
|
|
+
|
|
|
class GeneralCommands(commands.Cog):
|
|
|
"""General functionality."""
|
|
|
|
|
|
- def __init__(self, bot: commands.Bot):
|
|
|
+ def __init__(self, bot: commands.Bot) -> None:
|
|
|
self.bot = bot
|
|
|
|
|
|
# @commands.command(
|
|
|
@@ -76,60 +81,50 @@ class GeneralCommands(commands.Cog):
|
|
|
# await self.bot.change_presence(activity=discord.Game(name=text))
|
|
|
# await report(self.bot, f"`{ctx.author}` has set my status to `{text}`.")
|
|
|
|
|
|
- @commands.command(
|
|
|
+ @app_commands.command(
|
|
|
+ name="ignoreme",
|
|
|
description="Get ignored.",
|
|
|
- brief="Ignore sender",
|
|
|
- help="Will have the bot ignore the user from now on."
|
|
|
)
|
|
|
- async def ignoreme(self, ctx: commands.Context):
|
|
|
+ async def ignoreme(self, interaction: discord.Interaction) -> None:
|
|
|
# Halt on ignore list.
|
|
|
- if await check_ignore(self.bot.pg, ctx.author):
|
|
|
+ if await check_ignore(self.bot.pg, interaction.user):
|
|
|
return
|
|
|
|
|
|
- await ignore_user(self.bot.pg, ctx.author.id)
|
|
|
- await ctx.send(f"To revert this use the `/unignoreme` command.")
|
|
|
+ await ignore_user(self.bot.pg, interaction.user.id)
|
|
|
+ await interaction.response.send_message(f"To revert this use the `/unignoreme` command.")
|
|
|
await report(self.bot, f"`{ctx.author}` has requested to be ignored.")
|
|
|
|
|
|
- @commands.command(
|
|
|
+ @app_commands.command(
|
|
|
+ name="unignoreme",
|
|
|
description="No longer get ingored.",
|
|
|
- brief="Un-ignore sender",
|
|
|
- help="No longer will the bot ignore the user."
|
|
|
)
|
|
|
- async def unignoreme(self, ctx: commands.Context):
|
|
|
- await unignore_user(self.bot.pg, ctx.author.id)
|
|
|
- await ctx.send(f"I shall now interact with you again where my channel settings allow it.")
|
|
|
- await report(self.bot, f"`{ctx.author}` has requested to be un-ignored.")
|
|
|
+ async def unignoreme(self, interaction: discord.Interaction) -> None:
|
|
|
+ await unignore_user(self.bot.pg, interaction.user.id)
|
|
|
+ await interaction.response.send_message(f"I shall now interact with you again where my channel settings allow it.")
|
|
|
+ await report(self.bot, f"`{interaction.user}` has requested to be un-ignored.")
|
|
|
|
|
|
@app_commands.command(
|
|
|
- name="isignored1",
|
|
|
- description="Echoes a message."
|
|
|
+ name="isignored",
|
|
|
+ description="Ignore status for user.",
|
|
|
)
|
|
|
# @commands.command(
|
|
|
# description="Ignore status for user.",
|
|
|
# brief="Check if user is ingored",
|
|
|
# help="Verify if the user is being ignored."
|
|
|
# )
|
|
|
- async def isignored1(self, interaction: discord.Interaction, user: Optional[discord.User]):
|
|
|
- print(0)
|
|
|
+ async def isignored(self, interaction: discord.Interaction, user: Optional[discord.User]) -> None:
|
|
|
# Halt on ignore list.
|
|
|
- if await check_ignore(self.bot.pg, interaction.author):
|
|
|
- print("Ignoring")
|
|
|
+ if await check_ignore(self.bot.pg, interaction.user):
|
|
|
return
|
|
|
|
|
|
if not user:
|
|
|
- user = interaction.author
|
|
|
+ user = interaction.user
|
|
|
|
|
|
if await is_ignored(self.bot.pg, user.id):
|
|
|
await interaction.response.send_message(f"I am ignoring `{user}`.")
|
|
|
- print(1)
|
|
|
else:
|
|
|
await interaction.response.send_message(f"I am not ignoring `{user}`.")
|
|
|
- print(2)
|
|
|
|
|
|
@app_commands.command(name="echo1", description="Echo a message")
|
|
|
async def echo1(self, inter: discord.Interaction, message: str) -> None:
|
|
|
- await inter.response.send_message(message)
|
|
|
-
|
|
|
-
|
|
|
-async def setup(bot: commands.Bot):
|
|
|
- await bot.add_cog(GeneralCommands(bot))
|
|
|
+ await inter.response.send_message(message)
|