コード例 #1
0
    def test_quote_of_the_day_encoding(self):
        spanish_quote_of_the_day = wikiquotes.quote_of_the_day("spanish")
        self.assertTrue(
            language_manager.is_unicode(spanish_quote_of_the_day[0]))
        self.assertTrue(
            language_manager.is_unicode(spanish_quote_of_the_day[1]))

        english_quote_of_the_day = wikiquotes.quote_of_the_day("english")
        self.assertTrue(
            language_manager.is_unicode(english_quote_of_the_day[0]))
        self.assertTrue(
            language_manager.is_unicode(english_quote_of_the_day[1]))
コード例 #2
0
def quote():
    engine.say("Here is a quote for you")
    engine.runAndWait()
    quote = wikiquotes.quote_of_the_day("english")
    quote = quote[0]
    engine.say(quote)
    engine.runAndWait()
コード例 #3
0
ファイル: quotes.py プロジェクト: qwow5/discord-quote-bot
async def on_message(message):
    if message.content.startswith("<usage"):
        await message.channel.send("Type `<search author-name` to search for an author. Type `<day` to display the Wikiquotes quote of the day.")

    if message.content.startswith("<day"):
        await message.channel.send(wikiquotes.quote_of_the_day("english"))

    if message.content.startswith("<pacer"):
        await message.channel.send("""The FitnessGram Pacer Test is a multistage aerobic capacity test that progressively gets more difficult as it continues. The 20 meter pacer test will begin in 30 seconds. Line up at the start. The running speed starts slowly but gets faster each minute after you hear this signal. A single lap should be completed every time you hear this sound. Remember to run in a straight line and run as long as possible. The second time you fail to complete a lap before the sound, your test is over. The test will begin on the word start. On your mark. Get ready!… Start.""")

    await client.process_commands(message)
コード例 #4
0
    def test_spanish_quote_of_the_day_encoding_invariance(self):

        quote_of_the_day = wikiquotes.quote_of_the_day("spanish")

        self.assertEqual(quote_of_the_day, _qotd("Spanish"))
        self.assertEqual(quote_of_the_day, _qotd("spanish"))
        self.assertEqual(quote_of_the_day, _qotd("es"))
        self.assertEqual(quote_of_the_day, _qotd("Español"))
        self.assertEqual(quote_of_the_day, _qotd("español"))

        self.assertEqual(quote_of_the_day, _qotd(u"Spanish"))
        self.assertEqual(quote_of_the_day, _qotd(u"spanish"))
        self.assertEqual(quote_of_the_day, _qotd(u"es"))
        self.assertEqual(quote_of_the_day, _qotd(u"Español"))
        self.assertEqual(quote_of_the_day, _qotd(u"español"))
コード例 #5
0
ファイル: main.py プロジェクト: phantom-5/Garrula
def post(st):
    n = random.randint(0, 2)
    if st is 0:
        t = tags1(n)
        rt = str((wikiquotes.quote_of_the_day("english")[0]))
        #print(rt+t)
        return (rt + t)

    else:
        t = tags2(n)
        cn = ChuckNorris()
        data = str(cn.random())
        while len(data) > 270:
            data = cn.random()
        #print(data+t)
        return (data + t)
コード例 #6
0
    def test_english_quote_of_the_day_encoding_invariance(self):

        quote_of_the_day = wikiquotes.quote_of_the_day("english")

        self.assertEqual(quote_of_the_day, _qotd("English"))
        self.assertEqual(quote_of_the_day, _qotd("english"))
        self.assertEqual(quote_of_the_day, _qotd("en"))
        self.assertEqual(quote_of_the_day, _qotd("Inglés"))
        self.assertEqual(quote_of_the_day, _qotd("Ingles"))
        self.assertEqual(quote_of_the_day, _qotd("ingles"))

        self.assertEqual(quote_of_the_day, _qotd(u"English"))
        self.assertEqual(quote_of_the_day, _qotd(u"english"))
        self.assertEqual(quote_of_the_day, _qotd(u"en"))
        self.assertEqual(quote_of_the_day, _qotd(u"Inglés"))
        self.assertEqual(quote_of_the_day, _qotd(u"Ingles"))
        self.assertEqual(quote_of_the_day, _qotd(u"ingles"))
コード例 #7
0
def _qotd(string):
    return wikiquotes.quote_of_the_day(string)
コード例 #8
0
ファイル: quote.py プロジェクト: ndw6152/inspiQuotes
 def get(self):
     quote = wikiquotes.quote_of_the_day("english")
     json_string = {"quote": quote[0], "author": quote[1]}
     return json_string
コード例 #9
0
ファイル: wikiquote.py プロジェクト: davebza/ohBot
print("Sending the request")

theList = wikiquotes.get_quotes("Musk", "English")

if theList:

    ohbot.reset()
    ohbot.wait(1)

    print("Success")
    print(theList)
    print(len(theList))
    text = theList[random.randint(0, len(theList) - 1)]
    print(text)

    ohbot.say(text)
    ohbot.wait(1)

else:
    print("Problem connecting to the server")

print("Sending the second request")
quoteOfTheDay = wikiquotes.quote_of_the_day("English")
newText = quoteOfTheDay[0]
print(newText)
print(type(newText))
#
# ohbot.say(str(newText))

ohbot.close()