first commit
This commit is contained in:
parent
bd274c1f49
commit
a327d5dd96
6 changed files with 194 additions and 0 deletions
26
examples/simple.py
Normal file
26
examples/simple.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
import asyncio
|
||||
|
||||
from irctokens import build, Line
|
||||
|
||||
from ircrobots.bot import Bot as BaseBot
|
||||
from ircrobots.server import ConnectionParams, Server
|
||||
|
||||
SERVERS = [
|
||||
("freenode", "chat.freenode.net"),
|
||||
("tilde", "ctrl-c.tilde.chat")
|
||||
]
|
||||
|
||||
class Bot(BaseBot):
|
||||
async def line_read(self, server: Server, line: Line):
|
||||
if line.command == "001":
|
||||
print(f"connected to {server.isupport.network}")
|
||||
await server.send(build("JOIN", ["#testchannel"]))
|
||||
|
||||
async def main():
|
||||
bot = Bot()
|
||||
for name, host in SERVERS:
|
||||
params = ConnectionParams("BitBotNewTest", host, 6697, True)
|
||||
await bot.add_server(name, params)
|
||||
await bot.run()
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
Loading…
Add table
Add a link
Reference in a new issue