« first day (8 days earlier)      last day (123 days later) » 

12:40 AM
[WolfBot] Found filtered post, matches word mint: Cinnamon/ kde #kde desktop
 
1:04 AM
[WolfBot] Found filtered post, matches word mint: aspire one blocks wireless acess
 
 
4 hours later…
4:36 AM
[WolfBot] Found filtered post, matches word mint: Mystery MSI motherboard sound not working in Linux, shows dummy output
 
!!/reload all
!!/restart
!!/start
@WolfBot are you alive?
 
[WolfBot] Found filtered post, matches word mint: How to access files on USB with grub2
 
 
1 hour later…
6:00 AM
!!/start
wait... what
oh something command-wise crashed
urg
!!/start
 
@KazWolfe Hi there! Welcome to WolfBot!
 
there we go. I really need to implement a better command handler.
 
Enter Nathan Osman.
 
o/
so, i found a nice bug with the bot.
 
"nice"?
 
6:06 AM
Apparently, if an exception is thrown in the command or monitor thread, the bot stops listening to commands.
 
Enter James Tobin
 
so i need to run an exception handler of some sort on an alternate thread, restarting that thread if that exception is thrown (logging the error, of course)
i mean, the restart and log is not the hard issue, but I don't know how to catch an exception in that other thread.
 
try:
    # ...something risky
except:
    # recovery
 
^-- that line is what registers the listener on a thread.
ah, here's the thing. i register the handler, and then the program moves on to the next line.
Unless Python except statements jump into the threads spawned?
 
Wait, so the handler is throwing the exception?
 
6:09 AM
yep.
 
So you need the try...catch in on_message() then.
Wrap whatever it is in on_message() that's throwing the exception.
 
also that brings up another question for you.
So, as you see in that github link, there's that room.watch() directive, which spawns a thread.
 
Yup.
 
Is there a way to grab the thread spawned by that, so I can do things like kill it?
 
Where is the thread being created?
 
6:12 AM
at room.watch()
it's happening somewhere in ChatExchange.
 
They're using a separate thread?
 
Correct.
┌─[✗]─[23:02:30]─[kazwolfe@BlackHawk]
└──> WolfBot-SE $ python WolfCore.py
WolfBot loading... please wait.
WolfBot online.
Got command start with args
 
This would all be so much easier if they used something like Twisted...
 
which is?
 
It uses events instead of threads.
But anyway, that's nothing you can fix.
Let me look at the implementation in ChatExchange.
 
6:13 AM
See, what I'd like to be able to do is take that thread, and kill it. Essentially, this would be for a command to move the bot to a new room without restarting the bot itself.
If I can monitor that thread, I can probably watch for exceptions as well, and then handle them as they're thrown.
(and well, there's the bot-reload issue where i need to restart it to actually reload the modules, but I don't think I can fix that with my structure.)
 
Well now.
That's what watch() returns.
 
oh. i can grab a thread from it?
 
Looks like you can call .close() on the object returned.
 
that doesn't kill the thread though, which is something that I have to do, but now that there's a method for that...
now... how do I watch for exceptions on that thread in order to respawn it?
i mean, i have the thread object, i assume python threads can be read for exceptions
 
@KazWolfe It doesn't?
 
6:19 AM
@NathanOsman it just marks it as "killed" to stop the loop, or that's what I'm seeing
 
@KazWolfe No, no, no. The exception should be caught in your handler.
@KazWolfe Isn't that close enough?
 
@NathanOsman well no, i need the thread completely gone, I think.
@NathanOsman ah, here's where it gets complicated. The errors might not be just in my handler. It might be in that code itself (connection loss)
 
Oooooh.
So you want to rejoin when it dies.
(BTW, you might want to submit a bug to them for that.)
 
yeah, i know other bots just restart the thread, like Telepot.
 
The object returned from .watch() has a thread property.
...which is a threading.Thread object.
So you could try that.
 
6:23 AM
can SE just have a well-designed API for this?
Like a JSON postback I can listen to or something?
 
I'm going to be working on a Go client soon enough.
That should really simplify things considerably.
 
but python
 
I can build a Go => Python bridge once it is confirmed to work well.
 
i'll take it
this is a very nice API that I'd love to see made for SE chat --^
or at least something with that featureset. Something where I can just pass a script to run on, that passes the exception up.
Of course I can handle code exceptions in my thing manually using try-except and move on, but...
i should probably add a Try-Except to my command executor.
brb trying something
oh, @NathanOsman, because don't exceptions kill the entire thread if not caught?
 
