« first day (2 days earlier)      last day (481 days later) » 

12:00 AM
My life feels nice...
>>help
 
@Zizouz212 I'm ParrotBot, Zinedine's chatbot. You can find the source code on GitHub. You can get a list of all commands by running >>listcommands, or you can run >>help command to learn more about a specific command.
 
>> support
 
@Zizouz212 @Zizouz212!!! You better get the heck over here!!!!
 
>>help nominate
 
@Zizouz212 Command exists, but no help entry found.
Hey, It's Zizouz212 here. What's the issue?
It's just a websocket issue
 
12:02 AM
Alright, Nominations work!
Just need to get data.
 
Bot started.
 
>>help nominate
sockets...
 
reset sockets.
 
>> help nominate
.
>> help nominate
 
@Zizouz212 Nominate a question. To do this, just type '>> nominate [link to question]
 
12:09 AM
>> help vote
 
@Zizouz212 Vote for a question. To do this, just type '>> vote [link to question]'
 
>> listcommands
 
@Zizouz212 Commands: alive, help, listcommands, nominate, random, randomchoice, randomint, shuffle, support, translate, utc, viewnominees, vote, xkcd, xkcdrandomnumber
 
>>alive
 
@Zizouz212 Yes, I'm alive. Why wouldn't I be?
 
@Zizouz212 Thank you for placing a nomination
 
>> viewnominees
 
The Nominations are...
http://opensource.stackexchange.com/questions/55/does-open-source-qualify-as-being-part-of-the-public-domain with 1 votes.
 
>> stop
 
@Zizouz212 Bot terminated.
 
12:18 AM
Alright! As ParrotBot is under development, we're going to need your support in what you would like to see. To give us feedback, ping @Zizouz212 here, or (even better), if you see @ParrotBot around, type '>> feedback [your ideas]' to tell us!
 
Bot started.
 
>> help feedback
 
@Zizouz212 Give us feedback. To do this, just type '>> feedback [your feedback, what you want to see as features...]'
 
ok
>>stop
 
@Zizouz212 Bot terminated.
 
12:19 AM
k
 
Bot started.
 
>> help feedback
 
@Zizouz212 Give us feedback. To do this, just type '>> feedback [your feedback, what you want to see as features...]'
 
>> feedback I would like to nominate questions! (as an example)
>>stop
 
@Zizouz212 Bot terminated.
Bot started.
 
12:22 AM
>> help feedback
 
@Zizouz212 Give us feedback. To do this, just type '>> feedback [your feedback, what you want to see as features...]'
 
>> stop
 
@Zizouz212 Bot terminated.
Bot started.
 
>> help feedback
 
@Zizouz212 Give us feedback. To do this, just type '>> feedback [your feedback, what you want to see as features...]'
 
12:23 AM
>> feedback I would like to nominate questions! (as an example)
 
@Zizouz212 Thanks for the feedback!
 
 
6 hours later…
6:21 AM
>>alive
no bots in the room it would seem
 
@overactor I'm not sure, what does that decorator do?
 
@ProgramFOX The decorator is fully functional now
I just need to modify the ban and unban comand functions
It gets wrapped around the bot's command function
 
Ah, now I see what it does.
perhaps rename test_deco to ban_deco or something
 
@ProgramFOX ah, yes, I should change the names, I first did a little test
I could also have built the functionality into Chatbot.py of course
But I felt like showing that you can do that sort of stuff with decorators would not be a bad idea
 
Indeed, I agree it's a good idea to use decorators there.
 
6:47 AM
Bot started.
crashed
Bot started.
Commands: ['alive', 'utc', 'listcommands', 'help', 'xkcdrandomnumber', 'xkcd', 'random', 'randomint', 'randomchoice', 'shuffle', 'translate', 'translationchain', 'translationswitch', 'stop', 'disable', 'enable', 'ban', 'unban', 'delete']
Owner-only command. Bans a user from using the bot. Syntax: >>ban user_id [command]
User @ProgramFOX has been banned from using >>xkcd.
 
