Skip to content

Commit

Permalink
Merge pull request #6 from alesanmed/feature/bot_info
Browse files Browse the repository at this point in the history
Added all bot info
  • Loading branch information
alesanmed committed Dec 12, 2018
2 parents b1e1782 + 427b4d7 commit 7d90bd5
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 0 deletions.
37 changes: 37 additions & 0 deletions README.md
@@ -0,0 +1,37 @@
# Your English Teacher bot

<!-- TOC -->
- [Your English Teacher bot](#your-english-teacher-bot)
- [Bot description](#bot-description)
- [Bot usage](#bot-usage)
- [Contributing](#contributing)
- [License](#license)
<!-- /TOC -->

## Bot description
This is a bot for learning new english vocabulary. When you send the bot the `/start` command, you'll be automatically registered. Each day, you'll receive a new word with its definition, examples with the word in use and an audio for learning how to pronounce it.

## Bot usage
To start using the bot just [talk to it](https://telegram.me/YourEnglishTeacher_bot). The bot commands are the following:

* `/start` Registers you in the bot and make the bot send you a new word each day.
* `/suggest [word]` Suggests a word for being added to the bot. The suggestions are revised by admins and they decide if the word suggested is added or not.
* `/about` Shows a message with some info about the bot, the developer who created it and how to contact him.
* `/help` Shows a message with all the commands available for you.

## Contributing
Feel free to give me some feedback or new ideas to improve the project. If you have any suggestions please feel free to create an [issue](https://github.com/alesanmed/YourEnglishTeacher_Bot/issues) and tag it as enhancement.

If you have any problem regarding the bot, you can also create an issue and tag it as `bug`.

## License

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to http://unlicense.org
22 changes: 22 additions & 0 deletions bot/about.py
@@ -0,0 +1,22 @@
# encoding: utf-8
from sys import path
from os.path import dirname as dir

path.append(dir(path[0]))

from connectors import users
from telegram.ext import CommandHandler

def main(dispatcher):
about_handler = CommandHandler('about', __about)
dispatcher.add_handler(about_handler)

def __about(bot, update):
update.message.reply_html(
('This bot has been developed by @alesanmed. '
'If you are a user and have any problem, you '
'can contact him for resolving it. If you are '
'a developer and want to contribute to the bot, '
'please refer to the bot '
'<a href="https://github.com/alesanmed/YourEnglishTeacher_Bot">GitHub repository</a>.')
)
21 changes: 21 additions & 0 deletions bot/error_handler.py
@@ -0,0 +1,21 @@
# encoding: utf-8
from sys import path
from os.path import dirname as dir

path.append(dir(path[0]))

from connectors import users
from utils import logger

def main(dispatcher):
dispatcher.add_error_handler(__error_handler)

def __error_handler(bot, update, error):
logger.get_logger().error('ERROR RAISED: {}'.format(error))

update.message.reply_text(
('Wow... It seems like there I\'m having '
'troubles at this moment... Please, try '
'again later and, if the problem persists, '
'contact @alesanmed')
)
32 changes: 32 additions & 0 deletions bot/help.py
@@ -0,0 +1,32 @@
# encoding: utf-8
from sys import path
from os.path import dirname as dir

path.append(dir(path[0]))

import connectors
from telegram.ext import CommandHandler

def main(dispatcher):
help_handler = CommandHandler('help', __help)
dispatcher.add_handler(help_handler)

def __help(bot, update):
message = ('/start Registers you in the bot and make the bot '
'send you a new word each day.\n'
'/suggest [word] Suggests a word for being added to'
' the bot. The suggestions are revised by admins and'
' they decide if the word suggested is added or not.\n'
'/about Shows a message with some info about the bot, '
'the developer who created it and how to contact him.\n'
'/help Shows a message with all the commands available for you.')

if connectors.authentication.check_authorization(
update.message.from_user.id):
message += ('\n\n<b>-- Admin commands --</b>\n\n'
'/add_word Begins the conversation for adding a new word.\n'
'/auth [token] Authorizes you use private commands.\n'
'/get_suggestions Retrieves the word suggestions for managing them.\n'
'/send_broadcast Sends a broadcast message to all registered users.\n')

update.message.reply_html(message)

0 comments on commit 7d90bd5

Please sign in to comment.