Skip to content

Commit 8b3e280

Browse files
committed
Merge branch 'python3.4'
2 parents e41dd83 + d3f3b9d commit 8b3e280

10 files changed

Lines changed: 30 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## Changelog
2+
- **1.0.4** - Adjust ratelimiter cleanup task, add octopart API key, fix brainfuck, sort mcstatus output.
23
- **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!)
34
- **1.0.2** - Minor internal changes and fixes, banished minecraft_bukget and worldofwarcraft to CloudBotIRC/Plugins
45
- **1.0.1** - Fix history.py tracking

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,5 @@ CloudBot is **licensed** under the **GPL v3** license. The terms are as follows.
8484

8585
This product includes GeoLite2 data created by MaxMind, available from
8686
<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/).
87+
88+
This product uses the TheTVDB API. Find more info and contribute at http://thetvdb.com/

cloudbot/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import logging
1111
import os
1212

13-
__version__ = "1.0.3"
13+
__version__ = "1.0.4"
1414

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

config.default.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@
7979
"wunderground": "",
8080
"rdio_key": "",
8181
"rdio_secret": "",
82-
"google_dev_key": ""
82+
"google_dev_key": "",
83+
"octopart": ""
8384
},
8485
"database": "sqlite:///cloudbot.db",
8586
"plugin_loading": {

plugins/brainfuck.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ def bf(text):
4848
while ip < len(program):
4949
c = program[ip]
5050
if c == '+':
51-
memory[mp] += 1 % 256
51+
memory[mp] = (memory[mp] + 1) % 256
5252
elif c == '-':
53-
memory[mp] -= 1 % 256
53+
memory[mp] = (memory[mp] - 1) % 256
5454
elif c == '>':
5555
mp += 1
5656
if mp > rightmost:

plugins/core_ctcp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
@asyncio.coroutine
1010
@hook.regex(r'^\x01VERSION\x01$')
1111
def ctcp_version(notice):
12-
notice("\x01VERSION: CloudBotRefresh v{} - http://cloudbot.pw/".format(cloudbot.__version__))
12+
notice("\x01VERSION: CloudBot {} - http://cloudbot.pw/".format(cloudbot.__version__))
1313

1414

1515
@asyncio.coroutine

plugins/core_sieve.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def task_clear(loop):
1616
for uid, _bucket in buckets.copy().items():
1717
if (time() - _bucket.timestamp) > 600:
1818
del buckets[uid]
19-
loop.call_later(10, task_clear, loop)
19+
loop.call_later(600, task_clear, loop)
2020

2121

2222
@asyncio.coroutine
@@ -28,7 +28,7 @@ def init_tasks(loop, conn):
2828
return
2929

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

3434

plugins/imgur.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
# yes, it's kinda dirty, but it works :)
1414
ImgurClient.logged_in = lambda x: None
1515

16+
NO_NSFW = False
17+
1618

1719
def get_items(text):
1820
if text:
@@ -37,6 +39,9 @@ def get_items(text):
3739
reddit_search = False
3840
items = imgur_api.gallery()
3941

42+
if NO_NSFW:
43+
items = [item for item in items if not item.nsfw]
44+
4045
return items, reddit_search
4146

4247

plugins/minecraft_status.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,17 @@ def mcstatus():
3232
red.append(server)
3333

3434
if green:
35+
green.sort()
3536
out = "\x033\x02Online\x02\x0f: " + ", ".join(green)
3637
if yellow:
3738
out += " "
3839
if yellow:
40+
yellow.sort()
3941
out += "\x02Issues\x02: " + ", ".join(yellow)
4042
if red:
4143
out += " "
4244
if red:
45+
red.sort()
4346
out += "\x034\x02Offline\x02\x0f: " + ", ".join(red)
4447

4548
return "\x0f" + out.replace(".mojang.com", ".mj") \

plugins/octopart.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,20 @@
77
API_URL = "http://octopart.com/api/v3/parts/search"
88

99

10-
@hook.command("octopart", "octosearch")
10+
@hook.on_start()
11+
def load_key(bot):
12+
global api_key
13+
api_key = bot.config.get("api_keys", {}).get("octopart", None)
14+
15+
16+
@hook.command("octopart", "octo")
1117
def octopart(text, reply):
1218
"""octopart <keyword> -- Search for any part on the Octopart database."""
19+
if not api_key:
20+
return "Octopart API key required."
21+
1322
params = {
14-
'apikey': 'aefcd00e',
23+
'apikey': api_key,
1524
'q': text,
1625
'start': 0,
1726
'limit': 1

0 commit comments

Comments
 (0)