-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdiscord_fake_classes.py
49 lines (38 loc) · 1.25 KB
/
discord_fake_classes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
class FakeMessage:
id = 0
def __init__(self, author, guild, channel, content, interaction_id=None, interaction_token=None):
self.author = author
self.guild = guild
self.channel = FakeChannel(channel)
self.channel.recipient = author
self.content = content
self.interaction_id = interaction_id
self.interaction_token = interaction_token
class FakeChannel:
def __init__(self, channel):
self.typing = FakeTyping
self.channel = channel
self.permissions_for = None
if hasattr(channel, 'permissions_for'):
self.permissions_for = channel.permissions_for
self.recipient = None
def send(self, *args, **kwargs):
return self.channel.send(*args, **kwargs)
@property
def id(self):
return self.channel.id
@property
def type(self):
return self.channel.type
@property
def name(self):
return self.channel.name
def __str__(self) -> str:
return str(self.channel)
class FakeTyping:
async def __aenter__(self):
""" mimics the async enter for Typing """
pass
async def __aexit__(self, type, value, traceback):
""" mimics the async exit for Typing """
pass