pincer.objects.events.message   A
last analyzed

Complexity

Total Complexity 0

Size/Duplication

Total Lines 158
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 0
eloc 48
dl 0
loc 158
rs 10
c 0
b 0
f 0
1
# Copyright Pincer 2021-Present
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
# Full MIT License can be found in `LICENSE` at the project root.
3
4
from __future__ import annotations
5
6
from dataclasses import dataclass
7
from typing import TYPE_CHECKING
8
9
from ...utils.api_object import APIObject, ChannelProperty, GuildProperty
10
from ...utils.types import APINullable, MISSING
11
12
if TYPE_CHECKING:
13
    from typing import List
14
15
    from ..message.emoji import Emoji
16
    from ..guild.member import GuildMember
17
    from ...utils.snowflake import Snowflake
18
19
20
@dataclass(repr=False)
21
class MessageDeleteEvent(APIObject, ChannelProperty, GuildProperty):
22
    """Sent when a message is deleted.
23
24
    Attributes
25
    ----------
26
    id: :class:`~pincer.utils.snowflake.Snowflake`
27
        The id of the message
28
    channel_id: :class:`~pincer.utils.snowflake.Snowflake`
29
        The id of the channel
30
    guild_id: APIObject[:class:`~pincer.utils.snowflake.Snowflake`]
31
        The id of the guild
32
    """
33
34
    id: Snowflake
35
    channel_id: Snowflake
36
37
    guild_id: APINullable[Snowflake] = MISSING
38
39
40
@dataclass(repr=False)
41
class MessageDeleteBulkEvent(APIObject, ChannelProperty, GuildProperty):
42
    """Sent when multiple messages are deleted at once.
43
44
    Attributes
45
    ----------
46
    ids: List[:class:`~pincer.utils.snowflake.Snowflake`]
47
        The ids of the messages
48
    channel_id: :class:`~pincer.utils.snowflake.Snowflake`
49
        The id of the channel
50
    guild_id: APIObject[:class:`~pincer.utils.snowflake.Snowflake`]
51
        The id of the guild
52
    """
53
54
    ids: List[Snowflake]
55
    channel_id: Snowflake
56
57
    guild_id: APINullable[Snowflake] = MISSING
58
59
60
@dataclass(repr=False)
61
class MessageReactionAddEvent(APIObject, ChannelProperty, GuildProperty):
62
    """Sent when a user adds a reaction to a message.
63
64
    Attributes
65
    ----------
66
    user_id: :class:`~pincer.utils.snowflake.Snowflake`
67
        The id of the user
68
    channel_id: :class:`~pincer.utils.snowflake.Snowflake`
69
        The id of the channel
70
    message_id: :class:`~pincer.utils.snowflake.Snowflake`
71
        The id of the message
72
    emoji: :class:`~pincer.objects.message.emoji.Emoji`
73
        The emoji used to react
74
    guild_id: APINullable[:class:`~pincer.utils.snowflake.Snowflake`]
75
        The id of the guild
76
    member: :class:`~pincer.objects.guild.member.GuildMember`
77
        The member who reacted if this happened in a guild
78
    """
79
80
    user_id: Snowflake
81
    channel_id: Snowflake
82
    message_id: Snowflake
83
    emoji: Emoji
84
85
    guild_id: APINullable[Snowflake] = MISSING
86
    member: APINullable[GuildMember] = MISSING
87
88
89
@dataclass(repr=False)
90
class MessageReactionRemoveEvent(APIObject, ChannelProperty, GuildProperty):
91
    """Sent when a user removes a reaction from a message.
92
93
    Attributes
94
    ----------
95
    user_id: :class:`~pincer.utils.snowflake.Snowflake`
96
        The id of the user
97
    channel_id: :class:`~pincer.utils.snowflake.Snowflake`
98
        The id of the channel
99
    message_id: :class:`~pincer.utils.snowflake.Snowflake`
100
        The id of the message
101
    emoji: :class:`~pincer.objects.message.emoji.Emoji`
102
        The emoji used to react
103
    guild_id: APINullable[:class:`~pincer.utils.snowflake.Snowflake`]
104
        The id of the guild
105
    """
106
107
    user_id: Snowflake
108
    channel_id: Snowflake
109
    message_id: Snowflake
110
    emoji: Emoji
111
112
    guild_id: APINullable[Snowflake] = MISSING
113
114
115
@dataclass(repr=False)
116
class MessageReactionRemoveAllEvent(APIObject, ChannelProperty, GuildProperty):
117
    """Sent when a user explicitly removes all reactions from a message.
118
119
    Attributes
120
    ----------
121
    channel_id: :class:`~pincer.utils.snowflake.Snowflake`
122
        The id of the channel
123
    message_id: :class:`~pincer.utils.snowflake.Snowflake`
124
        The id of the message
125
    guild_id: APINullable[:class:`~pincer.utils.snowflake.Snowflake`]
126
        The id of the guild
127
    """
128
129
    channel_id: Snowflake
130
    message_id: Snowflake
131
    guild_id: APINullable[Snowflake] = MISSING
132
133
134
@dataclass(repr=False)
135
class MessageReactionRemoveEmojiEvent(
136
    APIObject, ChannelProperty, GuildProperty
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block (add 4 spaces).
Loading history...
137
):
138
    """Sent when a bot removes all instances of a given
139
    emoji from the reactions of a message.
140
141
    Attributes
142
    ----------
143
    channel_id: :class:`~pincer.utils.snowflake.Snowflake`
144
        The id of the channel
145
    message_id: :class:`~pincer.utils.snowflake.Snowflake`
146
        The id of the message
147
    emoji: :class:`~pincer.objects.message.emoji.Emoji`
148
        The emoji that was removed
149
    guild_id: APINullable[:class:`~pincer.utils.snowflake.Snowflake`]
150
        The id of the guild
151
    """
152
153
    channel_id: Snowflake
154
    message_id: Snowflake
155
    emoji: Emoji
156
157
    guild_id: APINullable[Snowflake] = MISSING
158