mirror of
https://github.com/fotoente/MiCECo.git
synced 2024-10-22 23:19:09 +00:00
All notes will be sent with CW text "#miceco"
This commit is contained in:
parent
742626e43c
commit
0dc8d9cd58
2 changed files with 11 additions and 3 deletions
|
@ -4,6 +4,8 @@
|
||||||
### Introduction
|
### 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.
|
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
|
*Example Note (with counting of Reactions activated)*: https://ente.fun/notes/8wexz5ov1q
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
12
miceco.py
12
miceco.py
|
@ -27,6 +27,8 @@ doubleList = []
|
||||||
text = ""
|
text = ""
|
||||||
getReactions = False
|
getReactions = False
|
||||||
|
|
||||||
|
cwtext = "#miceco"
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("-c", "--config", help="location of the configuration file")
|
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")
|
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:
|
if emojisTotal > 0:
|
||||||
initial_text = nickname + " has written " + str(len(noteList)) + " Notes yesterday, " + formerDate.strftime(
|
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) + " "
|
8203) + "\n\n" + chr(9553) + " "
|
||||||
text = initial_text
|
text = initial_text
|
||||||
emoji_text = ""
|
emoji_text = ""
|
||||||
|
@ -312,12 +314,14 @@ if emojisTotal > 0:
|
||||||
|
|
||||||
else:
|
else:
|
||||||
emoji_text = nickname + " has written " + str(len(noteList)) + " Notes yesterday, " + formerDate.strftime(
|
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 += emoji_text + reactText
|
||||||
text = emojilib.emojize(text)
|
text = emojilib.emojize(text)
|
||||||
# print(text)
|
# print(text)
|
||||||
|
|
||||||
|
max_note_length = max_note_length-len(cwtext)
|
||||||
|
|
||||||
if max_note_length < len(text):
|
if max_note_length < len(text):
|
||||||
emoji_text = initial_text
|
emoji_text = initial_text
|
||||||
for item in range(0, 5):
|
for item in range(0, 5):
|
||||||
|
@ -338,12 +342,14 @@ if max_note_length < len(text):
|
||||||
text = emojilib.emojize(text)
|
text = emojilib.emojize(text)
|
||||||
|
|
||||||
# print(text)
|
# print(text)
|
||||||
|
noteVisibility = "specified"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
req = requests.post(url + "/notes/create", json={
|
req = requests.post(url + "/notes/create", json={
|
||||||
"i": token,
|
"i": token,
|
||||||
"visibility": noteVisibility,
|
"visibility": noteVisibility,
|
||||||
"text": text
|
"text": text,
|
||||||
|
"cw": cwtext
|
||||||
})
|
})
|
||||||
req.raise_for_status()
|
req.raise_for_status()
|
||||||
except requests.exceptions.HTTPError as err:
|
except requests.exceptions.HTTPError as err:
|
||||||
|
|
Loading…
Reference in a new issue