Esempio n. 1
0
 def func(self):
     """
     Create a new message and send it to channel, using
     the already formatted input.
     """
     caller = self.caller
     self.character = self.caller
     self.player = self.caller.player
     channelkey, msg = self.args
     if not msg:
         self.sys_msg("Say what?")
         return
     channel = evennia.ChannelDB.objects.get_channel(channelkey)
     if not channel:
         self.error("Channel '%s' not found." % channelkey)
         return
     if not channel.has_connection(caller):
         string = "You are not connected to channel '%s'."
         self.error(string % channelkey)
         return
     if not channel.access(caller, 'send'):
         string = "You are not permitted to send to channel '%s'."
         self.error(string % channelkey)
         return
     speech = make_speech(self.character, msg, mode='channel')
     channel.speak(speech)
Esempio n. 2
0
    def reply(self):
        if not self.args:
            self.error("What will you say?")
            return
        targets = self.character.page.last_from
        online = [char for char in targets if hasattr(char, 'player')]
        if not online:
            self.error("Nobody is listening...")
            return

        speech = make_speech(self.character, self.args, mode='page', targets=online)
        online = set(online)
        self.character.page.send(online, speech)
Esempio n. 3
0
    def main(self):
        if self.cmdstring.lower() == 'reply':
            self.reply()
            return
        if not self.args:
            self.error("What will you say?")
        if '=' in self.args:
            if not self.lhs:
                self.error("Who will you send to?")
                return
            if not self.lhs:
                self.error("What will you say?")
                return
            targets = list()
            for name in self.lhslist:
                try:
                    found = self.character.search_character(name)
                    targets.append(found)
                except ValueError as err:
                    self.error(str(err))
            text = self.rhs
        else:
            targets = self.character.page.last_to
            text = self.args

        online = [char for char in targets if hasattr(char, 'player')]
        print online
        for char in targets:
            if char not in online:
                self.error("%s is offline." % char)

        if not online:
            self.error("Nobody is listening...")

        online = set(online)

        speech = make_speech(self.character, text, mode='page', targets=online)
        self.character.page.send(online, speech)