|
1
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
|
2
|
|
|
# MIT License |
|
3
|
|
|
# |
|
4
|
|
|
# Copyright (c) 2021 Pincer |
|
5
|
|
|
# |
|
6
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining |
|
7
|
|
|
# a copy of this software and associated documentation files |
|
8
|
|
|
# (the "Software"), to deal in the Software without restriction, |
|
9
|
|
|
# including without limitation the rights to use, copy, modify, merge, |
|
10
|
|
|
# publish, distribute, sublicense, and/or sell copies of the Software, |
|
11
|
|
|
# and to permit persons to whom the Software is furnished to do so, |
|
12
|
|
|
# subject to the following conditions: |
|
13
|
|
|
# |
|
14
|
|
|
# The above copyright notice and this permission notice shall be |
|
15
|
|
|
# included in all copies or substantial portions of the Software. |
|
16
|
|
|
# |
|
17
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|
18
|
|
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|
19
|
|
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|
20
|
|
|
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
|
21
|
|
|
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
|
22
|
|
|
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
|
23
|
|
|
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
24
|
|
|
from dataclasses import dataclass |
|
25
|
|
|
from enum import Enum |
|
26
|
|
|
|
|
27
|
|
|
from pincer.utils.api_object import APIObject |
|
28
|
|
|
from pincer.utils.snowflake import Snowflake |
|
29
|
|
|
from .user import User |
|
30
|
|
|
|
|
31
|
|
|
|
|
32
|
|
|
class InteractionType(Enum): |
|
33
|
|
|
""" |
|
34
|
|
|
Represents the different types of interactions the client |
|
35
|
|
|
can have with a member. |
|
36
|
|
|
|
|
37
|
|
|
:param CHAT_INPUT: |
|
38
|
|
|
Slash commands; a text-based command that shows up when a user types / |
|
39
|
|
|
|
|
40
|
|
|
:param USER: |
|
41
|
|
|
A UI-based command that shows up when you right click or tap on a user |
|
42
|
|
|
|
|
43
|
|
|
:param MESSAGE: |
|
44
|
|
|
A UI-based command that shows up when you right click or tap on a message |
|
45
|
|
|
""" |
|
46
|
|
|
PING = 1 |
|
47
|
|
|
APPLICATION_COMMAND = 2 |
|
48
|
|
|
MESSAGE_COMPONENT = 2 |
|
49
|
|
|
|
|
50
|
|
|
|
|
51
|
|
|
@dataclass |
|
52
|
|
|
class MessageInteraction(APIObject): |
|
53
|
|
|
""" |
|
54
|
|
|
Represents a Discord Message Interaction object |
|
55
|
|
|
|
|
56
|
|
|
This is sent on the message object when the message |
|
57
|
|
|
is a response to an Interaction without an existing message. |
|
58
|
|
|
|
|
59
|
|
|
:param id: id of the interaction |
|
60
|
|
|
:param type: the type of interaction |
|
61
|
|
|
:param name: the name of the application command |
|
62
|
|
|
:param user: the user who invoked the interaction |
|
63
|
|
|
""" |
|
64
|
|
|
id: Snowflake |
|
|
|
|
|
|
65
|
|
|
type: InteractionType |
|
66
|
|
|
name: str |
|
67
|
|
|
user: User |
|
68
|
|
|
|