Passed
Push — main ( a2405b...1014a8 )
by Yohann
01:28
created

pincer.middleware.message_delete   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 6
dl 0
loc 43
rs 10
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A export() 0 2 1
A on_message_delete_middleware() 0 11 1
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
25
"""sent when a message is deleted in a subscribed text channel"""
26
27
28
async def on_message_delete_middleware(payload: GatewayDispatch):
0 ignored issues
show
Comprehensibility Best Practice introduced by
Undefined variable 'GatewayDispatch'
Loading history...
29
    """
30
    Middleware for ``on_message_delete`` event.
31
32
    :param self:
33
        The current client.
34
35
    :param payload:
36
        The data received from the delete message event.
37
    """
38
    return "on_message_delete", [MessageDeleteEvent.from_dict(payload.data)]
0 ignored issues
show
Comprehensibility Best Practice introduced by
Undefined variable 'MessageDeleteEvent'
Loading history...
Comprehensibility Best Practice introduced by
The variable MessageDeleteEvent does not seem to be defined.
Loading history...
39
40
41
def export():
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
42
    return on_message_delete_middleware
43