Move files to folders
This commit is contained in:
39
.vscode/launch.json
vendored
39
.vscode/launch.json
vendored
@ -1,21 +1,20 @@
|
|||||||
{
|
{
|
||||||
// Use IntelliSense to learn about possible attributes.
|
// Use IntelliSense to learn about possible attributes.
|
||||||
// Hover to view descriptions of existing attributes.
|
// Hover to view descriptions of existing attributes.
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "Python: FastAPI",
|
"name": "Python: FastAPI",
|
||||||
"type": "python",
|
"type": "python",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"module": "uvicorn",
|
"module": "uvicorn",
|
||||||
"args": [
|
"args": ["discord_embed.main:app"],
|
||||||
"main:app"
|
"env": {
|
||||||
],
|
"DOMAIN": "http://127.0.0.1:8000/",
|
||||||
"env": {
|
"UPLOAD_FOLDER": "uploads"
|
||||||
"DOMAIN": "http://127.0.0.1:8000/"
|
},
|
||||||
},
|
"jinja": true
|
||||||
"jinja": true
|
}
|
||||||
}
|
]
|
||||||
]
|
}
|
||||||
}
|
|
||||||
|
1
discord_embed/__init__.py
Normal file
1
discord_embed/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
__version__ = "0.1.0"
|
@ -1,8 +1,3 @@
|
|||||||
"""Website for uploading files, creating .HTMLs, and thumbnails.
|
|
||||||
|
|
||||||
This was created for Discord. You can use this to embed videos in Discord.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -16,7 +11,7 @@ from pygments import highlight
|
|||||||
from pygments.formatters import HtmlFormatter
|
from pygments.formatters import HtmlFormatter
|
||||||
from pygments.lexers import guess_lexer
|
from pygments.lexers import guess_lexer
|
||||||
|
|
||||||
from settings import Settings
|
from discord_embed.settings import Settings
|
||||||
|
|
||||||
hook = Webhook(Settings.webhook_url)
|
hook = Webhook(Settings.webhook_url)
|
||||||
app = FastAPI(
|
app = FastAPI(
|
||||||
@ -61,8 +56,6 @@ def video_file_uploaded(file: UploadFile) -> Dict[str, str]:
|
|||||||
Returns:
|
Returns:
|
||||||
Dict[str, str]: Returns URL for video.
|
Dict[str, str]: Returns URL for video.
|
||||||
"""
|
"""
|
||||||
# Make custom html for video files.
|
|
||||||
|
|
||||||
# Create folder if it doesn't exist.
|
# Create folder if it doesn't exist.
|
||||||
Path(f"{Settings.upload_folder}/video").mkdir(parents=True, exist_ok=True)
|
Path(f"{Settings.upload_folder}/video").mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
@ -102,7 +95,7 @@ def text_file_uploaded(file: UploadFile) -> Dict[str, str]:
|
|||||||
lines = file_object.read()
|
lines = file_object.read()
|
||||||
colored_text = highlight(
|
colored_text = highlight(
|
||||||
lines,
|
lines,
|
||||||
guess_lexer(lines), # Guess
|
guess_lexer(lines),
|
||||||
HtmlFormatter(
|
HtmlFormatter(
|
||||||
style="fruity", # Dark style
|
style="fruity", # Dark style
|
||||||
linenos="table", # Output line numbers as a table w/ two cells, one with line numbers, other with code
|
linenos="table", # Output line numbers as a table w/ two cells, one with line numbers, other with code
|
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
5
tests/test_discord_embed.py
Normal file
5
tests/test_discord_embed.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
from discord_embed import __version__
|
||||||
|
|
||||||
|
|
||||||
|
def test_version():
|
||||||
|
assert __version__ == "0.1.0"
|
Reference in New Issue
Block a user