#2 fix up irccat example

This commit is contained in:
theunkn0wn1 2018-07-24 10:25:50 -07:00
parent 59f9b32b70
commit b77df2e79c
No known key found for this signature in database
GPG Key ID: 7D48BCACF828D705
1 changed files with 6 additions and 6 deletions

View File

@ -8,9 +8,9 @@ import logging
import asyncio import asyncio
from asyncio.streams import FlowControlMixin from asyncio.streams import FlowControlMixin
from .. import async, Client, __version__ from .. import Client, __version__
from . import _args from . import _args
import asyncio
class IRCCat(Client): class IRCCat(Client):
""" irccat. Takes raw messages on stdin, dumps raw messages to stdout. Life has never been easier. """ """ irccat. Takes raw messages on stdin, dumps raw messages to stdout. Life has never been easier. """
@ -18,12 +18,12 @@ class IRCCat(Client):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.async_stdin = None self.async_stdin = None
@async.coroutine @asyncio.coroutine
def _send(self, data): def _send(self, data):
sys.stdout.write(data) sys.stdout.write(data)
yield from super()._send(data) yield from super()._send(data)
@async.coroutine @asyncio.coroutine
def process_stdin(self): def process_stdin(self):
""" Yes. """ """ Yes. """
loop = self.eventloop.loop loop = self.eventloop.loop
@ -40,12 +40,12 @@ class IRCCat(Client):
yield from self.quit('EOF') yield from self.quit('EOF')
@async.coroutine @asyncio.coroutine
def on_raw(self, message): def on_raw(self, message):
print(message._raw) print(message._raw)
yield from super().on_raw(message) yield from super().on_raw(message)
@async.coroutine @asyncio.coroutine
def on_ctcp_version(self, source, target, contents): def on_ctcp_version(self, source, target, contents):
self.ctcp_reply(source, 'VERSION', 'pydle-irccat v{}'.format(__version__)) self.ctcp_reply(source, 'VERSION', 'pydle-irccat v{}'.format(__version__))