A 'linkme'-like bot for /r/ArchLinux
I was inspired by this post a few moths ago to make a Linkme bot for /r/ArchLinux, but not only for the AUR like /u/tvgdb suggested, but for the official packages and wiki too.
Two days ago I found my old version of the code, so I decided to refurbish it and actually make it work, and now it is (hopefully) ready.
What is a linkme bot?
A linkme bot parses the comments of a subreddit and replies to certain comments that contain certain syntax, indicating that the bot should respond. The response is contains a link and possibly some information on the subject.
How to use?
Your comment has to contain some text to match this regex:
(?:^|[\s,.!?,-])(aur|pac|wiki)/([\w@+.\-]+)(?:$|[\s,.!?,]). ((aur|pac|wiki)/([\w@+.\-]+)is the important part. )
type/name
The first part indicated where to search (aur, pac [pacages] or wiki), followed by a
'/'and the name of the package or the article.
The characters before and after have to either whitespaces or non-existant.
Arch wiki links are automatically parsed.
You can mention more than one package/page in one comment, all should be mentioned.
Invocation examples:
Valid:
I use aur/atom-editor and pac/vim
pac/coreutils
check out wiki/pacman for more information
Invalid:
This is cool **pac/emacs**( The starts are not whitespaces )
wik/fef(wikis not valid)
Is it currently running?
Yes, finally I was able to fix it, and make it run on heroku.
Please contact me if you have any problems with this bot, it's still in testing.
Help me get karma (better commenting): http://redd.it/2sngvs
Contact: /u/SurviAvi
Edited 29 Mar 2015. We only hold this version.
About this post
- Posted
- Archived
- Edited
- Score
- 43 · 100% up
- Kind
- Text
- ID
- 2snl5x
57 comments
aur/"); DROP TABLE STUDENTS;
Little Bobby Tables...
Awesome! Testing this with aur/qutebrowser
Deleted before we saved it.
Good job /u/archlinkbot! Let's try again with aur/gstreamer0.10-good-plugins-slim
Edit: Oh, I see it's not currently running. We'll play another time.
Deleted before we saved it.
Deleted before we saved it.
This broke in https://www.reddit.com/r/archlinux/comments/2sq70e/python_shell/cnruukj where it thought https://en.m.wikipedia.org/wiki/IPython was a link to an archlinux wiki page, which it obviously is not. You problably want to change https://gist.github.com/phikal/271374cf5eee9c659c7f#file-allb-py-L74
to
so the regular expression really only matches if aur/pac/wiki is preceded by whitespace (untested).
/edit: Your current regex also matches
This is cool **pac/emacs**which you list as an invalid example.I'm working on that already, and thanks for the suggestion.
I'm thinking of using something in the direction of
with
*instead of+, since whitespaces are not neccecary, but the other option besides no spaces at all. It's still not working, but thansk again for the support.\s*has exactly the same problem as\s?which is that it can match 0 or more (or 1 in case of ?) repititions of whitespace.Deleted before we saved it.
Deleted before we saved it.
pac/coreutils
Deleted before we saved it.
Deleted before we saved it.
Deleted before we saved it.
I completely forgot about that post, great you made a working version!
Is it running right now? Either way, once you've got it all worked out, it looks pretty sweet. Testing:
aur/toilet
Deleted before we saved it.
Deleted before we saved it.
Deleted before we saved it.
Deleted before we saved it.
Deleted before we saved it.
Deleted before we saved it.
Deleted before we saved it.
Deleted before we saved it.
Deleted before we saved it.
Deleted before we saved it.
Deleted before we saved it.
Deleted before we saved it.
Deleted before we saved it.
Deleted before we saved it.
Deleted before we saved it.
Deleted before we saved it.
Deleted before we saved it.
Deleted before we saved it.
wiki/USB_3G_Modem
Deleted before we saved it.
http://reddit.com/r/archlinux/comments/2s2r9g/fixing_a_boot_problem/cnv28a2
That comment isn't super useful.
Deleted before we saved it.
Deleted before we saved it.