Skip to content

Commit

Permalink
Merge branch 'python3.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
dmptrluke committed Jan 31, 2015
2 parents e41dd83 + d3f3b9d commit 8b3e280
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## Changelog
- **1.0.4** - Adjust ratelimiter cleanup task, add octopart API key, fix brainfuck, sort mcstatus output.
- **1.0.3** - More minor changes to plugins, fixed rate-limiting properly, banished SCP to CloudBotIRC/Plugins, added wildcard support to permissions (note: don't use this yet, it's still not entirely finalized!)
- **1.0.2** - Minor internal changes and fixes, banished minecraft_bukget and worldofwarcraft to CloudBotIRC/Plugins
- **1.0.1** - Fix history.py tracking
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,5 @@ CloudBot is **licensed** under the **GPL v3** license. The terms are as follows.

This product includes GeoLite2 data created by MaxMind, available from
<a href="http://www.maxmind.com">http://www.maxmind.com</a>. GeoLite2 databases are distributed under the [Creative Commons Attribution-ShareAlike 3.0 Unported License](https://creativecommons.org/licenses/by-sa/3.0/).

This product uses the TheTVDB API. Find more info and contribute at http://thetvdb.com/
2 changes: 1 addition & 1 deletion cloudbot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import logging
import os

__version__ = "1.0.3"
__version__ = "1.0.4"

__all__ = ["util", "bot", "connection", "config", "permissions", "plugin", "event", "hook", "log_dir"]

Expand Down
3 changes: 2 additions & 1 deletion config.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@
"wunderground": "",
"rdio_key": "",
"rdio_secret": "",
"google_dev_key": ""
"google_dev_key": "",
"octopart": ""
},
"database": "sqlite:///cloudbot.db",
"plugin_loading": {
Expand Down
4 changes: 2 additions & 2 deletions plugins/brainfuck.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ def bf(text):
while ip < len(program):
c = program[ip]
if c == '+':
memory[mp] += 1 % 256
memory[mp] = (memory[mp] + 1) % 256
elif c == '-':
memory[mp] -= 1 % 256
memory[mp] = (memory[mp] - 1) % 256
elif c == '>':
mp += 1
if mp > rightmost:
Expand Down
2 changes: 1 addition & 1 deletion plugins/core_ctcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@asyncio.coroutine
@hook.regex(r'^\x01VERSION\x01$')
def ctcp_version(notice):
notice("\x01VERSION: CloudBotRefresh v{} - http://cloudbot.pw/".format(cloudbot.__version__))
notice("\x01VERSION: CloudBot {} - http://cloudbot.pw/".format(cloudbot.__version__))


@asyncio.coroutine
Expand Down
4 changes: 2 additions & 2 deletions plugins/core_sieve.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def task_clear(loop):
for uid, _bucket in buckets.copy().items():
if (time() - _bucket.timestamp) > 600:
del buckets[uid]
loop.call_later(10, task_clear, loop)
loop.call_later(600, task_clear, loop)


@asyncio.coroutine
Expand All @@ -28,7 +28,7 @@ def init_tasks(loop, conn):
return

logger.info("[{}|sieve] Bot is starting ratelimiter cleanup task.".format(conn.name))
loop.call_later(10, task_clear, loop)
loop.call_later(600, task_clear, loop)
ready = True


Expand Down
5 changes: 5 additions & 0 deletions plugins/imgur.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# yes, it's kinda dirty, but it works :)
ImgurClient.logged_in = lambda x: None

NO_NSFW = False


def get_items(text):
if text:
Expand All @@ -37,6 +39,9 @@ def get_items(text):
reddit_search = False
items = imgur_api.gallery()

if NO_NSFW:
items = [item for item in items if not item.nsfw]

return items, reddit_search


Expand Down
3 changes: 3 additions & 0 deletions plugins/minecraft_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,17 @@ def mcstatus():
red.append(server)

if green:
green.sort()
out = "\x033\x02Online\x02\x0f: " + ", ".join(green)
if yellow:
out += " "
if yellow:
yellow.sort()
out += "\x02Issues\x02: " + ", ".join(yellow)
if red:
out += " "
if red:
red.sort()
out += "\x034\x02Offline\x02\x0f: " + ", ".join(red)

return "\x0f" + out.replace(".mojang.com", ".mj") \
Expand Down
13 changes: 11 additions & 2 deletions plugins/octopart.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,20 @@
API_URL = "http://octopart.com/api/v3/parts/search"


@hook.command("octopart", "octosearch")
@hook.on_start()
def load_key(bot):
global api_key
api_key = bot.config.get("api_keys", {}).get("octopart", None)


@hook.command("octopart", "octo")
def octopart(text, reply):
"""octopart <keyword> -- Search for any part on the Octopart database."""
if not api_key:
return "Octopart API key required."

params = {
'apikey': 'aefcd00e',
'apikey': api_key,
'q': text,
'start': 0,
'limit': 1
Expand Down

0 comments on commit 8b3e280

Please sign in to comment.