>>xkcd 1000
 
@ProgramFOX You have been banned from using that command.
User @ProgramFOX has been unbanned from using >>xkcd.
 
>>xkcdrandomnumber
 
>>xkcd
 
6:50 AM
@ProgramFOX Not enough arguments.
User @ProgramFOX has been banned from using >>xkcdrandomnumber.
 
>>xkcd 10
 
>>xkcdrandomnumber
 
@ProgramFOX You have been banned from using that command.
 
nice
 
6:50 AM
sweet
 
1 min ago, by overactor
Commands: ['alive', 'utc', 'listcommands', 'help', 'xkcdrandomnumber', 'xkcd', 'random', 'randomint', 'randomchoice', 'shuffle', 'translate', 'translationchain', 'translationswitch', 'stop', 'disable', 'enable', 'ban', 'unban', 'delete']
^ Is that correct?
 
Bot terminated.
@ProgramFOX It should be
 
I mean, the syntax
 
Bot started.
 
it used to be a simple comma-separated list
 
6:51 AM
why?
@ProgramFOX Ah yes, I changed to list_commands() function to use the functionality built into Module.py for it
 
Ah, it can be changed with a simple join method. On it.
 
we can get rid of the brackets and quotes
How/where should I save the command banned users dict?
 
@overactor bannedUsers.txt, using pickle
 
Bot started.
 
>>listcommands
 
6:54 AM
@ProgramFOX Commands: ['alive', 'utc', 'listcommands', 'help', 'xkcdrandomnumber', 'xkcd', 'random', 'randomint', 'randomchoice', 'shuffle', 'translate', 'translationchain', 'translationswitch', 'stop', 'disable', 'enable', 'ban', 'unban', 'delete']
 
@ProgramFOX Commands: alive, utc, listcommands, help, xkcdrandomnumber, xkcd, random, randomint, randomchoice, shuffle, translate, translationchain, translationswitch, stop, disable, enable, ban, unban, delete
 
syntax fixed
>>stop
 
@ProgramFOX You don't have the privilege to execute this command.
 
@ProgramFOX Bot terminated.
 
heh
Bot terminated.
@ProgramFOX Wait, how does this work, because you're doing:
with open("bannedUsers.txt", "r") as f:
                self.banned = pickle.load(f)
That implies you're loading in everything
 
7:00 AM
yep, exactly
Uhh... yes, I'm loading in everything.
What did you expect?
 
@ProgramFOX That you could look for a certain variable or so?
 
Variable? Why would I, if the banned users are stored in a file?
 
well, what If I want to store two dicts in one file?
a dict of dicts then?
 
If you make them a list of dicts that shouldn't be a problem.
 
@ProgramFOX Okay
Bot started.
crashed
Bot started.
User @ProgramFOX has been banned.
 
7:22 AM
>>alive
:D
 
User @ProgramFOX has been unbanned.
 
>>alive
 
@ProgramFOX Yes, I'm alive.
 
\o/
 
User @ProgramFOX has been banned from using >>xkcd.
 
7:23 AM
>>xkcd
 
@ProgramFOX You have been banned from using that command.
 
>>alive
 
@ProgramFOX Yes, I'm alive.
Bot terminated.
Bot started.
@ProgramFOX try >>xkcd again
 
>>xkcd
 
@ProgramFOX Not enough arguments.
darn it
Bot terminated.
Bot started.
@ProgramFOX can you try again?
 
7:30 AM
>>xkcd 10
 
hmm
the file looks right though
Bot terminated.
Bot started.
@ProgramFOX one more? I'm printing some info to the console now.
 
>>xkcd 10
 
thanks
The dict is empty
 
7:36 AM
How do you load it?
 
if os.path.isfile("bannedUsers.txt"):
        with open("bannedUsers.txt", "r") as f:
            dump = pickle.load(f)
            if 'command_banned' in dump:
                command_banned_users = dump['command_banned']
I checked what was in dump after loading, that looked right
Bot started.
Bot terminated.
 
that looks right
 
must be something with capturing variables
 
