Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Feb 20 02:15

    jaraco on main

    Ran pre-commit autoupdate Merge https://github.com/jaraco… ⚫ Fade to black. (compare)

  • Feb 20 02:09
    jaraco labeled #197
  • Feb 20 02:09

    jaraco on main

    Suppress DeprecationWarning unt… (compare)

  • Feb 20 02:02
    jaraco opened #197
  • Feb 20 01:53

    jaraco on main

    Use preferred 'fixture'. Fixes … (compare)

  • Feb 20 01:52

    jaraco on main

    Update badge year Remove setup.py, no longer need… Add exclusions for pytest 7 dep… and 5 more (compare)

  • Jan 01 23:44

    jaraco on v20.0.0

    (compare)

  • Jan 01 23:44

    jaraco on main

    Remove wheel from build require… Require Python 3.7 or later. Remove filtered warnings, addre… and 5 more (compare)

  • Dec 22 2021 04:18
    fitnub-bosbud synchronize #196
  • Oct 19 2021 21:57
    fitnub-bosbud synchronize #196
  • Oct 19 2021 21:56
    fitnub-bosbud commented #196
  • Oct 19 2021 21:55
    fitnub-bosbud commented #196
  • Oct 19 2021 21:54
    fitnub-bosbud synchronize #196
  • Oct 19 2021 15:36
    jaraco commented #194
  • Oct 19 2021 14:32
    jaraco commented #196
  • Oct 19 2021 14:17

    jaraco on v20.0.0

    (compare)

  • Oct 19 2021 14:17

    jaraco on main

    Implement tidelift banner using… Remove blacken docs as it canno… .editorconfig: Set max_line_len… and 8 more (compare)

  • Oct 18 2021 22:27
    fitnub-bosbud commented #196
  • Oct 13 2021 01:19
    fitnub-bosbud commented #196
  • Oct 13 2021 01:19
    fitnub-bosbud commented #196
ry00001
@ry00001
oh god this is super complex
TurBoss
@TurBoss
it bridges my irc server to matrix.org (aka Riot)
what do you want to do?
ry00001
@ry00001
make an extremely basic bot
TurBoss
@TurBoss
sek
is not too big
only 200 lines
this is the bot section
ry00001
@ry00001
ok
TurBoss
@TurBoss
you can copypaste that code
then init the IrcBot class in your main
ry00001
@ry00001
can i get an ircbot without matrix integration
TurBoss
@TurBoss
sure
jus remove this:
to line 68
ry00001
@ry00001
Where's the example bot code
Jason R. Coombs
@jaraco
@ry00000 You might also look at testbot.py in the IRC project for a super basic example, or pmxbot for a more complex example, though if TurBoss’ ircbot gets you going then that’s fantastic.
ry00001
@ry00001
What's the example bot's prefix supposed to be?
: doesn't work
ry00001
@ry00001
@jaraco what's the example bot's prefix? I tried : but it didn't work
Jason R. Coombs
@jaraco
In test_bot, it looks like the prefix needs to be the bot nickname followed by a colon, so if the bot’s name is mybot, the prefix should be mybot:thecommand.
ry00001
@ry00001
ah
Jason R. Coombs
@jaraco
Each incoming message is handled in on_pubmsg, so you can adapt that to whatever behavior you want.
ry00001
@ry00001
Oh
but on_command is the main cmd loop
Jason R. Coombs
@jaraco
I’m not following. on_command does not appear in the testbot.py script (nor the irc library), so you’re probably getting that from elsewhere.
ry00001
@ry00001
er, no, do_command
sorry
Jason R. Coombs
@jaraco
Oh, right. Well on_pubmsg parses the incoming messages, and detects if there’s a command (as above) and if so, dispatches that using do_command.
ry00001
@ry00001
how do i turn pylint off
it's getting annoying
how do I get arguments from a command?
say i have kick <user> <channel>
how do i get user and channel
Jason R. Coombs
@jaraco
@ry00000: Not sure about pylint. Depends on your editor/environment. I don’t think IRC uses pylint itself.
As for getting arguments from a command, I’m not sure what you’re after. Are you trying as the client (bot) to kick another user from a channel? For that, there’s a kick method on the ServerConnection (https://github.com/jaraco/irc/blob/master/irc/client.py#L803).
Jason R. Coombs
@jaraco
Or if you’re looking to respond to an event where your bot has been kicked, you probably need to define an on_kick method and it accepts a connection and event argument, with more details in the event that the server supplied. I’m not sure the protocol works that way, but if the server issues a KICK command, you would handle that with on_kick in the client.
Alexander
@zylinx
hello
I am subclassing SingleServerIRCBot for a simple IRC bot, i was wondering what is best practice for asynchronously doing work and then calling back to my SingleServerIRCBot instance to send a message to the channel
should i just spawn a new thread from the init and pass it a callback function defined within my subclass ?
Alexander
@zylinx
^still reading on how to do that
Alexander
@zylinx
can i use the irc.schedule module with irc.bot module ?
Jason R. Coombs
@jaraco
@zylinx In general, you shouldn’t need to use threads. The irc.client.Reactor is the default event loop, and it works synchronously (the process_forever method). It has a scheduler instance to which you may add scheduled functions. So you can schedule work to be done. But it really depends on what work it is you want to do. In most cases, the work you need to do is in response to an event from the IRC server and can be handled synchronously. See pmxbot for a mature implementation of a bot built on irc.
One plugin for that bot, the http API at jaraco.pmxbot, does some tricks to run a web server alongside the IRC client to proxy messages. It does that by creating a queue and having the web service run in one thread and periodically poll that queue from the IRC client’s main thread.
Alexander
@zylinx
thanks! my intention is to have the bot scrape rss feeds and webpages etc. and report back as it comes across something.
Alexander
@zylinx
is it possible to access the reactors scheduler instance from inside SingleServerIRCBot subclass ?