matpow2 / cuwo

Open server and utilities for Cube World
GNU General Public License v3.0
170 stars 49 forks source link

Add optional kick reasons #178

Closed TheReverend403 closed 9 years ago

matpow2 commented 9 years ago

CubeWorldConnection.kick should definitely not take a varg argument. Do the ' '.join in the command itself, and make the reason argument optional in CubeWorldConnection.kick (default None).

TheReverend403 commented 9 years ago

Like this?

matpow2 commented 9 years ago

Kick method needs to have this signature, since we want to stay backwards-compatible, and sometimes, you probably don't want to provide a reason in your code.

def kick(self, reason=None):
TheReverend403 commented 9 years ago

I'm not too sure about the line break before the formatting arguments, but I think this is what you had in mind.

matpow2 commented 9 years ago

Maybe consider

    def kick(self, reason=None):
        postfix = ': %s' % reason if reason is not None else ''
        self.send_chat('You have been kicked%s' % postfix)
        self.server.send_chat('%s has been kicked%s' % (self.name, postfix))
        self.disconnect()

:)

TheReverend403 commented 9 years ago

:thumbsup: