{"id":23780691,"url":"https://github.com/hunter87ff/discord-flask","last_synced_at":"2025-08-31T21:34:25.837Z","repository":{"id":248651709,"uuid":"829308366","full_name":"Hunter87ff/Discord-Flask","owner":"Hunter87ff","description":"A flaskord fork. discord-flask is a feature rich extension for Flask. with discord.py like functionalities","archived":false,"fork":false,"pushed_at":"2024-11-20T16:50:25.000Z","size":113,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-28T23:57:50.051Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Hunter87ff.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-16T07:11:33.000Z","updated_at":"2024-12-24T14:56:42.000Z","dependencies_parsed_at":"2024-10-11T03:46:10.456Z","dependency_job_id":"9b2165a9-d9ec-4d88-9f01-a4acc18f6aee","html_url":"https://github.com/Hunter87ff/Discord-Flask","commit_stats":null,"previous_names":["hunter87ff/flaskcord","hunter87ff/discord-flask"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hunter87ff%2FDiscord-Flask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hunter87ff%2FDiscord-Flask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hunter87ff%2FDiscord-Flask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hunter87ff%2FDiscord-Flask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Hunter87ff","download_url":"https://codeload.github.com/Hunter87ff/Discord-Flask/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232071653,"owners_count":18468551,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-01T11:15:56.243Z","updated_at":"2025-01-01T11:15:57.162Z","avatar_url":"https://github.com/Hunter87ff.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Discord-Flask\n=============\n\n.. image:: https://img.shields.io/github/v/release/hunter87ff/Discord-Flask?include_prereleases\u0026label=Latest%20Release\u0026logo=github\u0026sort=semver\u0026style=for-the-badge\u0026logoColor=white\n    :target: https://github.com/hunter87ff/Discord-Flask/releases\n\nDiscord-Flask is a feature rich extension for Flask, with discord.py like functionalities.\n\nInstallation\n------------\n\nInstall Released Version\n~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code-block:: sh\n\n     pip install Discord-Flask\n\nTo install current development version you can use following command:\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code-block:: sh\n\n     pip install git+https://github.com/hunter87ff/Discord-Flask.git\n\nBasic Example\n-------------\n\n.. code-block:: python\n\n     import os\n     import traceback\n     import config\n     from flask import Flask, redirect, url_for, render_template\n     from discord_flask import Session, User, requires_authorization\n     from discord_flask.exceptions import Unauthorized\n\n     app = Flask(__name__)\n     app.guilds = {} #for cache purpose\n     app.secret_key = b\"SECRET_KEY\"\n     os.environ[\"OAUTHLIB_INSECURE_TRANSPORT\"] = \"true\"    # !! Only in development environment.\n\n     discord = Session(\n          app=app, \n          bot_token=\"TOKEN\", # make sure to access these as secret\n          client_id=\"CLIENT_ID\", \n          client_secret=\"CLIENT_SECRET\", \n          redirect_uri=\"http://127.0.0.1:5000/callback\"\n     )\n\n     @app.errorhandler(Unauthorized)\n     def redirect_unauthorized(e):\n          return redirect(url_for(\"login\"))\n          \n     @app.route(\"/\")\n     def home():\n          return \"\"\"\u003ca href=\"/login/\"\u003eLogin\u003c/a\u003e\"\"\"\n\n     @app.route(\"/login/\")\n     def login():\n          return discord.create_session()\n          \n     @app.route(\"/callback/\")\n     def callback():\n          try:\n                redirect_to = discord.callback().get(\"redirect\", \"/dashboard/\")\n                return redirect(redirect_to)\n          except Exception as e:\n                traceback.print_exc()\n                return render_template(\"error/500.html\"), 500\n\n     @app.route(\"/dashboard/\")\n     @requires_authorization\n     def dashboard():\n          try:\n                user:User = discord.fetch_user()\n                _guilds_list = []\n                _guild_dict = {g.id:g for g in discord.fetch_guilds() if g.permissions.administrator}\n                app.guilds = _guild_dict\n                return render_template(\n                     \"dash.html\",\n                     avatar=user.avatar_url,\n                     leng=len(_guilds_list),\n                     guilds=_guild_dict.values(),\n                     user=user\n                )\n          except Exception:\n                traceback.print_exc()\n                return \"Something went wrong\", 500\n\n     @app.route(\"/dashboard/\u003cguild_id\u003e/\")\n     @requires_authorization\n     def guild_dashboard(guild_id):\n          if not app.guilds:\n                app.guilds = {g.id:g for g in discord.fetch_guilds() if g.permissions.manage_guild}\n          guild = discord.get_guild(guild_id)\n          if not guild:\n                return redirect(config.INVITE_URL + guild_id)\n          if guild.id not in app.guilds.keys():\n                return redirect(\"/dashboard\")\n          return render_template(\"guild.html\",guild=guild, config=config) #Change configurations accordingly\n\n     if __name__ == \"__main__\":\n          app.run(host=\"0.0.0.0\", port=5000)\n\nFor an example to the working application, check `test_app.py \u003chttps://github.com/Hunter87ff/Discord-Flask/blob/main/example/test_app.py\u003e`_.\n\n.. note::\n     Documentation is currently not available.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhunter87ff%2Fdiscord-flask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhunter87ff%2Fdiscord-flask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhunter87ff%2Fdiscord-flask/lists"}