Add Bot parameters when creating Server objects in examples

This commit is contained in:
Dax 2020-04-20 01:20:08 +00:00
parent feb71d5b14
commit b45dfaf480
2 changed files with 4 additions and 4 deletions

View file

@ -62,8 +62,8 @@ class Database:
del self._settings[setting] del self._settings[setting]
class Server(BaseServer): class Server(BaseServer):
def __init__(self, name: str, channel: str, database: Database): def __init__(self, bot: Bot, name: str, channel: str, database: Database):
super().__init__(name) super().__init__(bot, name)
self._channel = channel self._channel = channel
self._database = database self._database = database
@ -146,7 +146,7 @@ class Bot(BaseBot):
super().__init__() super().__init__()
self._channel = channel self._channel = channel
def create_server(self, name: str): def create_server(self, name: str):
return Server(name, self._channel, Database()) return Server(self, name, self._channel, Database())
async def main(hostname: str, channel: str, nickname: str): async def main(hostname: str, channel: str, nickname: str):
bot = Bot(channel) bot = Bot(channel)

View file

@ -13,7 +13,7 @@ class Server(BaseServer):
class Bot(BaseBot): class Bot(BaseBot):
def create_server(self, name: str): def create_server(self, name: str):
return Server(name) return Server(self, name)
async def main(): async def main():
bot = Bot() bot = Bot()