allow scroll from pastebin raw links

This commit is contained in:
Gordon Shumway 2019-03-22 18:33:46 -04:00 committed by GitHub
parent 9a785cfff4
commit 4fc02002f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -376,12 +376,14 @@ class ASCII(callbacks.Plugin):
Play ASCII/ANSI art files from web links
"""
file = requests.get(url)
if "html" in file.text or not url.endswith(".txt"):
if "html" in file.text:
irc.reply("Error: Scroll requires a text file as input.")
else:
elif url.endswith(".txt") or url.startswith("https://pastebin.com/raw/"):
for line in file.text.splitlines():
if line.strip():
irc.reply(line, prefixNick = False)
else:
irc.reply("Unexpected file type or link format")
scroll = wrap(scroll, ['text'])
Class = ASCII