I'm betting they do.
 
6:31 AM
God, there is a lot of honking outside my (temporary) apartment.
!!/start
wolfbot has shut down?
 
i'm fixing him
 
I like a little construction work
 
!!/start
 
@KazWolfe Hi there! Welcome to WolfBot!
 
!!/throwex error
 
6:34 AM
@KazWolfe Uh oh! I ran into a problem :(. See the console for more details.
 
Hai Wolfbot
 
!!start
!!/start
 
@KazWolfe Hi there! Welcome to WolfBot!
 
She works?
 
YAY IT DOESN'T CRASH ON BAD COMMANDS
WolfBot loading... please wait.
WolfBot online.
Got command start with args
Got command throwex with args error
Ow! Ran into a problem. Log follows:
Traceback (most recent call last):
  File "WolfCore.py", line 33, in on_message
    COMMANDS.execute(message, cmd, args)
  File "/home/kazwolfe/Developer/WolfBot-SE/WolfPlugin.py", line 46, in execute
    command["function"](message, args)
  File "/home/kazwolfe/Developer/WolfBot-SE/plugins/DebugPlugin.py", line 41, in throwex
    if len(args['params']) == 0:
yay copy-paste code to forcefully cause an exception!
 
6:35 AM
\o/
 
so... not sure on connection loss actually.
the browser may handle that ex.
 
Yay
 
!!/throwex error 1
 
@KazWolfe Uh oh! I ran into a problem :(. See the console for more details.
 
?!?
 
6:37 AM
!!/throwex baderror
 
@KazWolfe Uh oh! I ran into a problem :(. See the console for more details.
 
Traceback (most recent call last):
  File "WolfCore.py", line 33, in on_message
    COMMANDS.execute(message, cmd, args)
  File "/home/kazwolfe/Developer/WolfBot-SE/WolfPlugin.py", line 46, in execute
    command["function"](message, args)
  File "/home/kazwolfe/Developer/WolfBot-SE/plugins/DebugPlugin.py", line 46, in throwex
    raise RuntimeError(msg)
RuntimeError: baderror
ty @NathanOsman, i can't believe i'm an idiot enough to not encapsulate my command handler
 
No problem.
Glad to help.
 
now to actually manage the thread for reloads
 
And I'll get working on that Go bridge soon enough :)
 
6:39 AM
and to actually re-import modules into the active interpreter.
Those are gonna be hard.
 
Yeah
 
Well, it's hard because I can't seem to reload modules on-the-fly.
 
Manually?
You have to reload modules manually?*
 
there's a reload command that's supposed to handle this stuff.
But right now, because I'm lazy, it reloads the entire system instead of just the plugins.
 
lol
 
6:42 AM
if @NathanOsman can shed any light on how to do that, which seems to be really hard, i would love that.
 
What about this?
377
A: How do I unload (reload) a Python module?

cdlearyYou can reload a module when it has already been imported by using the reload builtin function in Python 2: import foo while True: # Do some things. if is_changed(foo): foo = reload(foo) In Python 3, reload was moved to the imp module. In 3.4, imp was deprecated in favor of im...

 
@NathanOsman I use from x import y so...
 
Oh, hmm...
 
You could do a manual import...
 
6:45 AM
it automatically grabs everything.
so...
 
Look at the importlib module.
You import the entire module and store it in a variable. Then you just pluck what you need from that.
Then you should be able to discard the object when you're done and call reload() on the modules.
Or something like that.
 
Wolfbot, NOOOOOOOOOOOO
 
@Edity what
 
He left
 
!!/start
 
6:56 AM
@KazWolfe Hi there! Welcome to WolfBot!
 
@NathanOsman can i get permission to move WolfBot to the general room for a second?
 
I'm not a site moderator, but I reckon it won't hurt.
I can clean up any mess that gets left.
 
!!/start
 
@KazWolfe Hi there! Welcome to WolfBot!
 
!!/setroom
 
6:57 AM
@KazWolfe Needs one argument (room_id)
 
!!/setroom 201
 
@KazWolfe Uh oh! I ran into a problem :(. See the console for more details.
 
!!/setroom 201
!!/start
 
@KazWolfe Hi there! Welcome to WolfBot!
 
!!/setroom 201
 
6:58 AM
@KazWolfe Uh oh! I ran into a problem :(. See the console for more details.
 
!!/setroom 201
 
@KazWolfe The bot will reload, and will use the new room upon restart. The bot will be moved to Ask Ubuntu General Room.
@KazWolfe Uh oh! I ran into a problem :(. See the console for more details.
 
!!/start
 
!!/setroom 201
 
@KazWolfe The bot will reload, and will use the new room upon restart. The bot will be moved to Ask Ubuntu General Room.
@KazWolfe Uh oh! I ran into a problem :(. See the console for more details.
 
7:00 AM
WolfBot just arrived, guys
 
damnit
!!/setroom 201
!!/start
 
He's been moved
 
@KazWolfe Hi there! Welcome to WolfBot!
 
It WORKSSSSSS
 
!!/setroom 45540
!!/start
 
7:02 AM
@KazWolfe Hi there! Welcome to WolfBot!
 
Permission is broken
 
o/ @Ferrybig
 
@KazWolfe o/
 
sorry about that guys, just needed to check something real fast.
i promise wolfbot won't be around for a while.
welcome to bot testing hell
where anything goes to try to nuke my bot out of orbit
bonus points if you can run arbitrary code on my server.
!!/s moo
 
7:08 AM
wow. things actually work. i don't believe it!
 
Is the bot open source?
 
yep
stars on sidebar has a link to the full source
(barring config files and a testing plugin)
 
!!/s moo
 
!!/addshortcut google google.com
 
7:10 AM
@KazWolfe From now on, the shortcut google will return this link.
 
!!/s google
 
@KazWolfe Hey! I've got this link for you: Google
 
:D
 
!!/delshortcut google
 
@KazWolfe From now on, the shortcut google will no longer resolve to anything.
 
7:11 AM
!!/s google
 
@KazWolfe google is not a shortcut. Go away.
 
wolfbot sass system... online!
@Ferrybig quick warning about the code though. I decided to ignore PIP entirely and just have it work.
so parts of it are gonna be really weird.
 
!!
noóoooooo.com
 
@Edity ?
 
The nooooo button
 
7:18 AM
i wanna integrate SmokeDetector and the FlameDetector into WolfBot too...
I wonder if i can.
 
got fork
?
 
no, it's not that. it's grabbing a smokedetector API (do they even have one? @Ferrybig) and a FlameDetector API
 
[WolfBot] Found filtered post, matches word mint: Peppermint Linux 7 rename default workspace names
 
in WolfBot Testing Room, 36 secs ago, by WolfBot
[WolfBot] Found filtered post, matches word mint: Peppermint Linux 7 rename default workspace names
 
[WolfBot] Found filtered post, matches word mint: how to change ownership "home" from 1000 to user if its said read only
 
7:26 AM
Good WolfBot!
are there any mods stalking here?
 
[WolfBot] Found filtered post, matches word mint: Unable to start google chrome in linux mint
 
in WolfBot Testing Room, 31 secs ago, by WolfBot
[WolfBot] Found filtered post, matches word mint: Unable to start google chrome in linux mint
goddamn! wolfbot is on fire!
 
@KazWolfe There is a metasmoke api, metasmoke is like the web interface to smokey, github.com/Charcoal-SE/metasmoke/wiki/API-Documentation
 
14 messages moved from Ask Ubuntu General Room
 
 
1 hour later…
8:48 AM
[WolfBot] Found filtered post, matches word mint: linux os wifi bluetooth not working
 
 
1 hour later…
10:15 AM
[WolfBot] Found filtered post, matches word elementary: Elementary-os not running properly
 
10:45 AM
[WolfBot] Found filtered post, matches word mint: How do i uninstall Ubuntu 16.04 that Dual-booting with Windows 10
 
 
2 hours later…
12:27 PM
[WolfBot] Found filtered post, matches word mint: 16.10 and Surface 3(Non-Pro)
 
 
2 hours later…
 
5 hours later…
7:51 PM
[WolfBot] Found filtered post, matches word mint: CUPS server reporting the wrong host name
 
o/ @ByteCommander
room topic changed to WolfBot's Testing Den: Do not feed the bot any Milk-Bones! A piece of kibble is okay, if he sits. [robots] [testing] [wolves]
 
soooo. tldr is this
here is my code for checking the incoming posts for... cleanliness and a lack of tags.
Now, I assume that this would be faster with regex instead of lots of for loops.
so, basically, live-generate a regex from my filter list, and then run the content of the post against the regex filter.
If it matches, move on. If not, ignore.
Then, I need to check it against an anti-list of regexes, which i think is basically the same logic, but with a not in front of it
 
Can you just dump me some data here I can work with?
 
what kind of data?
 
8:00 PM
The black and white wordlists (or shortened examples) and in what format you get the posts.
 
okay, sure, i can do that.
 
Just so that I don't have to dig through the whole codebase to find out what data structures to work with.
 
Blacklist: cats, dogs
Whitelist: sheep, chicken
Flagged string: "The cats went to market last week.", "The dogs and cats ate outside"
 
I mainly need to know what data types and structures I have to work with. So the black/whitelist is a list of strings and the post is a string?
No, the post are two strings? Huh?
 
blacklist is a list of strings, post is string.
i was juts giving more than one example.
 
8:02 PM
Or are that two unrelated example posts?
Ah. K
 
Flagged (Overturned, so ignored) string: "The sheep was guarded by dogs.", "The cats had chicken for lunch"
Ignored string: "Ubuntu is great!", "Linux mint sucks!"
 
I think if any(word in post for word in blacklist) and not any(word in post for word in whitelist) would be faster than regex though...
 
really? even though we're using for?
i mean, i can run some timing tests...
 
You could test it, but I think so.
At least the logic is more simple and less likely to be buggy.
 
huh.
well, i'll give that a shot.
 
8:05 PM
That is worth more than a few milliseconds of performance difference IMHO.
 
yeah, i just don't want 40 for loops running in the code
 
You could try running it on PyPy instead of CPython if you want speed, but it's not necessary in your case.
 
but i'll give that a try and see what happens.
it just runs every minute, so i technically have all the time in the world.
 
Why 40 for loops?
There's nothing bad with that.
 
@ByteCommander exaggeration. but there will still be a lot if things.
 
8:07 PM
You would be using generator expressions and not for loops there, I believe those get compiled more efficiently.
 
ah.
python is weird.
 
Don't quote me on that though. It's been a while that I looked this up.
But in general, generators are good.
 
i'll commit that soon then
 
Feel free.
 
thanks byte
 
8:09 PM
Regex is only if you have complex patterns, but for simple word-in-string checks, I believe Python's builtins are faster.
 
okay.
yeah, it only has simple checks
 
These string operations should be written in C and be fast therefore. They're also less complex than a full regex engine.
 
now.. other useful things for bots.
i mean, i have the string checker and !!/s
but... what else?
 
Let it google stuff or look it up on Wikipedia or in a dictionary.
Teach it to play games, like hosting a hangman session.
Or build some neural networks and train them with chat data to let the bot reply in discussions.
Just pay attention that it doesn't reach consciousness and makes secret world dominance plans...
 
8:37 PM
[**WolfBot**] Found multiple filtered posts:
[1 second input lag (keyboard, mouse, animations)](http://askubuntu.com/q/830495), matches word `mint`
[1 second input lag (keyboard, mouse, animations)](http://askubuntu.com/q/830495), matches word `elementary`
 
9:01 PM
so @ByteCommander...
generators work, but I'm having another issue.
(well i haven't tried it, so idk really :P)
Does word in the generator act as a variable I can reference?
 
9:40 PM
!!/getfilter
 
Words on the filter blacklist:


Words on the filter whitelist:
 
!!/addfilter bl kali
 
@KazWolfe kali has been added to the filter blacklist.
 
!!/addfilter bl mint
 
@KazWolfe mint has been added to the filter blacklist.
 
9:41 PM
!!/addfilter wl "kali tools"
 
@KazWolfe kali tools has been added to the filter whitelist.
 
!!getfilter
!!/getfilter
 
Words on the filter blacklist:
kali, mint

Words on the filter whitelist:
kali tools
 
YAY!
!!/start
 
@KazWolfe Hi there! Welcome to WolfBot!
 
9:52 PM
!!/addshortcut @ParanoidPanda youtube.com/watch?v=zvfD5rnkTws
 
@KazWolfe From now on, the shortcut @ParanoidPanda will return this link.
 
!!/setroom 201
 
@KazWolfe The bot will reload soon, and will use the new room upon restart. The bot will be moved to Ask Ubuntu General Room.
@KazWolfe Uh oh! I ran into a problem :(. See the console for more details.
 
!!/start
 
@KazWolfe Hi there! Welcome to WolfBot!
 
10:08 PM
[WolfBot] Found filtered post, matches word mint: ERROR appearing randomly
 
10:27 PM
@KazWolfe this part of wolfbot is great!
filtering posts
 
yeah. i just made some changes to make it a bit better.
 
@KazWolfe that function is great and would be very helpful in the main room
 

« first day (8 days earlier)      last day (123 days later) »