Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cloudbot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def main():
original_sigint = signal.getsignal(signal.SIGINT)

# define closure for signal handling
def exit_gracefully(signum, frame):
def exit_gracefully():
nonlocal stopped_while_restarting
if not _bot:
# we are currently in the process of restarting
Expand Down
2 changes: 1 addition & 1 deletion cloudbot/hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
valid_command_re = re.compile(r"^\w+$")


class _Hook():
class _Hook:
"""
:type function: function
:type type: str
Expand Down
2 changes: 1 addition & 1 deletion plugins/attacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def kill(text, conn, nick, action):

@asyncio.coroutine
@hook.command
def slap(text, action, nick, conn, notice):
def slap(text, action, nick, conn):
"""<user> -- Makes the bot slap <user>."""
target = text.strip()

Expand Down
5 changes: 2 additions & 3 deletions plugins/karma.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from sqlalchemy import select

from cloudbot import hook
from cloudbot.util import timeformat, formatting, database
from cloudbot.util import timeformat, database


CAN_DOWNVOTE = False
Expand Down Expand Up @@ -109,12 +109,11 @@ def karma(text, db):
if not query:
return "That user has no karma :("
else:
karma_text = formatting.pluralize(query['up_karma'] - query['down_karma'], '\x02karma')
return "{} has \x02{}\x02 karma!".format(text, query['up_karma'] - query['down_karma'])


@hook.command('loved')
def loved(text, db):
def loved(db):
"""loved -- Shows the users with the most karma!"""
query = db.execute(
select([karma_table])
Expand Down
13 changes: 6 additions & 7 deletions plugins/lastfm.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from datetime import datetime

import requests
import random

from sqlalchemy import Table, Column, PrimaryKeyConstraint, String

Expand Down Expand Up @@ -123,13 +122,13 @@ def lastfm(text, nick, db, bot, notice):


@hook.command("lastfmcompare", "compare", "lc")
def lastfmcompare(text, nick, bot, db):
def lastfmcompare(text, nick, bot,):
"""[user] ([user] optional) - displays the now playing (or last played) track of LastFM user [user]"""
api_key = bot.config.get("api_keys", {}).get("lastfm")
if not api_key:
return "No last.fm API key set."
if not text:
return("please specify a lastfm username to compare")
return "please specify a lastfm username to compare"
try:
user1, user2 = text.split()
except:
Expand Down Expand Up @@ -181,7 +180,7 @@ def lastfmcompare(text, nick, bot, db):


@hook.command("ltop", "ltt", autohelp=False)
def toptrack(text, nick, db, bot, notice):
def toptrack(text, nick, bot):
"""Grabs a list of the top tracks for a last.fm username"""
api_key = bot.config.get("api_keys", {}).get("lastfm")
if not api_key:
Expand All @@ -194,7 +193,7 @@ def toptrack(text, nick, db, bot, notice):
else:
username = get_account(nick)
if not username:
return("No last.fm username specified and no last.fm username is set in the database.")
return "No last.fm username specified and no last.fm username is set in the database."

params = {
'api_key': api_key,
Expand All @@ -220,7 +219,7 @@ def toptrack(text, nick, db, bot, notice):


@hook.command("lta", "topartist", autohelp=False)
def topartists(text, nick, db, bot, notice):
def topartists(text, nick, bot):
"""Grabs a list of the top artists for a last.fm username. You can set your lastfm username with .l username"""
api_key = bot.config.get("api_keys", {}).get("lastfm")
if not api_key:
Expand All @@ -233,7 +232,7 @@ def topartists(text, nick, db, bot, notice):
else:
username = get_account(nick)
if not username:
return("No last.fm username specified and no last.fm username is set in the database.")
return "No last.fm username specified and no last.fm username is set in the database."
params = {
'api_key': api_key,
'method': 'user.gettopartists',
Expand Down
1 change: 0 additions & 1 deletion plugins/minecraft_ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def mcping(text):

# I really hate people for putting colors IN THE VERSION
# WTF REALLY THIS IS A THING NOW?
version = format_colors(s.version.name)

if s.latency:
return "{}\x0f - \x02{}\x0f - \x02{:.1f}ms\x02" \
Expand Down
4 changes: 1 addition & 3 deletions plugins/profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import traceback
import sys

import cloudbot

PYMPLER_ENABLED = False

if PYMPLER_ENABLED:
Expand Down Expand Up @@ -115,7 +113,7 @@ def pympler_diff():

# # Provide an easy way to get a threaddump, by using SIGUSR1 (only on POSIX systems)
if os.name == "posix":
def debug(sig, frame):
def debug():
print(get_thread_dump())

signal.signal(signal.SIGUSR1, debug) # Register handler
2 changes: 1 addition & 1 deletion plugins/quote.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def add_quote(db, chan, target, sender, message):
return "Quote added."


def del_quote(db, chan, nick, add_nick, msg):
def del_quote(db, nick, msg):
"""Deletes a quote from a nick"""
query = qtable.update() \
.where(qtable.c.chan == 1) \
Expand Down
2 changes: 1 addition & 1 deletion plugins/test/test_fishbans.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
reply_error = "Could not fetch ban data from the Fishbans API:"


class DummyBot():
class DummyBot:
user_agent = "CloudBot/3.0"


Expand Down
6 changes: 3 additions & 3 deletions plugins/tvdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def get_episodes_for_series(series_name, api_key):
return res


def get_episode_info(episode, api_key):
def get_episode_info(episode):
first_aired = episode.findtext("FirstAired")

try:
Expand Down Expand Up @@ -103,7 +103,7 @@ def tv_next(text, bot=None):
today = datetime.date.today()

for episode in reversed(episodes):
ep_info = get_episode_info(episode, api_key)
ep_info = get_episode_info(episode)

if ep_info is None:
continue
Expand Down Expand Up @@ -150,7 +150,7 @@ def tv_last(text, bot=None):
today = datetime.date.today()

for episode in reversed(episodes):
ep_info = get_episode_info(episode, api_key)
ep_info = get_episode_info(episode)

if ep_info is None:
continue
Expand Down
4 changes: 2 additions & 2 deletions plugins/wordnik.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def antonym(text):

# word of the day
@hook.command("word", "wordoftheday", autohelp=False)
def wordoftheday(text, conn):
def wordoftheday(text):
"""returns the word of the day. To see past word of the day enter use the format yyyy-MM-dd. The specified date must be after 2009-08-10."""
if not api_key:
return "This command requires an API key from wordnik.com."
Expand Down Expand Up @@ -200,7 +200,7 @@ def wordoftheday(text, conn):

# random word
@hook.command("wordrandom", "randomword", autohelp=False)
def random_word(conn):
def random_word():
"""Grabs a random word from wordnik.com"""
if not api_key:
return "This command requires an API key from wordnik.com."
Expand Down