Closed CarryTI closed 3 years ago
You don't need to instantiate ChatChannel
you get an instance as the only parameter for that event. See https://dota2.readthedocs.io/en/stable/dota2.features.chat.html#dota2.features.chat.ChannelManager.EVENT_JOINED_CHANNEL
Here is an example:
dota_client = ....
@dota_client.channels.on(dota_client.channels.EVENT_JOINED_CHANNEL)
def on_channel_join(channel):
print(channel)
channel.send("Hi, I just joined this channel")
Closing this due to inactivity
I don't quite understand what data should be written to join_data I tried to send a message from the event there, but I got error.
Code:
Error:
Traceback (most recent call last): File "src\\gevent\\greenlet.py", line 854, in gevent._gevent_cgreenlet.Greenlet.run File "C:/files/projects/dota2/main.py", line 56, in setChat chat = ChatChannel(channel_manager=chat_manager, join_data=joinData) File "C:\files\projects\dota2\env\lib\site-packages\dota2\features\chat.py", line 246, in __init__ self.id = join_data.channel_id AttributeError: 'ChatChannel' object has no attribute 'channel_id' 2020-10-28T09:13:51Z <Greenlet at 0x1c31f72dbf0: setChat(<ChatChannel(789374, 'Lobby_26907975488097378', 3))> failed with AttributeError