added shit
This commit is contained in:
+16
-3
@@ -34,8 +34,23 @@ class Meme:
|
||||
if not attachments or attachments.get('video') is None:
|
||||
return None
|
||||
|
||||
return random.choice(attachments.get('video'))
|
||||
return random.choice(attachments.get('video'))
|
||||
|
||||
def dump_meta(self, path: str = None):
|
||||
if not path:
|
||||
path = "current_meta.json"
|
||||
|
||||
with open(path, 'w', encoding='utf8') as f:
|
||||
f.write(json.dumps(self.meta))
|
||||
|
||||
@staticmethod
|
||||
def info_from_json(path: str) -> str:
|
||||
with open(path, 'w', encoding='utf8') as f:
|
||||
data = json.loads(f.read())
|
||||
|
||||
return f"{'Fandom: ' if data.get('fandom') else 'Project: '} {data.get('fandom', data.get('Project'))}\n"\
|
||||
f"Character(s):\n{', '.join(c for c in data.get('characters'))}\n"
|
||||
|
||||
@staticmethod
|
||||
def flatten_meta(meta: dict[str, any]) -> list[str]:
|
||||
return [a for k in [i for i in meta.values()] for a in k]
|
||||
@@ -64,8 +79,6 @@ class DayOfTheWeek:
|
||||
return self.days[DAYS.index(day)]
|
||||
else:
|
||||
return self.days[day]
|
||||
|
||||
|
||||
|
||||
@staticmethod
|
||||
def get_data() -> list[Day]:
|
||||
|
||||
Reference in New Issue
Block a user