From 0dc8d9cd5899810749604b50b184149d93ea515f Mon Sep 17 00:00:00 2001 From: Fotoente Date: Tue, 10 May 2022 10:50:12 +0200 Subject: [PATCH] All notes will be sent with CW text "#miceco" --- README.md | 2 ++ miceco.py | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4a6ec06..69f25f3 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ ### Introduction This little script counts custom emojis and used reactions from the previous day and automaticaly creates a note on your Misskey account with an overview. There is also an option to include reaction emojis in the counts too. +All notes will be send with a content warning note, because some clients can't handle a big number of emojis! + *Example Note (with counting of Reactions activated)*: https://ente.fun/notes/8wexz5ov1q ### Installation diff --git a/miceco.py b/miceco.py index 6fa454e..3a3b2a9 100644 --- a/miceco.py +++ b/miceco.py @@ -27,6 +27,8 @@ doubleList = [] text = "" getReactions = False +cwtext = "#miceco" + parser = argparse.ArgumentParser() parser.add_argument("-c", "--config", help="location of the configuration file") parser.add_argument("-i", "--ignored", help="location of the file which emojis are ignored while counting") @@ -300,7 +302,7 @@ initial_react_text = "" if emojisTotal > 0: initial_text = nickname + " has written " + str(len(noteList)) + " Notes yesterday, " + formerDate.strftime( - '%a %d-%m-%Y') + "\nand used a total of " + str(emojisTotal) + " Emojis. #miceco" + chr(8203) + chr(8203) + chr( + '%a %d-%m-%Y') + "\nand used a total of " + str(emojisTotal) + " Emojis." + chr(8203) + chr(8203) + chr( 8203) + "\n\n" + chr(9553) + " " text = initial_text emoji_text = "" @@ -312,12 +314,14 @@ if emojisTotal > 0: else: emoji_text = nickname + " has written " + str(len(noteList)) + " Notes yesterday, " + formerDate.strftime( - '%a %d-%m-%Y') + "\nand didn't used any emojis. #miceco" + chr(8203) + chr(8203) + chr(8203) + '%a %d-%m-%Y') + "\nand didn't used any emojis." + chr(8203) + chr(8203) + chr(8203) text += emoji_text + reactText text = emojilib.emojize(text) # print(text) +max_note_length = max_note_length-len(cwtext) + if max_note_length < len(text): emoji_text = initial_text for item in range(0, 5): @@ -338,12 +342,14 @@ if max_note_length < len(text): text = emojilib.emojize(text) # print(text) +noteVisibility = "specified" try: req = requests.post(url + "/notes/create", json={ "i": token, "visibility": noteVisibility, - "text": text + "text": text, + "cw": cwtext }) req.raise_for_status() except requests.exceptions.HTTPError as err: