# Path: randtalkbot/errors.py
# class StrangerSenderError(Exception):
#     pass
# 
# Path: randtalkbot/i18n.py
# def get_translation(languages):
#     if not languages:
#         languages = ['en']
# 
#     try:
#         translation_instance = gettext.translation(
#             'randtalkbot',
#             localedir=LOCALE_DIR,
#             languages=languages,
#             )
#     except OSError:
#         translation_instance = gettext.translation(
#             'randtalkbot',
#             localedir=LOCALE_DIR,
#             languages=['en'],
#             )
# 
#     return translation_instance.gettext


import logging
import re
import telepot
from .errors import StrangerSenderError
from .i18n import get_translation
        @see https://core.telegram.org/bots/api#using-markdown
        """
        if string_instance is not str:
            string_instance = str(string_instance)

        string_instance = cls.MARKDOWN_RE.sub(r'\\\1', string_instance)
        return string_instance

    async def answer_inline_query(self, query_id, answers):
        def translate(item):
            return self._(item) if isinstance(item, str) else self._(item[0]).format(*item[1:])

        for answer in answers:
            if answer['type'] == 'article':
                answer['title'] = translate(answer['title'])
                answer['description'] = translate(answer['description'])
                answer['message_text'] = translate(answer['message_text'])
        await self._bot.answerInlineQuery(query_id, answers, is_personal=True)

    async def send(self, message):
        """Raises:
            StrangerSenderError: If message's content type is not supported.
            TelegramError: If stranger has blocked the bot.
        """
        if message.is_reply:
            raise StrangerSenderError('Reply can\'t be sent.')

        try:
            method_name = StrangerSender.MESSAGE_TYPE_TO_METHOD_NAME[message.type]
        except KeyError:

# Path: randtalkbot/errors.py
# class StrangerSenderError(Exception):
#     pass
# 
# Path: randtalkbot/i18n.py
# def get_translation(languages):
#     if not languages:
#         languages = ['en']
# 
#     try:
#         translation_instance = gettext.translation(
#             'randtalkbot',
#             localedir=LOCALE_DIR,
#             languages=languages,
#             )
#     except OSError:
#         translation_instance = gettext.translation(
#             'randtalkbot',
#             localedir=LOCALE_DIR,
#             languages=['en'],
#             )
# 
#     return translation_instance.gettext


# Path: randtalkbot/stranger_sender.py
import logging
import re
import telepot
from .errors import StrangerSenderError
from .i18n import get_translation

        @see https://core.telegram.org/bots/api#using-markdown
        """
        if string_instance is not str:
            string_instance = str(string_instance)

        string_instance = cls.MARKDOWN_RE.sub(r'\\\1', string_instance)
        return string_instance

    async def answer_inline_query(self, query_id, answers):
        def translate(item):
            return self._(item) if isinstance(item, str) else self._(item[0]).format(*item[1:])

        for answer in answers:
            if answer['type'] == 'article':
                answer['title'] = translate(answer['title'])
                answer['description'] = translate(answer['description'])
                answer['message_text'] = translate(answer['message_text'])
        await self._bot.answerInlineQuery(query_id, answers, is_personal=True)

    async def send(self, message):
        """Raises:
            StrangerSenderError: If message's content type is not supported.
            TelegramError: If stranger has blocked the bot.
        """
        if message.is_reply:
            raise StrangerSenderError('Reply can\'t be sent.')

        try:
            method_name = StrangerSender.MESSAGE_TYPE_TO_METHOD_NAME[message.type]
        except KeyError:

            raise StrangerSenderError('Unsupported content_type: {}'.format(message.type))