|
17 | 17 | # You should have received a copy of the GNU General Public License |
18 | 18 | # along with this program. If not, see [http://www.gnu.org/licenses/]. |
19 | 19 | """Provide a bot to tests""" |
| 20 | +import os |
20 | 21 |
|
21 | | -import telegram |
| 22 | +import sys |
22 | 23 |
|
23 | | -bots = [ |
24 | | - { |
25 | | - 'token': '133505823:AAHZFMHno3mzVLErU5b5jJvaeG--qUyLyG0', |
26 | | - 'chat_id': '12173560', |
27 | | - 'group_id': '-49740850', |
28 | | - 'channel_id': '@pythontelegrambottests', |
29 | | - 'payment_provider_token': '284685063:TEST:ZGJlMmQxZDI3ZTc3', |
30 | | - 'user': telegram.User(133505823, 'PythonTelegramBot', username='PythonTelegramBot') |
31 | | - } |
32 | | -] |
| 24 | + |
| 25 | +bot_settings = { |
| 26 | + 'APPVEYOR': |
| 27 | + { |
| 28 | + 'token': '133505823:AAHZFMHno3mzVLErU5b5jJvaeG--qUyLyG0', |
| 29 | + 'payment_provider_token': '284685063:TEST:ZGJlMmQxZDI3ZTc3' |
| 30 | + }, |
| 31 | + 'TRAVIS': |
| 32 | + { |
| 33 | + 'token': '133505823:AAHZFMHno3mzVLErU5b5jJvaeG--qUyLyG0', |
| 34 | + 'payment_provider_token': '284685063:TEST:ZGJlMmQxZDI3ZTc3' |
| 35 | + }, |
| 36 | + 'FALLBACK': |
| 37 | + { |
| 38 | + 'token': '133505823:AAHZFMHno3mzVLErU5b5jJvaeG--qUyLyG0', |
| 39 | + 'payment_provider_token': '284685063:TEST:ZGJlMmQxZDI3ZTc3' |
| 40 | + } |
| 41 | +} |
33 | 42 |
|
34 | 43 |
|
35 | 44 | def get_bot(): |
36 | | - return bots[0] |
| 45 | + # TODO: Add version info with different bots |
| 46 | + # ver = sys.version_info |
| 47 | + # pyver = "{}{}".format(ver[0], ver[1]) |
| 48 | + # |
| 49 | + bot = None |
| 50 | + if os.environ.get('TRAVIS', False): |
| 51 | + bot = bot_settings.get('TRAVIS', None) |
| 52 | + # TODO: |
| 53 | + # bot = bot_setting.get('TRAVIS'+pyver, None) |
| 54 | + elif os.environ.get('APPVEYOR', False): |
| 55 | + bot = bot_settings.get('APPVEYOR', None) |
| 56 | + # TODO: |
| 57 | + # bot = bot_setting.get('TRAVIS'+pyver, None) |
| 58 | + if not bot: |
| 59 | + bot = bot_settings['FALLBACK'] |
| 60 | + |
| 61 | + bot.update({ |
| 62 | + 'chat_id': '12173560', |
| 63 | + 'group_id': '-49740850', |
| 64 | + 'channel_id': '@pythontelegrambottests' |
| 65 | + }) |
| 66 | + return bot |
0 commit comments