Merge branch 'develop' of github.com:ClouDev/CloudBot into develop

This commit is contained in:
Luke Rogers 2012-06-12 09:34:49 +12:00
commit 3cab25f123
7 changed files with 114 additions and 99 deletions

View file

@ -17,43 +17,43 @@ CloudBot is a Python IRC bot very heavily based on [Skybot](http://git.io/skybot
* Automatic reloading * Automatic reloading
* Little boilerplate * Little boilerplate
## Download ## Getting and using CloudBot
### Download
Get CloudBot at [git.io/getcloudbotirc](http://git.io/getcloudbotirc "Get CloudBot from Github!"). Get CloudBot at [git.io/getcloudbotirc](http://git.io/getcloudbotirc "Get CloudBot from Github!").
Unzip the resulting file, and continue to read this document. Unzip the resulting file, and continue to read this document.
## Install ### Install
Before you can run the bot, you need to install a few Python modules. These are `lXML` and `BeautifulSoup`. These can be installed with PIP (The Python package manager). If you use Windows and dont want to set up pip, you can also find `exe` installers on the internet: Before you can run the bot, you need to install a few Python modules. These are `lXML`, `Enchant`, `urllib3`, and `BeautifulSoup`. These can be installed with `pip` (The Python package manager), or `easy_install` (A more basic version of `pip`):
`pip install lxml` `[sudo] pip install lxml pyenchant urllib3 beautifulsoup`
`pip install beautifulsoup` or
`[sudo] easy_install lxml pyenchant urllib3 beautifulsoup`
On Debian based systems, you can get pip with #### Install `pip`
`apt-get install pip` ```shell
curl -O http://python-distribute.org/distribute_setup.py
python distribute_setup.py
easy_install pip
```
For `.spell` to work, we also need a library called `Enchant`. On Debian based systems, install it with: (If you use Windows and don't want to set up pip, you can also find `exe` installers on the internet.)
`apt-get install python-enchant` ### Run
In addition, for `.whois` to work optimally, you must have `whois` installed. Again, on Debian based systems, install it with:
`apt-get install whois`
(*These commands may need to be prefixed with `sudo`*)
If you are a user of another Linux disto, use your package manager to install the dependencies, or, for other operating systems, use **Google** to locate source packages you can install.
Once you have installed the required dependencies, there are two ways you can run the bot: Once you have installed the required dependencies, there are two ways you can run the bot:
### Using the launcher:
#### Launcher
The launcher will start the bot as a background process, and allow the bot to close and restart itself. This is only supported on unix-like machines (not Windows). The launcher will start the bot as a background process, and allow the bot to close and restart itself. This is only supported on unix-like machines (not Windows).
For the launcher to work properly, install `screen`, or `daemon` (daemon is recommended) : For the launcher to work properly, install `screen`, or `daemon` (daemon is recommended):
`apt-get install screen` `apt-get install screen`
@ -69,7 +69,7 @@ It will generate a default config for you. Once you have edited the config, run
This will start up your bot as a background process. To stop it, use `./cloudbot stop`. (Config docs at the [wiki](http://git.io/cloudbotircconfig)) This will start up your bot as a background process. To stop it, use `./cloudbot stop`. (Config docs at the [wiki](http://git.io/cloudbotircconfig))
### Manually running the bot: #### Manually
To manually run the bot and get debug output, run it with: To manually run the bot and get debug output, run it with:
@ -77,9 +77,11 @@ To manually run the bot and get debug output, run it with:
On Windows you can usually just double-click the `bot.py` file to start the bot, as long as you have Python installed correctly. On Windows you can usually just double-click the `bot.py` file to start the bot, as long as you have Python installed correctly.
(note that running it without the launcher will break the restart and stop commands) (note: running the bot without the launcher breaks the start and restart commands)
## Documentation ## Getting help with CloudBot
### Documentation
To configure your CloudBot, visit the [Config Wiki Page](http://git.io/cloudbotircconfig). To configure your CloudBot, visit the [Config Wiki Page](http://git.io/cloudbotircconfig).
@ -87,12 +89,22 @@ To write your own plugins, visit the [Plugin Wiki Page](http://git.io/cloudbotir
More at the [Wiki Main Page](http://git.io/cloudbotircwiki). More at the [Wiki Main Page](http://git.io/cloudbotircwiki).
## Support ### Support
The developers reside in [#CloudBot](irc://irc.esper.net/cloudbot) on [EsperNet](http://esper.net) and would be glad to help you. The developers reside in [#CloudBot](irc://irc.esper.net/cloudbot) on [EsperNet](http://esper.net) and would be glad to help you.
If you think you have found a bug/have a idea/suggestion, please **open a issue** here on Github. If you think you have found a bug/have a idea/suggestion, please **open a issue** here on Github.
### Requirements
CloudBot runs on **Python** *2.7.x*. It is developed on **Ubuntu** *12.04* with **Python** *2.7.2+*.
It **requires Python modules** `lXML`, `Enchant`, `urllib3`, and `BeautifulSoup`.
The programs `daemon` or `screen` are recomended for the wrapper to run optimaly.
**Windows** users: Windows compatibility with the wrapper and some plugins is **broken** (such as ping), but we do intend to add it.³
## Example CloudBots ## Example CloudBots
The developers of CloudBot run two CloudBots on [Espernet](http://esper.net). The developers of CloudBot run two CloudBots on [Espernet](http://esper.net).
@ -103,17 +115,8 @@ They can both be found in [#CloudBot](irc://irc.esper.net/cloudbot "Connect via
**neerbot** is the unstable bot, and runs on the latest(ish) development version of CloudBot. (neerbot is running on **Debian** *Wheezy/Testing* with **Python** *2.7.2*) **neerbot** is the unstable bot, and runs on the latest(ish) development version of CloudBot. (neerbot is running on **Debian** *Wheezy/Testing* with **Python** *2.7.2*)
## Requirements
CloudBot runs on **Python** *2.7.x*. It is developed on **Debian** *Wheezy/Testing* and **Ubuntu** *11.10* with **Python** *2.7.2*.
It **requires Python modules** `lXML`, `BeautifulSoup` and `Enchant`, `psutil`, and `HTTPlib2`.
The programs `daemon` or `screen` are recomended for the wrapper to run optimaly.
**Windows** users: Windows compatibility with the wrapper and some plugins is **broken** (such as ping), but we do intend to add it.³
## License ## License
CloudBot is **licensed** under the **GPL v3** license. The terms are as follows. CloudBot is **licensed** under the **GPL v3** license. The terms are as follows.
CloudBot/DEV CloudBot/DEV

View file

@ -1,41 +1,24 @@
from util import hook from util import hook
import random import random
import re
r = "\x02\x0305" # red color_codes = {
g = "\x02\x0303" # green "<r>": "\x02\x0305",
y = "\x02" # yellow (not really) "<g>": "\x02\x0303",
"<y>": "\x02"
}
answers = [g + "As I see it, yes", with open("plugins/data/8ball_responses.txt") as f:
g + "It is certain", for code in color_codes:
g + "It is decidedly so", f = f.replace(code, color_codes[code])
g + "Most likely", responses = [line.strip() for line in f.readlines()
g + "Outlook good", if not line.startswith("//")]
g + "Signs point to yes",
g + "One would be wise to think so",
g + "Naturally",
g + "Without a doubt",
g + "Yes",
g + "Yes, definitely",
g + "You may rely on it",
y + "Reply hazy, try again",
y + "Ask again later",
y + "Better not tell you now",
y + "Cannot predict now",
y + "Concentrate and ask again",
y + "You know the answer better than I",
y + "Maybe...",
r + "You're kidding, right?",
r + "Don't count on it",
r + "In your dreams",
r + "My reply is no",
r + "My sources say no",
r + "Outlook not so good",
r + "Very doubtful"]
@hook.command('8ball') @hook.command('8ball')
def eightball(inp, me=None): def eightball(input, me=None):
"8ball <question> -- The all knowing magic eight ball, " \ "8ball <question> -- The all knowing magic eight ball, " \
"in electronic form. Ask and it shall be answered!" "in electronic form. Ask and it shall be answered!"
me("shakes the magic 8 ball... %s" % (random.choice(answers)))
# here we use voodoo magic to tell the future
magic = random.choice(responses)
me("shakes the magic 8 ball... %s" % magic)

View file

@ -0,0 +1,26 @@
<g>As I see it, yes
<g>It is certain
<g>It is decidedly so
<g>Most likely
<g>Outlook good
<g>Signs point to yes
<g>One would be wise to think so
<g>Naturally
<g>Without a doubt
<g>Yes
<g>Yes, definitely
<g>You may rely on it
<y>Reply hazy, try again
<y>Ask again later
<y>Better not tell you now
<y>Cannot predict now
<y>Concentrate and ask again
<y>You know the answer better than I
<y>Maybe...
<r>You're kidding, right?
<r>Don't count on it
<r>In your dreams
<r>My reply is no
<r>My sources say no
<r>Outlook not so good
<r>Very doubtful

View file

@ -1,5 +1,5 @@
// obtained from <https://github.com/blha303/skybot/commit/d4ba73d6e3f21cc60a01342f3de9d0d4abd14b3d> // obtained from <https://github.com/blha303/skybot/commit/d4ba73d6e3f21cc60a01342f3de9d0d4abd14b3d>
// edited by Lukeroge and _frozen // edited by Lukeroge, _frozen, and MufinMcFlufin
// Block id // Block id
1 Stone 1 Stone
2 Grass Block 2 Grass Block
@ -147,6 +147,13 @@
122 Dragon Egg 122 Dragon Egg
123 Redstone Lamp 123 Redstone Lamp
124 Lit Redstone Lamp 124 Lit Redstone Lamp
127 Cocoa
128 Sandstone Stairs
129 Emerald Ore
130 Ender Chest
131 Tripwire Hook
132 Tripwire
133 Block of Emerald
// Items Ids // Items Ids
256 Iron Shovel 256 Iron Shovel
257 Iron Pickaxe 257 Iron Pickaxe
@ -338,7 +345,7 @@
380 Cauldron 380 Cauldron
381 Eye of Ender 381 Eye of Ender
382 Glistering Melon 382 Glistering Melon
383 Spawn Egg // 383 Spawn Egg
383:50 Creeper Egg 383:50 Creeper Egg
383:51 Skeleton Egg 383:51 Skeleton Egg
383:52 Spider Egg 383:52 Spider Egg
@ -362,6 +369,9 @@
383:120 Villager Egg 383:120 Villager Egg
384 Bottle Of Enchanting 384 Bottle Of Enchanting
385 Fire Charge 385 Fire Charge
386 Book and Quill
387 Written Book
388 Emerald
// Records // Records
2256 Music Disc 13 2256 Music Disc 13
2257 Music Disc Cat 2257 Music Disc Cat

View file

@ -45,7 +45,7 @@ Needle
Pin Pin
Token Token
Helm Helm
Battleaxe Battleaxe
[mid] [mid]
of of
[final] [final]

View file

@ -22,7 +22,7 @@ def python(data, args, input):
data = data[4:].strip() data = data[4:].strip()
req = http.get("http://eval.appspot.com/eval", statement=statement).splitlines() req = http.get("http://eval.appspot.com/eval", statement=statement).splitlines()
if len(req) == 0: if len(req) == 0:
return "Unknown Error." return "Failed to recieve response from remote Python API.."
req[0] = re_lineends.split(req[0])[0] req[0] = re_lineends.split(req[0])[0]
if not req[0] == 'Traceback (most recent call last):': if not req[0] == 'Traceback (most recent call last):':
result = req[0].decode('utf8', 'ignore') result = req[0].decode('utf8', 'ignore')

View file

@ -5,47 +5,40 @@ import random
def gen_password(types): def gen_password(types):
#Password Generator - The Noodle http://bowlofnoodles.net # Password Generator - The Noodle http://bowlofnoodles.net
okay = [] okay = []
#find the length needed for the password # find the length needed for the password
numb = types.split(" ") numb = types.split(" ")
try:
length = int(numb[0])
except ValueError:
length = 10
for x in numb[0]: # add alpha characters
#if any errors are found defualt to 10
if x not in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']:
numb[0] = 10
length = int(numb[0])
needs_def = 0
#alpha characters
if "alpha" in types or "letter" in types: if "alpha" in types or "letter" in types:
for x in string.ascii_lowercase: okay = okay + string.ascii_lowercase
okay.append(x)
#adds capital characters if not told not to #adds capital characters if not told not to
if "no caps" not in types: if "no caps" not in types:
for x in string.ascii_uppercase: okay = okay + string.ascii_uppercase
okay.append(x)
else: # add numbers
needs_def = 1
#adds numbers
if "numeric" in types or "numbers" in types: if "numeric" in types or "numbers" in types:
for x in range(0, 10): okay = okay + [str(x) for x in range(0, 10)]
okay.append(str(x))
else: # add symbols
needs_def = 1
#adds symbols
if "symbols" in types: if "symbols" in types:
sym = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', '_', '+', '[', ']', '{', '}', '\\', '|', ';', ':', "'", '.', '>', ',', '<', '/', '?', '`', '~', '"'] sym = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', '_', '+', '[', ']', '{', '}', '\\', '|', ';', ':', "'", '.', '>', ',', '<', '/', '?', '`', '~', '"']
for x in sym: okay += okay + sym
okay.append(x)
else: # defaults to lowercase alpha password if the okay list is empty
needs_def = 1 if not okay:
#defaults to lowercase alpha password if no arguments are found okay = okay + string.ascii_lowercase
if needs_def == 1:
for x in string.ascii_lowercase:
okay.append(x)
password = "" password = ""
#generates password
# generates password
for x in range(length): for x in range(length):
password = password + random.choice(okay) password = password + random.choice(okay)
return password return password