prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  @ character
  If I type @ in a chat I got this. (using https://github.com/leandrotoledo/python-telegram-bot/blob/master/examples/echobot.py)
  
  TypeError: b'hola @honguitobot' is not JSON serializable
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `examples/echobot.py`
  Content:
  ```
  1 #!/usr/bin/env python
  2 #
  3 # Simple Bot to reply Telegram messages
  4 # Copyright (C) 2015 Leandro Toledo de Souza <leandrotoeldodesouza@gmail.com>
  5 #
  6 # This program is free software: you can redistribute it and/or modify
  7 # it under the terms of the GNU General Public License as published by
  8 # the Free Software Foundation, either version 3 of the License, or
  9 # (at your option) any later version.
  10 #
  11 # This program is distributed in the hope that it will be useful,
  12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14 # GNU General Public License for more details.
  15 #
  16 # You should have received a copy of the GNU General Public License
  17 # along with this program.  If not, see [http://www.gnu.org/licenses/].
  18 
  19 
  20 import logging
  21 import telegram
  22 
  23 
  24 LAST_UPDATE_ID = None
  25 
  26 
  27 def main():
  28     global LAST_UPDATE_ID
  29 
  30     logging.basicConfig(
  31         format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
  32 
  33     # Telegram Bot Authorization Token
  34     bot = telegram.Bot('TOKEN')
  35 
  36     # This will be our global variable to keep the latest update_id when requesting
  37     # for updates. It starts with the latest update_id if available.
  38     try:
  39         LAST_UPDATE_ID = bot.getUpdates()[-1].update_id
  40     except IndexError:
  41         LAST_UPDATE_ID = None
  42 
  43     while True:
  44         echo(bot)
  45 
  46 
  47 def echo(bot):
  48     global LAST_UPDATE_ID
  49 
  50     # Request updates after the last updated_id
  51     for update in bot.getUpdates(offset=LAST_UPDATE_ID, timeout=10):
  52         # chat_id is required to reply any message
  53         chat_id = update.message.chat_id
  54         message = update.message.text.encode('utf-8')
  55 
  56         if (message):
  57             # Reply the message
  58             bot.sendMessage(chat_id=chat_id,
  59                             text=message)
  60 
  61             # Updates global offset to get the new updates
  62             LAST_UPDATE_ID = update.update_id + 1
  63 
  64 
  65 if __name__ == '__main__':
  66     main()
  67
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/examples/echobot.py b/examples/echobot.py
  --- a/examples/echobot.py
  +++ b/examples/echobot.py
  @@ -51,12 +51,12 @@
       for update in bot.getUpdates(offset=LAST_UPDATE_ID, timeout=10):
           # chat_id is required to reply any message
           chat_id = update.message.chat_id
  -        message = update.message.text.encode('utf-8')
  +        reply_text = update.message.text
   
  -        if (message):
  +        if (reply_text):
               # Reply the message
               bot.sendMessage(chat_id=chat_id,
  -                            text=message)
  +                            text=reply_text)
   
               # Updates global offset to get the new updates
               LAST_UPDATE_ID = update.update_id + 1
  
verification_info: {"golden_diff": "diff --git a/examples/echobot.py b/examples/echobot.py\n--- a/examples/echobot.py\n+++ b/examples/echobot.py\n@@ -51,12 +51,12 @@\n     for update in bot.getUpdates(offset=LAST_UPDATE_ID, timeout=10):\n         # chat_id is required to reply any message\n         chat_id = update.message.chat_id\n-        message = update.message.text.encode('utf-8')\n+        reply_text = update.message.text\n \n-        if (message):\n+        if (reply_text):\n             # Reply the message\n             bot.sendMessage(chat_id=chat_id,\n-                            text=message)\n+                            text=reply_text)\n \n             # Updates global offset to get the new updates\n             LAST_UPDATE_ID = update.update_id + 1\n", "issue": "@ character\nIf I type @ in a chat I got this. (using https://github.com/leandrotoledo/python-telegram-bot/blob/master/examples/echobot.py)\n\nTypeError: b'hola @honguitobot' is not JSON serializable\n\n", "before_files": [{"content": "#!/usr/bin/env python\n#\n# Simple Bot to reply Telegram messages\n# Copyright (C) 2015 Leandro Toledo de Souza <leandrotoeldodesouza@gmail.com>\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see [http://www.gnu.org/licenses/].\n\n\nimport logging\nimport telegram\n\n\nLAST_UPDATE_ID = None\n\n\ndef main():\n    global LAST_UPDATE_ID\n\n    logging.basicConfig(\n        format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n\n    # Telegram Bot Authorization Token\n    bot = telegram.Bot('TOKEN')\n\n    # This will be our global variable to keep the latest update_id when requesting\n    # for updates. It starts with the latest update_id if available.\n    try:\n        LAST_UPDATE_ID = bot.getUpdates()[-1].update_id\n    except IndexError:\n        LAST_UPDATE_ID = None\n\n    while True:\n        echo(bot)\n\n\ndef echo(bot):\n    global LAST_UPDATE_ID\n\n    # Request updates after the last updated_id\n    for update in bot.getUpdates(offset=LAST_UPDATE_ID, timeout=10):\n        # chat_id is required to reply any message\n        chat_id = update.message.chat_id\n        message = update.message.text.encode('utf-8')\n\n        if (message):\n            # Reply the message\n            bot.sendMessage(chat_id=chat_id,\n                            text=message)\n\n            # Updates global offset to get the new updates\n            LAST_UPDATE_ID = update.update_id + 1\n\n\nif __name__ == '__main__':\n    main()\n", "path": "examples/echobot.py"}], "after_files": [{"content": "#!/usr/bin/env python\n#\n# Simple Bot to reply Telegram messages\n# Copyright (C) 2015 Leandro Toledo de Souza <leandrotoeldodesouza@gmail.com>\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see [http://www.gnu.org/licenses/].\n\n\nimport logging\nimport telegram\n\n\nLAST_UPDATE_ID = None\n\n\ndef main():\n    global LAST_UPDATE_ID\n\n    logging.basicConfig(\n        format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n\n    # Telegram Bot Authorization Token\n    bot = telegram.Bot('TOKEN')\n\n    # This will be our global variable to keep the latest update_id when requesting\n    # for updates. It starts with the latest update_id if available.\n    try:\n        LAST_UPDATE_ID = bot.getUpdates()[-1].update_id\n    except IndexError:\n        LAST_UPDATE_ID = None\n\n    while True:\n        echo(bot)\n\n\ndef echo(bot):\n    global LAST_UPDATE_ID\n\n    # Request updates after the last updated_id\n    for update in bot.getUpdates(offset=LAST_UPDATE_ID, timeout=10):\n        # chat_id is required to reply any message\n        chat_id = update.message.chat_id\n        reply_text = update.message.text\n\n        if (reply_text):\n            # Reply the message\n            bot.sendMessage(chat_id=chat_id,\n                            text=reply_text)\n\n            # Updates global offset to get the new updates\n            LAST_UPDATE_ID = update.update_id + 1\n\n\nif __name__ == '__main__':\n    main()\n", "path": "examples/echobot.py"}]}