Merge pull request #2 from fndax/patch-1

Make simple.py work again (based on sasl.py)
This commit is contained in:
jesopo 2020-04-21 20:44:26 +01:00 committed by GitHub
commit 43ea927cdb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,21 +2,25 @@ import asyncio
from irctokens import build, Line from irctokens import build, Line
from ircrobots import Bot as BaseBot from ircrobots import Bot as BaseBot
from ircrobots import ConnectionParams, Server from ircrobots import Server as BaseServer
from ircrobots import ConnectionParams
SERVERS = [ SERVERS = [
("freenode", "chat.freenode.invalid") ("freenode", "chat.freenode.invalid")
] ]
class Bot(BaseBot): class Server(BaseServer):
async def line_read(self, server: Server, line: Line): async def line_read(self, line: Line):
print(f"{server.name}< {line.format()}") print(f"{self.name} < {line.format()}")
if line.command == "001": if line.command == "001":
print(f"connected to {server.isupport.network}") print(f"connected to {self.isupport.network}")
await server.send(build("JOIN", ["#testchannel"])) await self.send(build("JOIN", ["#testchannel"]))
async def line_send(self, line: Line):
print(f"{self.name} > {line.format()}")
async def line_send(self, server: Server, line: Line): class Bot(BaseBot):
print(f"{server.name}> {line.format()}") def create_server(self, name: str):
return Server(self, name)
async def main(): async def main():
bot = Bot() bot = Bot()