From b98e8024d462b98aac4d65fcf8a3aa34a19e90c6 Mon Sep 17 00:00:00 2001 From: nexy7574 Date: Wed, 10 Jan 2024 16:04:58 +0000 Subject: [PATCH] Add interaction check to ollama view --- src/cogs/ollama.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cogs/ollama.py b/src/cogs/ollama.py index 2263b26..6382f06 100644 --- a/src/cogs/ollama.py +++ b/src/cogs/ollama.py @@ -6,6 +6,8 @@ import textwrap import time import typing import io + +from discord import from discord.ui import View, button from fnmatch import fnmatch @@ -21,6 +23,9 @@ class OllamaView(View): self.ctx = ctx self.cancel = asyncio.Event() + async def interaction_check(self, interaction: discord.Interaction) -> bool: + return interaction.user == self.ctx.user + @button(label="Stop", style=discord.ButtonStyle.danger, emoji="\N{wastebasket}\U0000fe0f") async def _stop(self, btn: discord.ui.Button, interaction: discord.Interaction): self.cancel.set()