aha, I believe I found it
try self.command_banned_users
or, wait, where do you load it?
 
@ProgramFOX In the admin.py file
It's a global
 
7:39 AM
globals are a real pain
at the beginning of your method, add global command_banned_users
 
wherever I use it?
 
yeah, at the beginning of the methods where you use it
 
Bot started.
try >>xkcd again?
 
>>xkcd
 
@ProgramFOX You have been banned from using that command.
yes!
User @ProgramFOX has been unbanned from using >>xkcd.
Not banned
User @ProgramFOX has been banned from using >>random.
User @ProgramFOX has been banned.
Bot terminated.
Bot started.
Bot terminated.
@ProgramFOX how do you close an issue from a commit?
nvm, I got it
 
8:05 AM
@overactor Sorry, was afk.
 
No problem
 
"closes #1", "fix #1", "close #1", "fixes #1", "resolves #1" etc.
 
github is cool
@ProgramFOX autorestart can't be too difficult, right?
 
No, it shouldn't be.
 
Why does it restart at all though?
Or rather, how far does it need to restart?
log out of stackexchange?
 
8:12 AM
Full restart. My idea was to make a main.bat/main.sh file in which the bot input data is stored in variables and when the bot shuts down, that bat file will restart it unless it's been stopped with >>stop. That can be checked with exit codes.
 
I'm not much of a bat/sh guy, I'll leave that to you fro when you get to it
Are you working on the Shadow's Den module?
 
Yes, I am.
 
Would you say the refactoring makes it easier?
(making a module)
 
Yeah, it does.
 
It's good that Shadow's Den is so complex, that way you're likely to discover what the base code still needs
 
8:18 AM
Indeed, I thought of the on_bot_load and the module-on_event because I needed it for my module.
 
8:45 AM
I may be a bit late to the party, but Ziz wrote some good save/load pickle code for Karma, which you can find on Github
 
@ArtOfCode Which file?
 
@overactor SaveIO.py, used in Commands.py and Chatbot.py
 
We have it solved anyway
@ProgramFOX maybe we should add centralized saving though?
 
Centralized saving?
 
Something like what @ArtOfCode and @Zizouz212 did, but for the entire bot
basically, we'd have one file with a big dict in it
you can do SaveIO.save(name, object)
 
8:51 AM
Hmm... I thought of saving them all in separate files so you can delete one of them if you need to and if one of them would be corrupted, you still have the other data.
 
And then it adds the object to the saved dict with name as a key
I see your point
In a seperate folder then?
and add that folder to .gitnore?
 
We could do that for bannedUsers.txt, but where a file gets stored looks like the module owner's decision to me.
It depends on whether they want to have it .gitignored or not.
 
@ProgramFOX The problem then is that they'll be all over the place
@ProgramFOX Can you imagine a usecase for it not been .gitnored?
how about a boolean argument?
standard it goes in a .gitnored folder, otherwise you decide
 
I cannot really imagine a usecase, but even then, how are we going to restrict that? If module owners want to have their file stored in the root dir then they can do that because Python has the messages for that.
 
@ProgramFOX sure they can, but we don't need to encourage it by building insupport for it
we're trying to promote good practices with this framework, no?
 
8:57 AM
True. So, you'd like to see a SaveIO class?
 
Or similar
Shall I get on that?
 
Or I could do it?
 
If you want, you can do it, sure.
 
@ArtOfCode If you want to, sure
is SaveIO the right name?
 
that looks like a good name, yes
 
9:01 AM
btw, we want this all to be static, right?
 
So what does it need to save?
 
@overactor Yeah, we do.
 
@ArtOfCode Basicaly, you can send any object + name to it and it will save it under
/savefiles/<name>
where '/' is the project root
 
Sounds good
 
is savefiles a good name for the folder @ProgramFOX?
 
9:03 AM
Yeah, something like that. Or botdata. Does not really matter.
 
@ArtOfCode, you should add an issue on github first and assign yourself to it, just for the heck of it :)
because issues are cool
 
