Skip to content

Commit

Permalink
New default messages
Browse files Browse the repository at this point in the history
  • Loading branch information
sevazhidkov committed Mar 25, 2016
1 parent 2b32758 commit fa7b751
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
14 changes: 4 additions & 10 deletions plugins/hello.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,21 @@
import schedule


@leonard.hooks.message([''])
@leonard.hooks.callback(lambda message, bot: True)
def hello_message(message, bot):
answer = leonard.OutgoingMessage(
recipient=message.sender,
text=message.locale.hello_message,
text=message.locale.not_found,
attachments=[]
)
bot.send_message(answer)


@leonard.hooks.interval(schedule.every(5).minutes)
def hello_interval(bot):
leonard.logger.info_message(bot.get_locale('hello', 'en').interval_message)


class EnglishLocale(leonard.locale.EnglishLocale):
language_code = 'en'
hello_message = 'Hi!'
interval_message = 'Hello from hello module'
not_found = "Sorry, I didn't understand you. You can find all functions in https://medium.com/@sevazhidkov/leonard-bot-open-source-virtual-assistant-in-messengers-by-russian-school-students-e2b5d1aac9a5#.e2xdsduq5"


class RussianLocale(leonard.locale.RussianLocale):
language_code = 'ru'
hello_message = 'Привет!'
not_found = "Извини, но я не понял тебя. Ты можешь посмотреть все мои функции на https://medium.com/@sevazhidkov/leonard-bot-open-source-virtual-assistant-in-messengers-by-russian-school-students-e2b5d1aac9a5#.e2xdsduq5"
17 changes: 13 additions & 4 deletions plugins/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,14 @@ class EnglishLocale(leonard.locale.EnglishLocale):
'Your location is needed by many plugins, like news or weather. '
'Please send me your location (not real, if real location is secret)'
)
success_register = 'Hi! I want to be your friend :) BOT FUNCTIONS HERE'
success_register = (
"""Hi! My name is Leonard and I'm bot.
It is possible and necessary to chat with me with the human speech because natural communication the most valuable think we have.
I'm improving all the time and you can write your feedback to [email protected] and [email protected]
I can search in the Wikipedia, Wikihow, get taxi (using Uber), tell you weather, news and many different things.
You can read more about me in https://medium.com/@sevazhidkov/leonard-bot-open-source-virtual-assistant-in-messengers-by-russian-school-students-e2b5d1aac9a5#.e2xdsduq5
"""
)


class RussianLocale(leonard.locale.RussianLocale):
Expand All @@ -117,7 +124,9 @@ class RussianLocale(leonard.locale.RussianLocale):
', если хотите сохранить его в секрете)'
)
success_register = (
'Привет! Я рад, что мы теперь друзья :) '
'Здесь будет описание различных возможностей бота, инструкция как '
'перерегистрироваться'
"""Привет, меня зовут Леонард, и, как ни странно, я – бот.
Со мной можно и нужно общаться на человеческом языке, ведь живое общение – самое ценное, что есть у нас. Я постоянно совершенствуюсь, поэтому свои предложения и замечания следует писать [email protected] и [email protected]
Я могу: искать в интернете, давать подсказки на все случаи жизни, вызывать такси (если вам повезло жить в зоне действия Uber), узнавать погоду, последние новости и много что ещё.
Подробнее обо мне можно узнать на https://medium.com/@sevazhidkov/leonard-bot-open-source-virtual-assistant-in-messengers-by-russian-school-students-e2b5d1aac9a5#.e2xdsduq5
"""
)

0 comments on commit fa7b751

Please sign in to comment.