# Path: modules/utils/http.py
# async def pre_send(bot, chat_id: Optional[str]=None, action: str='typing') -> None:
# async def send(bot, chat_id: Optional[str]=None, text: Optional[str]=None, data: dict={}) -> None:
# async def call(bot, method_name: str, http_method: str, **kwargs):
# async def perform_request(url, method, params={}):


import random
import sys
from lxml import html
from modules.utils import http



async def main(bot, *args, **kwargs):
    """
    bash [query]
    Search for quote on http://bash.im/
    If no query specified, return random quote.
    """

    path = 'index' if args else 'random'
    params = {'text': ' '.join(args).encode('windows-1251')} if args else {}
    url = 'http://bash.im/{}'.format(path)

    try:

# Path: modules/utils/http.py
# async def pre_send(bot, chat_id: Optional[str]=None, action: str='typing') -> None:
# async def send(bot, chat_id: Optional[str]=None, text: Optional[str]=None, data: dict={}) -> None:
# async def call(bot, method_name: str, http_method: str, **kwargs):
# async def perform_request(url, method, params={}):


# Path: modules/user_bash.py
import random
import sys
from lxml import html
from modules.utils import http




async def main(bot, *args, **kwargs):
    """
    bash [query]
    Search for quote on http://bash.im/
    If no query specified, return random quote.
    """

    path = 'index' if args else 'random'
    params = {'text': ' '.join(args).encode('windows-1251')} if args else {}
    url = 'http://bash.im/{}'.format(path)

    try:

        response_body = await http.perform_request(url, 'GET', params=params)