|
| 1 | +""" |
| 2 | +The MIT License (MIT) |
| 3 | +
|
| 4 | +Copyright (c) 2015-2021 Rapptz |
| 5 | +Copyright (c) 2021-present Pycord Development |
| 6 | +
|
| 7 | +Permission is hereby granted, free of charge, to any person obtaining a |
| 8 | +copy of this software and associated documentation files (the "Software"), |
| 9 | +to deal in the Software without restriction, including without limitation |
| 10 | +the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 11 | +and/or sell copies of the Software, and to permit persons to whom the |
| 12 | +Software is furnished to do so, subject to the following conditions: |
| 13 | +
|
| 14 | +The above copyright notice and this permission notice shall be included in |
| 15 | +all copies or substantial portions of the Software. |
| 16 | +
|
| 17 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 18 | +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 20 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 22 | +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 23 | +DEALINGS IN THE SOFTWARE. |
| 24 | +""" |
| 25 | +from __future__ import annotations |
| 26 | + |
| 27 | +from discord.enums import Enum |
| 28 | + |
| 29 | + |
| 30 | +class OpCodes(Enum): |
| 31 | + # fmt: off |
| 32 | + identify = 0 |
| 33 | + select_protocol = 1 |
| 34 | + ready = 2 |
| 35 | + heartbeat = 3 |
| 36 | + session_description = 4 |
| 37 | + speaking = 5 |
| 38 | + heartbeat_ack = 6 |
| 39 | + resume = 7 |
| 40 | + hello = 8 |
| 41 | + resumed = 9 |
| 42 | + client_connect = 10 |
| 43 | + client_disconnect = 11 |
| 44 | + # fmt: on |
| 45 | + |
| 46 | + def __eq__(self, other: object) -> bool: |
| 47 | + if isinstance(other, int): |
| 48 | + return self.value == other |
| 49 | + elif isinstance(other, self.__class__): |
| 50 | + return self is other |
| 51 | + return NotImplemented |
| 52 | + |
| 53 | + def __int__(self) -> int: |
| 54 | + return self.value |
0 commit comments