Skip to content
This repository has been archived by the owner on May 25, 2024. It is now read-only.

Commit

Permalink
Update bot.py
Browse files Browse the repository at this point in the history
  • Loading branch information
AstraBert authored Jan 28, 2024
1 parent edcf977 commit b65b324
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions discord_bot/Co(de)Pilot_bot/bot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from discord import Client, File, Intents
from jan_scraper.scraper import scrape_jan_through_api
from jan_scraper.formatter import convert_code_to_curl_json
import os
import sqlite3
import time
Expand All @@ -8,24 +9,6 @@
TOKEN = ""


def convert_code_to_curl_json(code):
"""
Convert a Python code string to a format suitable for inclusion in a JSON string within a curl command.
Parameters:
- code (str): Python code string.
Returns:
- str: JSON-formatted string suitable for inclusion in a curl command.
"""
# Escape backslashes and double quotes in the code
escaped_code = code.replace('"', '\\\\\\"')

# Replace newline characters with '\\n'
formatted_code = escaped_code.replace("\n", "\\\\n")
return formatted_code


def get_python_code(lines):
"""Extract Python code blocks from a list of lines."""
blocks = []
Expand Down

0 comments on commit b65b324

Please sign in to comment.