(client): Add noop interaction handling.
This commit is contained in:
@@ -2,10 +2,12 @@ from discord import Intents
|
|||||||
from cmdClient.cmdClient import cmdClient
|
from cmdClient.cmdClient import cmdClient
|
||||||
|
|
||||||
from . import patches
|
from . import patches
|
||||||
|
from .interactions import InteractionType
|
||||||
from .config import conf
|
from .config import conf
|
||||||
from .sharding import shard_number, shard_count
|
from .sharding import shard_number, shard_count
|
||||||
from LionContext import LionContext
|
from LionContext import LionContext
|
||||||
|
|
||||||
|
|
||||||
# Initialise client
|
# Initialise client
|
||||||
owners = [int(owner) for owner in conf.bot.getlist('owners')]
|
owners = [int(owner) for owner in conf.bot.getlist('owners')]
|
||||||
intents = Intents.all()
|
intents = Intents.all()
|
||||||
@@ -19,3 +21,14 @@ client = cmdClient(
|
|||||||
baseContext=LionContext
|
baseContext=LionContext
|
||||||
)
|
)
|
||||||
client.conf = conf
|
client.conf = conf
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: Could include client id here, or app id, to avoid multiple handling.
|
||||||
|
NOOP_ID = 'NOOP'
|
||||||
|
|
||||||
|
|
||||||
|
@client.add_after_event('interaction_create')
|
||||||
|
async def handle_noop_interaction(client, interaction):
|
||||||
|
if interaction.interaction_type in (InteractionType.MESSAGE_COMPONENT, InteractionType.MODAL_SUBMIT):
|
||||||
|
if interaction.custom_id == NOOP_ID:
|
||||||
|
interaction.ack()
|
||||||
|
|||||||
Reference in New Issue
Block a user