IRCServer.alias is no longer optional

This commit is contained in:
jesopo 2019-04-24 11:45:21 +01:00
parent e3100bb64a
commit 032f6fbc3b
2 changed files with 3 additions and 7 deletions

View file

@ -10,7 +10,7 @@ class Server(IRCObject.Object):
bot: "IRCBot.Bot",
events: EventManager.EventHook,
id: int,
alias: typing.Optional[str],
alias: str,
connection_params: utils.irc.IRCConnectionParameters):
self.bot = bot
self.events = events
@ -67,11 +67,7 @@ class Server(IRCObject.Object):
def __repr__(self) -> str:
return "IRCServer.Server(%s)" % self.__str__()
def __str__(self) -> str:
if self.alias:
return self.alias
return "%s:%s%s" % (self.connection_params.hostname,
"+" if self.connection_params.tls else "",
self.connection_params.port)
def fileno(self) -> int:
return self.socket.fileno()

View file

@ -225,7 +225,7 @@ def parse_format(s: str) -> str:
OPT_STR = typing.Optional[str]
class IRCConnectionParameters(object):
def __init__(self, id: int, alias: OPT_STR, hostname: str, port: int,
def __init__(self, id: int, alias: str, hostname: str, port: int,
password: OPT_STR, tls: bool, ipv4: bool, bindhost: OPT_STR,
nickname: str, username: OPT_STR, realname: OPT_STR,
args: typing.Dict[str, str]={}):