try: git_version_short_hash = subprocess.check_output( ['git', 'rev-parse', '--short', 'HEAD']).decode('ascii').strip() git_version_hash = subprocess.check_output(['git', 'rev-parse', 'HEAD' ]).decode('ascii').strip() git_remote_url = subprocess.check_output( ['git', 'config', '--get', 'remote.origin.url']).decode('ascii').strip().replace(".git", "") if git_remote_url.startswith("git@"): __git_remote_host = git_remote_url[4:git_remote_url.index(":")] __git_remote_repo = git_remote_url[git_remote_url.index(":") + 1:] git_remote_url = "https://" + __git_remote_host + "/" + __git_remote_repo SHL.output( f"{white}Found local version: {git_version_short_hash}, Git over SSH", "gitversion") __generated_link = git_remote_url + "/commits/" + git_version_hash __msg = f"Current Version is <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"{__generated_link}\">{git_version_short_hash}</a>.<br />" elif git_remote_url.startswith("https://"): git_remote_url.replace(".git", "") SHL.output( f"{white}Found local version: {git_version_short_hash}, Git over HTTPS", "gitversion") __generated_link = git_remote_url + "/commits/" + git_version_hash __msg = f"Current Version is <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"{__generated_link}\">{git_version_short_hash}</a>.<br />"
r"(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|playlist\?|watch\?v=|watch\?.+(?:&|&);v=))([a-zA-Z0-9\-_]{11})?(?:(?:[&?])t=(\d+))?" ) image_regex = compile(r".+\.(?:jpg|gif|png|jpeg|bmp)$", IGNORECASE) special_image_regex = compile(r"\.gifv$", IGNORECASE) audio_regex = compile(r".+\.(?:mp3|wav|ogg)$", IGNORECASE) video_regex = compile(r".+\.(?:mp4|ogg|webm)$", IGNORECASE) newline_html_regex = compile(r'[\n\r]') code_regex = compile(r"(```)(.+?|[\r\n]+?)(```)", MULTILINE) quote_regex = compile(r"^> (.+)", MULTILINE) # Startup parameters start_args = [x.strip().lower() for x in sys.argv] dummy_user = False if "-dummyuser" in start_args: SHL.output(f"{red}Adding Dummy User{white}") dummy_user = True debug_mode = cfg.get("debug_enabled", False) if "-debug" in start_args: debug_mode = True if debug_mode: SHL.output(f"{red}Enabled debug_mode.{white}") from .commands import handle_command from .sockets import emit_status # TODO: dafuq is this, send help from . import routes # checking and creating upload dir if not os.path.exists(app.config['UPLOAD_FOLDER']):
from app.obj import SystemMessenger, User, Command, Embed from utils import Console, green2, white import random import json import os.path SHL = Console("Command quote") settings = {'invoke': 'quote', 'system_display_name': 'Quotinator'} if not os.path.exists(os.path.join("app", "storage", "quotes")): os.makedirs(os.path.join("app", "storage", "quotes"), exist_ok=True) SHL.output( f"{green2}Quotes folder was not present, created quotes folder.{white}", "Quotes") filename = os.path.join("app", "storage", "quotes", "quotes.json") with open(filename, 'r', encoding="utf-8") as c: quotes = list(set(json.load(c))) def main(system: SystemMessenger, author: User, cmd: Command, params: list): embed = Embed( title="Quote", thumbnail= "http://simpleicon.com/wp-content/uploads/right_double_quotation_mark.png", color="#00ff00") if not len(params): embed.set_text("/quote can be either used to register or show quotes.") system.send(embed)