N
N
niktomimo2020-09-10 20:36:34
Python
niktomimo, 2020-09-10 20:36:34

Why does an error occur when launching a cart bot on a pythonanywhere site?

Here is the code
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import telebot
import config

from telebot import types

bot = telebot.TeleBot(config.TOKEN)

@bot.message_handler(commands=['start'])
def welcome(message):

markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
item2 = types.KeyboardButton("Refill")
markup.add(item2)

bot.send_message(message.chat.id, "Welcome, {0.first_name }!\nI am {1.first_name} , a bot designed to multiply your money.".format(message.from_user, bot.get_me()),
parse_mode='html', reply_markup=markup)

@bot.message_handler(content_types= ['text'
if message.chat.type == "private":
if message.text == 'Refill':
bot.send_message(message.chat.id, 'Send gg)

bot.polling(none_stop=True)

and here is the error from pythonanywhere console
Traceback (most recent call last):
File "/home/mictor2/bot/bot.py", line 3, in
import telebot
File "/home/mictor2/.local/lib/python2.7/site-packages/telebot/ __init__.py", line 23, in
from telebot import apihelper, types, util
File "/home/mictor2/.local/lib/python2.7/site-packages/telebot/apihelper.py", line 18, in
from telebot import types
File "/home/mictor2/.local/lib/python2.7/site-packages/telebot/types.py", line 829
def add(self, *args, row_width=None):
^
SyntaxError: invalid syntax
>>>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2020-09-10
@niktomimo

https://www.pythonanywhere.com/forums/topic/28254/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question