reroute hashtag to its _ prefixed version if it exists
This commit is contained in:
parent
2e416d3412
commit
099e3322b1
1 changed files with 9 additions and 0 deletions
|
@ -391,6 +391,15 @@ class DelojzaBot:
|
|||
.format(urls, message.chat.title, hashtags))
|
||||
hashtags.insert(0, "PUBLIC")
|
||||
|
||||
for i in range(len(hashtags)):
|
||||
current_path = hashtags[:i + 1]
|
||||
if not os.path.isdir(os.path.join(self.out_dir, *current_path)):
|
||||
test_path = current_path
|
||||
test_path[-1] = "_" + test_path[-1]
|
||||
if os.path.isdir(os.path.join(self.out_dir, *test_path)):
|
||||
self.logger.debug(f"Rerouting {current_path[-1]} to _{test_path[-1]}")
|
||||
hashtags[i] = test_path[-1]
|
||||
|
||||
self.last_hashtags[message.chat.id] = None
|
||||
|
||||
self.logger.info("Downloading %s under '%s'" % (urls, "/".join(hashtags)))
|
||||
|
|
Loading…
Reference in a new issue