Response sender is not needed anymore, private channels are now better handled

This commit is contained in:
nemunaire 2014-09-18 07:57:06 +02:00
commit 772d68a34d
32 changed files with 161 additions and 182 deletions

View file

@ -42,15 +42,15 @@ def cmd_subreddit(msg):
sbr = json.loads(raw.read().decode())
if "title" in sbr["data"]:
res = Response(msg.sender, channel=msg.channel, nomore="No more information")
res = Response(channel=msg.channel, nomore="No more information")
res.append_message(("[NSFW] " if sbr["data"]["over18"] else "") + sbr["data"]["url"] + " " + sbr["data"]["title"] + ": " + sbr["data"]["public_description" if sbr["data"]["public_description"] != "" else "description"].replace("\n", " ") + " %s subscriber(s)" % sbr["data"]["subscribers"])
if sbr["data"]["public_description"] != "":
res.append_message(sbr["data"]["description"].replace("\n", " "))
all_res.append(res)
else:
all_res.append(Response(msg.sender, "/%s/%s doesn't exist" % (where, sub.group(2)), channel=msg.channel))
all_res.append(Response("/%s/%s doesn't exist" % (where, sub.group(2)), channel=msg.channel))
else:
all_res.append(Response(msg.sender, "%s is not a valid subreddit" % osub, channel=msg.channel, nick=msg.nick))
all_res.append(Response("%s is not a valid subreddit" % osub, channel=msg.channel, nick=msg.nick))
return all_res