aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRahiel Kasim <rahiel.kasim@kabisa.nl>2022-04-10 12:49:49 +0200
committerRahiel Kasim <rahiel.kasim@kabisa.nl>2022-04-10 12:49:49 +0200
commitd4e01ef73d81112f0fd5881663b105776e11252b (patch)
tree24267e044b040b0eca6804c78cbafa64f4b4e637
parent4397d33d109dd289fec50687ad54fe8f3c74a4ee (diff)
refactor stdin option code
-rw-r--r--telegram_send/telegram_send.py17
-rw-r--r--telegram_send/version.py2
2 files changed, 3 insertions, 16 deletions
diff --git a/telegram_send/telegram_send.py b/telegram_send/telegram_send.py
index 3121364..88a2125 100644
--- a/telegram_send/telegram_send.py
+++ b/telegram_send/telegram_send.py
@@ -108,9 +108,6 @@ def main():
elif args.clean:
return clean()
- if args.pre:
- args.parse_mode = "html"
-
if args.parse_mode == "markdown":
# Use the improved MarkdownV2 format by default
args.parse_mode = telegram.constants.PARSEMODE_MARKDOWN_V2
@@ -119,20 +116,11 @@ def main():
message = sys.stdin.read()
if len(message) == 0:
sys.exit(0)
- if args.pre:
- message = pre(message)
- for c in conf:
- send(
- messages=[message],
- conf=c,
- parse_mode=args.parse_mode,
- silent=args.silent,
- disable_web_page_preview=args.disable_web_page_preview,
- timeout=args.timeout,
- )
+ args.message = [message]
try:
if args.pre:
+ args.parse_mode = "html"
args.message = [pre(m) for m in args.message]
delete(args.delete)
message_ids = []
@@ -156,7 +144,6 @@ def main():
if args.showids and message_ids:
smessage_ids = [str(m) for m in message_ids]
print("message_ids " + " ".join(smessage_ids))
-
except ConfigError as e:
print(markup(str(e), "red"))
cmd = "telegram-send --configure"
diff --git a/telegram_send/version.py b/telegram_send/version.py
index 98195c0..70a6c56 100644
--- a/telegram_send/version.py
+++ b/telegram_send/version.py
@@ -1 +1 @@
-__version__ = "0.31"
+__version__ = "0.32"