Compare commits
3 Commits
a538106343
...
2e3175a222
Author | SHA1 | Date |
---|---|---|
3wc | 2e3175a222 | |
3wc | 4055530baf | |
3wc | 90da68359a |
|
@ -9,4 +9,5 @@ git clone ssh://git@git.autonomic.zone:2222/3wordchant/mailboop.git
|
||||||
pip install -r requirements-dev.txt
|
pip install -r requirements-dev.txt
|
||||||
cp .envrc.sample .envrc
|
cp .envrc.sample .envrc
|
||||||
envrc allow
|
envrc allow
|
||||||
|
python -m mailboop
|
||||||
```
|
```
|
||||||
|
|
|
@ -21,7 +21,7 @@ def main():
|
||||||
|
|
||||||
messages = list(message_reader)
|
messages = list(message_reader)
|
||||||
|
|
||||||
unread = list(filter(lambda x: '\\Seen' not in x.flags, messages))
|
unread = list(filter(lambda x: "\\Seen" not in x.flags, messages))
|
||||||
|
|
||||||
dates = [m.date.replace(tzinfo=None) for m in messages]
|
dates = [m.date.replace(tzinfo=None) for m in messages]
|
||||||
|
|
||||||
|
@ -34,17 +34,19 @@ def main():
|
||||||
count = len(dates)
|
count = len(dates)
|
||||||
count_unread = len(unread)
|
count_unread = len(unread)
|
||||||
|
|
||||||
output = f'''\
|
output = f"""\
|
||||||
booping ur snoots :point_right:
|
booping ur snoots :point_right:
|
||||||
|
|
||||||
total emails: **{count}**
|
total emails: **{count}**
|
||||||
unread: **{count_unread}**
|
unread: **{count_unread}**
|
||||||
median email: recevied **{median_date}**, {median_delta} ago
|
median email: recevied **{median_date}**, {median_delta} ago
|
||||||
oldest email: recevied **{oldest_date}**, {oldest_delta} ago
|
oldest email: recevied **{oldest_date}**, {oldest_delta} ago
|
||||||
'''
|
"""
|
||||||
|
|
||||||
print("sendin boops")
|
print("sendin boops")
|
||||||
r = requests.post(os.getenv("ROCKETCHAT_HOOK_URL"), json={
|
r = requests.post(
|
||||||
|
os.getenv("ROCKETCHAT_HOOK_URL"),
|
||||||
|
json={
|
||||||
"alias": "mailboop",
|
"alias": "mailboop",
|
||||||
"emoji": ":snake:",
|
"emoji": ":snake:",
|
||||||
"text": output,
|
"text": output,
|
||||||
|
@ -55,7 +57,8 @@ oldest email: recevied **{oldest_date}**, {oldest_delta} ago
|
||||||
# # "image_url": "/images/integration-attachment-example.png",
|
# # "image_url": "/images/integration-attachment-example.png",
|
||||||
# "color": "#764FA5"
|
# "color": "#764FA5"
|
||||||
# }]
|
# }]
|
||||||
})
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
rocketchat-API==1.16.0
|
|
||||||
imap-tools==0.45.0
|
imap-tools==0.45.0
|
||||||
|
requests==2.26.0
|
||||||
|
|
Reference in New Issue