From fcb6d163456571ca87b67561d280342440a6dfd4 Mon Sep 17 00:00:00 2001 From: diSabler Date: Wed, 18 Mar 2020 18:10:00 +0300 Subject: add: yandex currency rate --- .gitignore | 1 + kernel.py | 4 ++-- plugins/yandexcurrency.py | 52 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 plugins/yandexcurrency.py diff --git a/.gitignore b/.gitignore index e6545b9..1b4ff6d 100644 --- a/.gitignore +++ b/.gitignore @@ -97,5 +97,6 @@ desktop.ini data/chatlog/-[0-9]* data/chatlog/[0-9]* +data/chatlog/*@* # The end is near! diff --git a/kernel.py b/kernel.py index 9b67ffc..6717d63 100755 --- a/kernel.py +++ b/kernel.py @@ -346,7 +346,7 @@ def get_os_version(): else: isidaOs = 'unknown' return isidaOs - + # Get color by name on Linux def get_color(c): color = os.environ.has_key('TERM') @@ -504,7 +504,7 @@ def send_document(raw_in, document, custom={}): FLS = {} else: MSG = { 'chat_id': raw_in['message']['chat'].get('id', '') } - FLS = {'document': (document, open(document, "rb"))} + FLS = {'document': (document, open(document, "rb"))} MSG.update(custom) return send_raw(raw_in, 'sendDocument', MSG, FLS) diff --git a/plugins/yandexcurrency.py b/plugins/yandexcurrency.py new file mode 100644 index 0000000..98c5589 --- /dev/null +++ b/plugins/yandexcurrency.py @@ -0,0 +1,52 @@ +ο»Ώ#!/usr/bin/python +# -*- coding: utf-8 -*- + +# --------------------------------------------------------------------------- # +# # +# iSida bot VI plugin # +# Copyright (C) VitaliyS # +# Copyright (C) diSabler # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +# --------------------------------------------------------------------------- # + +def cmd_yandex_currency(raw_in): + try: + import ssl + ssl._create_default_https_context = ssl._create_unverified_context + data = requests.get('https://yandex.ru').content + regexp = ''' + (.*?)(.*?)\ + .*?(.*?)(.*?)\ + .*?(.*?)(.*?)