forked from huntwelch/MongoBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
105 lines (69 loc) · 3 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
Getting Started
===============
mkvirtualenv MongoBot
pip install -r requirements.txt
To run bot: python medulla.py
To run bot persistently so it will recover from crashes: python doctor.py
You'll need to install MongoDB to use most of the features relating to people
Dafuq is going on?
==================
For best results in answering this question, check out settings.py,
followed by medulla.py and cortex.py. Also, learn python.
Advanced Usage
==============
MongoBot is capable of running a number of web services and apis. For best
results, run an nginx server and uwsgi server/deploy.ini. And by best results,
I mean any. More documentation on this once I figure out how I did it the
first time.
Also, the markov functionality is based on redis, so you'll have to get a
redis server up and running.
Secret settings
===============
You will need to create a file in the root folder called secrets.py.
sample.secrets.py has descriptions of each setting, just copy it to
secrets.py and set away.
New features
============
To create a new command in an existing brainmeat category, add the
function to the class and add the decorator @axon. To add a help entry
for the function, add @help("Help message.")
To create a new command category, run this from the root directory:
python newbrains.py category_name
This will create a file called category_name.py in brainmeats, with
a class Category_name. Loading of this class will be automated, no
other files need to be altered.
Philosophies
===========
Don't nest logic when you can short circuit.
BAD:
if blah:
for x in stuff:
do stuff
GOOD:
if not blah:
return
for x in stuff:
do stuff
Try to stick to single quotes wherever possible.
String interpolation is better than adding up strings. I'm totally
not great at remembering this, but I'm trying.
When using in the chat room, you can pipe commands, i.e.:
-babble Zaphod | -tweet
... will tweet whatever babble spits out.
If you want a function to be pipeable to other functions, return the output
instead of just chatting from the function.
Why would anyone add piping to a chat bot? I dunno. Things got out of hand.
To Do
=====
+ Add autostart for server, if components in place
+ Add an @empty('message if values is empty') decorator
+ Probably make this readme better
+ add tweet at in twitting
+ phase out pageopen for Browse (possibly phaseout requests module)
+ reddit command breaks without specified subreddit
+ Clean up broca, decide what to do with it
+ link holdem to db, make persistant, open up sit/in/out functionality
+ finish holdem, needs testing and split pots probably don't work
+ stock game: account for splits and reverse splits
+ add @requires decorator, check for server, redis, mongo, have -features command to check.
Function by function level?