trying to make a room channel

This commit is contained in:
Alexander Yakovlev 2023-01-23 22:45:39 +06:00
parent 3bd279b9aa
commit 409029e55a
1 changed files with 15 additions and 4 deletions

View File

@ -5,11 +5,13 @@ Rooms are simple containers that has no location of their own.
"""
from lib.rpsystem import ContribRPRoom
from evennia.utils import logger
# rpsystem
class Room(ContribRPRoom):
pass
class VBGB(Room):
def at_say(
self,
message,
@ -19,7 +21,16 @@ class Room(ContribRPRoom):
msg_receivers=None,
**kwargs,
):
channel = typeclasses.channel.msg(message)
# Get list of all Channels
channels = evennia.typeclass.objects.all().iterator()
return message
if not self.channel:
# connect to Evennia channel
channel = search.channel_search("VBGB")
if not channel:
raise RuntimeError(f"Evennia Channel 'VBGB' not found.")
channel = channel[0]
# Cache this channel
self.channel = channel
self.channel.connect(self)
logger.log_msg(message)
logger.log_msg(self.id)
self.channel.msg(message, senders=self.id)
return super().at_say(self, message, msg_self,msg_location, receivers, msg_receivers, **kwargs)