瀏覽代碼

Implement tarot

Kirk Trombley 4 年之前
父節點
當前提交
df4991cb8a
共有 1 個文件被更改,包括 109 次插入3 次删除
  1. 109 3
      src/plugins/tarot.py

+ 109 - 3
src/plugins/tarot.py

@@ -1,6 +1,112 @@
-from rollbot import as_plugin
+import random
 
+from rollbot import as_plugin, with_help
+from rollbot.plugins.injection import OptArg
 
+from .util import upload_image
+
+# Extracted from https://labyrinthos.co/blogs/tarot-card-meanings-list
+# Value and Suit are separated so in theory these could be easily rendered to an SVG at some point
+DECK = {
+    # Major
+    ("0.", "The Fool"): ("innocence, new beginnings, free spirit", "recklessness, taken advantage of, inconsideration"),
+    ("I.", "The Magician"): ("willpower, desire, creation, manifestation", "trickery, illusions, out of touch"),
+    ("II.", "The High Priestess"): ("intuitive, unconscious, inner voice", "lack of center, lost inner voice, repressed feelings"),
+    ("III.", "The Empress"): ("motherhood, fertility, nature", "dependence, smothering, emptiness, nosiness"),
+    ("IV.", "The Emperor"): ("authority, structure, control, fatherhood", "tyranny, rigidity, coldness"),
+    ("V.", "The Hierophant"): ("tradition, conformity, morality, ethics", "rebellion, subversiveness, new approaches"),
+    ("VI.", "The Lovers"): ("partnerships, duality, union", "loss of balance, one-sidedness, disharmony"),
+    ("VII.", "The Chariot"): ("direction, control, willpower", "lack of control, lack of direction, aggression"),
+    ("VIII.", "Strength"): ("inner strength, bravery, compassion, focus", "self doubt, weakness, insecurity"),
+    ("IX.", "The Hermit"): ("contemplation, search for truth, inner guidance", "loneliness, isolation, lost your way"),
+    ("X.", "Wheel of Fortune"): ("change, cycles, inevitable fate", "no control, clinging to control, bad luck"),
+    ("XI.", "Justice"): ("cause and effect, clarity, truth", "dishonesty, unaccountability, unfairness"),
+    ("XII.", "The Hanged Man"): ("sacrifice, release, martyrdom", "stalling, needless sacrifice, fear of sacrifice"),
+    ("XIII.", "Death"): ("end of cycle, beginnings, change, metamorphosis", "fear of change, holding on, stagnation, decay"),
+    ("XIV.", "Temperance"): ("middle path, patience, finding meaning", "extremes, excess, lack of balance"),
+    ("XV.", "The Devil"): ("addiction, materialism, playfulness", "freedom, release, restoring control"),
+    ("XVI.", "The Tower"): ("sudden upheaval, broken pride, disaster", "disaster avoided, delayed disaster, fear of suffering"),
+    ("XVII.", "The Stars"): ("hope, faith, rejuvenation", "faithlessness, discouragement, insecurity"),
+    ("XVIII.", "The Moon"): ("unconscious, illusions, intuition", "confusion, fear, misinterpretation"),
+    ("XIX.", "The Sun"): ("joy, success, celebration, positivity", "negativity, depression, sadness"),
+    ("XX.", "Judgement"): ("reflection, reckoning, awakening", "lack of self awareness, doubt, self loathing"),
+    ("XXI.", "The World"): ("fulfillment, harmony, completion", "incompletion, no closure"),
+    # Wands
+    ("King", "Wands"):  ("big picture, leader, overcoming challenges", "impulsive, overbearing, unachievable expectations"),
+    ("Queen", "Wands"):  ("courage, determination, joy", "selfishness, jealousy, insecurities"),
+    ("Knight", "Wands"):  ("action, adventure, fearlessness", "anger, impulsiveness, recklessness"),
+    ("Page", "Wands"):  ("exploration, excitement, freedom", "lack of direction, procrastination, creating conflict"),
+    ("Ten", "Wands"):  ("accomplishment, responsibility, burden", "inability to delegate, overstressed, burnt out"),
+    ("Nine", "Wands"):  ("resilience, grit, last stand", "exhaustion, fatigue, questioning motivations"),
+    ("Eight", "Wands"):  ("rapid action, movement, quick decisions", "panic, waiting, slowdown"),
+    ("Seven", "Wands"):  ("perseverance, defensive, maintaining control", "give up, destroyed confidence, overwhelmed"),
+    ("Six", "Wands"):  ("victory, success, public reward", "excess pride, lack of recognition, punishment"),
+    ("Five", "Wands"):  ("competition, rivalry, conflict", "avoiding conflict, respecting differences"),
+    ("Four", "Wands"):  ("community, home, celebration", "lack of support, transience, home conflicts"),
+    ("Three", "Wands"):  ("looking ahead, expansion, rapid growth", "obstacles, delays, frustration"),
+    ("Two", "Wands"):  ("planning, making decisions, leaving home", "fear of change, playing safe, bad planning"),
+    ("Ace", "Wands"):  ("creation, willpower, inspiration, desire", "lack of energy, lack of passion, boredom"),
+    # Cups
+    ("King", "Cups"):  ("compassion, control, balance", "coldness, moodiness, bad advice"),
+    ("Queen", "Cups"):  ("compassion, calm, comfort", "martyrdom, insecurity, dependence"),
+    ("Knight", "Cups"):  ("following the heart, idealist, romantic", "moodiness, disappointment"),
+    ("Page", "Cups"):  ("happy surprise, dreamer, sensitivity", "emotional immaturity, insecurity, disappointment"),
+    ("Ten", "Cups"):  ("inner happiness, fulfillment, dreams coming true", "shattered dreams, broken family, domestic disharmony"),
+    ("Nine", "Cups"):  ("satisfaction, emotional stability, luxury", "lack of inner joy, smugness, dissatisfaction"),
+    ("Eight", "Cups"):  ("walking away, disillusionment, leaving behind", "avoidance, fear of change, fear of loss"),
+    ("Seven", "Cups"):  ("searching for purpose, choices, daydreaming", "lack of purpose, diversion, confusion"),
+    ("Six", "Cups"):  ("familiarity, happy memories, healing", "moving forward, leaving home, independence"),
+    ("Five", "Cups"):  ("loss, grief, self-pity", "acceptance, moving on, finding peace"),
+    ("Four", "Cups"):  ("apathy, contemplation, disconnectedness", "sudden awareness, choosing happiness, acceptance"),
+    ("Three", "Cups"):  ("friendship, community, happiness", "overindulgence, gossip, isolation"),
+    ("Two", "Cups"):  ("unity, partnership, connection", "imbalance, broken communication, tension"),
+    ("Ace", "Cups"):  ("new feelings, spirituality, intuition", "emotional loss, blocked creativity, emptiness"),
+    # Swords
+    ("King", "Swords"):  ("head over heart, discipline, truth", "manipulative, cruel, weakness"),
+    ("Knight", "Swords"):  ("action, impulsiveness, defending beliefs", "no direction, disregard for consequences, unpredictability"),
+    ("Queen", "Swords"):  ("complexity, perceptiveness, clear mindedness", "cold hearted, cruel, bitterness"),
+    ("Page", "Swords"):  ("curiosity, restlessness, mental energy", "deception, manipulation, all talk"),
+    ("Ten", "Swords"):  ("failure, collapse, defeat", "can't get worse, only upwards, inevitable end"),
+    ("Nine", "Swords"):  ("anxiety, hopelessness, trauma", "hope, reaching out, despair"),
+    ("Eight", "Swords"):  ("imprisonment, entrapment, self-victimization", "self acceptance, new perspective, freedom"),
+    ("Seven", "Swords"):  ("deception, trickery, tactics and strategy", "coming clean, rethinking approach, deception"),
+    ("Six", "Swords"):  ("transition, leaving behind, moving on", "emotional baggage, unresolved issues, resisting transition"),
+    ("Five", "Swords"):  ("unbridled ambition, win at all costs, sneakiness", "lingering resentment, desire to reconcile, forgiveness"),
+    ("Three", "Swords"):  ("heartbreak, suffering, grief", "recovery, forgiveness, moving on"),
+    ("Four", "Swords"):  ("rest, restoration, contemplation", "restlessness, burnout, stress"),
+    ("Two", "Swords"):  ("difficult choices, indecision, stalemate", "lesser of two evils, no right choice, confusion"),
+    ("Ace", "Swords"):  ("breakthrough, clarity, sharp mind", "confusion, brutality, chaos"),
+    # Pentacles
+    ("King", "Pentacles"):  ("abundance, prosperity, security", "greed, indulgence, sensuality"),
+    ("Queen", "Pentacles"):  ("practicality, creature comforts, financial security", "self-centeredness, jealousy, smothering"),
+    ("Knight", "Pentacles"):  ("efficiency, hard work, responsibility", "laziness, obsessiveness, work without reward"),
+    ("Page", "Pentacles"):  ("ambition, desire, diligence", "lack of commitment, greediness, laziness"),
+    ("Ten", "Pentacles"):  ("legacy, culmination, inheritance", "fleeting success, lack of stability, lack of resources"),
+    ("Nine", "Pentacles"):  ("fruits of labor, rewards, luxury", "reckless spending, living beyond means, false success"),
+    ("Eight", "Pentacles"):  ("apprenticeship, passion, high standards", "lack of passion, uninspired, no motivation"),
+    ("Seven", "Pentacles"):  ("hard work, perseverance, diligence", "work without results, distractions, lack of rewards"),
+    ("Six", "Pentacles"):  ("charity, generosity, sharing", "strings attached, stinginess, power and domination"),
+    ("Five", "Pentacles"):  ("need, poverty, insecurity", "recovery, charity, improvement"),
+    ("Four", "Pentacles"):  ("conservation, frugality, security", "greediness, stinginess, possessiveness"),
+    ("Three", "Pentacles"):  ("teamwork, collaboration, building", "lack of teamwork, disorganized, group conflict"),
+    ("Two", "Pentacles"):  ("balancing decisions, priorities, adapting to change", "loss of balance, disorganized, overwhelmed"),
+    ("Ace", "Pentacles"):  ("opportunity, prosperity, new venture", "lost opportunity, missed chance, bad investment"),
+}
+
+
+@with_help("Get a tarot drawing. Include the argument 'hide' to hide explanations")
 @as_plugin
-def tarot():
-    return "Hello, world!"
+def tarot(hide: OptArg(0, conversion=lambda h: h == "hide", default=False)):
+    message = ""
+    for (p1, p2) in random.sample(DECK.keys(), 3):
+        message += f"{p1} "
+        if "." not in p1: # minor arcana
+            message += "of "
+        message += p2
+        face = random.choice((0, 1))
+        if face == 1:
+            message += ", Reversed"
+        if not hide:
+            message += f"\n    {DECK[(p1, p2)][face]}"
+        message += "\n"
+    return message