Add interaction check to ollama view
This commit is contained in:
parent
d0809a4881
commit
b98e8024d4
1 changed files with 5 additions and 0 deletions
|
@ -6,6 +6,8 @@ import textwrap
|
||||||
import time
|
import time
|
||||||
import typing
|
import typing
|
||||||
import io
|
import io
|
||||||
|
|
||||||
|
from discord import
|
||||||
from discord.ui import View, button
|
from discord.ui import View, button
|
||||||
from fnmatch import fnmatch
|
from fnmatch import fnmatch
|
||||||
|
|
||||||
|
@ -21,6 +23,9 @@ class OllamaView(View):
|
||||||
self.ctx = ctx
|
self.ctx = ctx
|
||||||
self.cancel = asyncio.Event()
|
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")
|
@button(label="Stop", style=discord.ButtonStyle.danger, emoji="\N{wastebasket}\U0000fe0f")
|
||||||
async def _stop(self, btn: discord.ui.Button, interaction: discord.Interaction):
|
async def _stop(self, btn: discord.ui.Button, interaction: discord.Interaction):
|
||||||
self.cancel.set()
|
self.cancel.set()
|
||||||
|
|
Loading…
Reference in a new issue