Add interaction check to ollama view

This commit is contained in:
Nexus 2024-01-10 16:04:58 +00:00
parent d0809a4881
commit b98e8024d4

View file

@ -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()