I can't assign myself, but I've added the issue
 
@ProgramFOX does @ArtOfCode have commit privileges?
 
Not yet... one second.
 
take your time
 
9:07 AM
done
 
ta
 
@ProgramFox @ArtOfCode how do we handle/prevent collisions between saving and loading from different modules?
 
I could add a savedata.p file containing names of files and modules they were saved by
 
maybe a savedata.py sort of manifest thing
 
Giving each module a subdirectory? Let the SaveIO method accept a module_name parameter which will be used as subdir.
 
9:11 AM
@ProgramFOX That works
 
Oh, and before the files are created the directories have to be created too, in case they aren't. If they are not yet there, immediately trying to put a file in a non-existing directory will crash the bot.
 
if there are collisions between module names, I suppose the user will notice
 
Yeah, and I don't believe we'll have a lot of colliding modules.
 
Perhaps the module loader could check for collisions?
 
@ArtOfCode Are two modules with the same name necessarily a big problem though?
 
9:16 AM
@overactor No, but in the interests of usability it might be nice if the bot printed a warning that there's a collision instead of crashing when it finds out
 
@ArtOfCode It's only relevant for saving though
 
@overactor True. My thought is if the bot's been running a while and collecting lots of data, then if it crashes when trying to save you lose it all
 
But how do we ensure that they actually pass the right argument to the save function?
 
Goood question
 
Maybe they need to declare their subdir in a savedata.py file?
If there are a collisions there, the bot prints a warning and doesn't stop executing
oh wait, I got it
The Module files can set a property save_sub_dir, and they get loaded from there
then we can check for collisions
And if you try to save with a subdir that wasn't found, the program displays a warning
and refuses to save
@ArtOfCode, @ProgramFOX ^?
 
9:24 AM
Well I've committed the basic SaveIO class. Or should it be an actual class?
@overactor sounds good to me
 
@overactor good idea
 
@ArtOfCode Seems good to me like that
 
@ArtOfCode Nah, no need for a class when a module works fine.
 
put it in the root though
 
Okey poke
 
9:27 AM
class would just add unnecessary bloat
 
Pushed
OK, so what are these Module files? I've not seen them yet
 
afk
 
@ArtOfCode I can do that part if you want to?
 
Sure, go ahead
 
can you add the list (empty) to the SaveIO file and add schecks if the subdir is actually in that list?
(both on load and on save)
 
9:31 AM
The list?
Hey @Unihedron
 
a list which will contain all allowed subdirs
Maybe also add a set_subdirs() function, where a list can be passed and you check if these subdirs exist create them if not and crash if there are collisions
 
@overactor Should set_subdirs also add them to the list?
 
yeah, in fact it should empty it first
It should only get called on starting the bot
 
Ah I see
Yeah OK
OK those are pushed
 
Okay, mine are pushed too
Here's how you use it
in the module files (the are currently in /builtins/: admin.py and xkcd.py for instance)
you create a global variable called save_subdir = '<subdir_name>'
those get gathered and put into a list and passed on to your SaveIO class
 
9:48 AM
Right OK, I'll leave the gathering and passing to you or ProgramFOX. Note that the save_subdirs must be full paths
 
@ArtOfCode your code looks good
 
I'm pushing load protection as well
 
@ArtOfCode from the root?
could you make it relative to a fixed folder in the root
and add that folder to .gitnore
 
If you load when the file's empty or doesn't exist, it raises EOFError. I've redone it so that if it's empty or nonexistent, a blank pickle file (not empty) is created, and then that gets loaded.
 
The gathering and loading is already done btw, we just need to actually use it now
 
9:50 AM
Ah right
Relative paths? OK, I've got the root stored, so that's not hard
 
@ArtOfCode nice
 
I think that's done
 
@ArtOfCode, are you adding the extensions by the way?
 
File extensions? Yeah, it's just .p
 
okay
 
9:54 AM
I add them here
 
okay, botdata seems fine
 
@ArtOfCode Hi
 

« first day (2 days earlier)      last day (481 days later) »