-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvolcan_message.py
More file actions
34 lines (25 loc) · 838 Bytes
/
Copy pathvolcan_message.py
File metadata and controls
34 lines (25 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import re
import datetime
from config import cfg
from take_cert import client
today = datetime.date.today()
yesterday = today - datetime.timedelta(days=1)
mess = client.get_messages(yesterday, today)
class Message:
def __init__(self, name, content, titledate):
self.name = name
self.content = re.search(cfg.reg, content).group()
match = re.search(r"\d\d.\d\d", titledate)
if match:
self.titledate = match.group()
else:
self.titledate = "- - -"
tesm = []
for el in mess:
tesm.append(Message(el.title, el.content, el.title))
def embedAddLinks(discord):
embed = discord.Embed(title="Linki do lekcji", color=0x440885)
for tesms in tesm:
embed.add_field(
name=f"{tesms.name}", value=f"{tesms.content}", inline=False)
return embed