Untitled
unknown
python
4 years ago
4.6 kB
6
Indexable
from tinydb import TinyDB, Query import random import asyncio db = TinyDB('quotedb.json') dbv = TinyDB('variables.json') User = Query() quotes = { '\"Do not take life too seriously. You will never get out of it alive.\"', '\"First five days after weekend are the hardest.\"', '\"It\'s never too late to go back to bed.\"', '\"If you\'re going through hell, keep going.\"', #Winston Churchill '\"The happiest people don\'t have the best of everything, they just make the best of everything they have.\"', '\"Life doesn\'t get easier, you just get better at it.\"', '\"Sometimes you will never know the value of a moment until it becomes a memory.\"', #Dr. Seuss '\"If you don\'t like the road you\'re walking, start paving another one.\"', #Dolly Parton '\"In the end, we only regret the chances we didn\'t take.\"', '\"You\'re the artist of your life. Don\'t give the paintbrush to anyone else.\"', '\"Rise above the storm you will find the sunshine.\"', '\"The best time for new beginnings is now.\"', '\"Love yourself first, because that\'s who you\'ll spend the rest of your life with.\"', '\"Life is so ironic. It takes sadness to know what happiness is, noise to appreciate silence, and absence to value presence.\"', '\"If you want to fly, give up everything that weighs you down.\"', '\"Love all. Trust few. Everything\'s real but not everyone\'s true.\"', '\"Happiness is not a goal, it\'s a by-product of a life well lived.\"', '\"Life is ten percent what happens to you and ninety percent how you respond to it.\"', '\"Life is like riding a bicycle. To keep your balance, you must keep moving.\"', #Albert Einstein '\"If you set your goals ridiculously high and it\'s a failure, you will fail above everyone else\'s success.\"', #James Cameron '\"It is during our darkest moments that we must focus to see the light.\"', #Aristotle '\"Life is really simple, but we insist on making it complicated.\"', #Confucius '\"You can observe a lot just by watching.\"', #Yogi Berra '\"Difficulties increase the nearer we get to the goal.\"', #Johann Wolfgang von Goethe '\"Well begun is half done.\"', #Aristotle '\"It\'s easier to see the mistakes on someone else\'s paper.\"', '\"Every man dies. Not every man really lives.\"', '\"Trust yourself. You know more than you think you do.\"', #Benjamin Spock '\"God always takes the simplest way.\"', #Albert Einstein '\"From small beginnings come great things.\"', '\"To succeed, we must first believe that we can.\"', #Michael Korda '\"The best teacher is experience learned from failures.\"', #Bryon Pulsifer '\"But what is grief, if not love persevering?\"', #Vision '\"When something is important enough, you do it even if the odds are not in your favor.\"', #Elon Musk '\"It\'s OK to have your eggs in one basket as long as you control what happens to that basket.\"', #Elon Musk '\"I could either watch it happen or be a part of it.\"', #Elon Musk '\"Part of the journey is the end.\"', #Tony Stark '\"No amount of money can ever bought a second of time.\"', #Tony Stark '\"The hardest choices require the strongest wills.\"', #Thanos '\"No man can win every battle, but no man should fall without a struggle.\"', #Peter Parker '\"I\'m choosing to stand up, to become a part of something bigger. I really do believe that together, we can accomplish anything.\"', #Phil Coulson '\"It\'s funny what can happen when someone believes in you.\"', #Daisy Johnson '\"Failing to succeed does not mean failing to progress.\"', #Gowda Kakanna '\"If people are doubting how far you can go, go so far that you cam\'t hear them anymore\"', #Michele Ruiz '\"Don\'t let your victories go to your head, or your failures go to your heart.\"' } def quots(channel, goal): loop = True getcount = len(dbv) print(getcount) if getcount == 45: db.truncate() dbv.truncate() while loop == True: candidate = random.choice(list(quotes)) result = db.search(User['quote'] == candidate) if result == []: lip = asyncio.get_event_loop() lip.create_task(channel.send(candidate)) db.insert({'quote': candidate}) dbv.insert({'count' : 1}) loop = False #{"_default": {}} """ getcount = dbv.search(User['count']) if getcount == 21: db.truncate() """
Editor is loading...