added shit
This commit is contained in:
+15
-2
@@ -36,6 +36,21 @@ class Meme:
|
|||||||
|
|
||||||
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
|
@staticmethod
|
||||||
def flatten_meta(meta: dict[str, any]) -> list[str]:
|
def flatten_meta(meta: dict[str, any]) -> list[str]:
|
||||||
return [a for k in [i for i in meta.values()] for a in k]
|
return [a for k in [i for i in meta.values()] for a in k]
|
||||||
@@ -65,8 +80,6 @@ class DayOfTheWeek:
|
|||||||
else:
|
else:
|
||||||
return self.days[day]
|
return self.days[day]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_data() -> list[Day]:
|
def get_data() -> list[Day]:
|
||||||
folder = os.path.dirname(os.path.abspath(__file__))
|
folder = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|||||||
Reference in New Issue
Block a user