diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..44b4224
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+* eol=lf
\ No newline at end of file
diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml
index 60b37a8..473cba8 100644
--- a/.github/workflows/python-package.yml
+++ b/.github/workflows/python-package.yml
@@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- python-version: [ 3.6, 3.7, 3.8, 3.9 ]
+ python-version: [ 3.8, 3.9, '3.10', 3.11, 3.12 ]
steps:
- uses: actions/checkout@v2
@@ -29,13 +29,10 @@ jobs:
path: "requirements-dev.txt"
- name: Install itself
run: |
- python setup.py install
- - name: Lint with flake8
+ python -m pip install .
+ - name: Lint with ruff
run: |
- # stop the build if there are Python syntax errors or undefined names
- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics
+ ruff check
- name: Test with pytest
run: |
pytest
diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml
index 1eba4d8..5ff91b0 100644
--- a/.github/workflows/python-publish.yml
+++ b/.github/workflows/python-publish.yml
@@ -17,15 +17,15 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
- python-version: '3.7'
+ python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine -r requirements.txt
- name: Build and publish
env:
- TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
+ TWINE_USERNAME: '__token__'
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
- twine upload dist/*
+ twine upload dist/*
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 3d7edd2..51f781c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,11 +1,9 @@
-dblpy.egg-info/
topggpy.egg-info/
-topgg/__pycache__/
build/
dist/
-/docs/_build
-/docs/_templates
-.vscode
-/.idea/
-__pycache__
+docs/_build
+docs/_templates
+.vscode/
+.idea/
+**/__pycache__/
.coverage
diff --git a/.isort.cfg b/.isort.cfg
deleted file mode 100644
index 317f1d3..0000000
--- a/.isort.cfg
+++ /dev/null
@@ -1,3 +0,0 @@
-[settings]
-profile=black
-multi_line_output=3
\ No newline at end of file
diff --git a/.readthedocs.yml b/.readthedocs.yml
index 388f9a1..35fe322 100644
--- a/.readthedocs.yml
+++ b/.readthedocs.yml
@@ -7,7 +7,7 @@ build:
image: latest
python:
- version: 3.8
+ version: 3.12
install:
- requirements: requirements.txt
- requirements: requirements-docs.txt
diff --git a/LICENSE b/LICENSE
index 96aaaf8..c4cd04c 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,5 @@
Copyright 2021 Assanali Mukhanov & Top.gg
+Copyright 2024 null8626 & Top.gg
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
diff --git a/MANIFEST.in b/MANIFEST.in
index dc068af..5dec6b1 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,3 +1,16 @@
-include LICENSE
-include requirements.txt
-include README.rst
+prune .github
+prune .ruff_cache
+prune docs
+prune examples
+prune scripts
+prune tests
+exclude .gitattributes
+exclude .gitignore
+exclude .readthedocs.yml
+exclude mypy.ini
+exclude pytest.ini
+exclude requirements-dev.txt
+exclude requirements-docs.txt
+exclude ruff.toml
+exclude ISSUE_TEMPLATE.md
+exclude PULL_REQUEST_TEMPLATE.md
\ No newline at end of file
diff --git a/README.rst b/README.rst
index 5bdddce..928930b 100644
--- a/README.rst
+++ b/README.rst
@@ -4,42 +4,30 @@ Top.gg Python Library
.. image:: https://img.shields.io/pypi/v/topggpy.svg
:target: https://pypi.python.org/pypi/topggpy
- :alt: View on PyPi
-.. image:: https://img.shields.io/pypi/pyversions/topggpy.svg
- :target: https://pypi.python.org/pypi/topggpy
- :alt: v1.0.0
-.. image:: https://readthedocs.org/projects/topggpy/badge/?version=latest
+ :alt: View on PyPI
+.. image:: https://img.shields.io/pypi/dm/topggpy?style=flat-square
:target: https://topggpy.readthedocs.io/en/latest/?badge=latest
- :alt: Documentation Status
+ :alt: Monthly PyPI downloads
-A simple API wrapper for `Top.gg `_ written in Python, supporting discord.py.
+A simple API wrapper for `Top.gg `_ written in Python.
Installation
------------
-Install via pip (recommended)
-
-.. code:: bash
-
- pip3 install topggpy
-
-Install from source
-
.. code:: bash
- pip3 install git+https://github.com/top-gg/python-sdk/
+ pip install topggpy
Documentation
-------------
-Documentation can be found `here `_
+Documentation can be found `here `_
Features
--------
* POST server count
* GET bot info, server count, upvote info
-* GET all bots
* GET user info
* GET widgets (large and small) including custom ones. See `docs.top.gg `_ for more info.
* GET weekend status
diff --git a/docs/_static/css/custom.css b/docs/_static/css/custom.css
deleted file mode 100644
index c7e6795..0000000
--- a/docs/_static/css/custom.css
+++ /dev/null
@@ -1,7 +0,0 @@
-header #logo-container img {
- height: 100px;
-}
-
-#search input[type="text"] {
- font-size: 1em;
-}
\ No newline at end of file
diff --git a/docs/_static/favicon.ico b/docs/_static/favicon.ico
new file mode 100644
index 0000000..ad108bb
Binary files /dev/null and b/docs/_static/favicon.ico differ
diff --git a/docs/_static/img/favicon-16x16.png b/docs/_static/img/favicon-16x16.png
deleted file mode 100644
index 58c60e9..0000000
Binary files a/docs/_static/img/favicon-16x16.png and /dev/null differ
diff --git a/docs/_static/script.js b/docs/_static/script.js
new file mode 100644
index 0000000..c8cfd5b
--- /dev/null
+++ b/docs/_static/script.js
@@ -0,0 +1,20 @@
+document.addEventListener('load', () => {
+ try {
+ document.querySelector('.edit-this-page').remove()
+
+ // remove these useless crap that appears on official readthedocs builds
+ document.querySelector('#furo-readthedocs-versions').remove()
+ document.querySelector('.injected').remove()
+ } catch {
+ // we're building this locally, forget it
+ }
+})
+
+for (const label of document.querySelectorAll('.sidebar-container label')) {
+ const link = [...label.parentElement.children].find(child => child.nodeName === 'A')
+
+ link.addEventListener('click', event => {
+ event.preventDefault()
+ label.click()
+ })
+}
\ No newline at end of file
diff --git a/docs/_static/style.css b/docs/_static/style.css
new file mode 100644
index 0000000..ee1e4dd
--- /dev/null
+++ b/docs/_static/style.css
@@ -0,0 +1,48 @@
+body {
+ --color-link-underline: rgba(0, 0, 0, 0);
+ --color-link-underline--hover: var(--color-link);
+ --color-inline-code-background: rgba(0, 0, 0, 0);
+ --color-api-background-hover: var(--color-background-primary);
+ --color-highlight-on-target: var(--color-background-primary) !important;
+
+ --font-stack: "Inter", sans-serif !important;
+ --font-stack--monospace: "Roboto Mono", monospace !important;
+}
+
+aside.toc-drawer {
+ visibility: hidden;
+}
+
+#furo-readthedocs-versions, .injected, .edit-this-page, .related-pages, .headerlink {
+ visibility: hidden;
+ user-select: none;
+}
+
+dd dt {
+ color: var(--color-foreground-secondary);
+}
+
+aside.toc-drawer .docutils:hover, .sidebar-brand-text:hover {
+ transition: 0.15s;
+ filter: opacity(75%);
+}
+
+.highlight .c1, em {
+ font-style: normal !important;
+}
+
+.highlight .nn {
+ text-decoration: none !important;
+}
+
+h1 {
+ font-weight: 900;
+}
+
+.sidebar-brand-text {
+ font-weight: bolder;
+}
+
+.sidebar-scroll .reference.internal {
+ color: var(--color-brand-primary);
+}
\ No newline at end of file
diff --git a/docs/api.rst b/docs/api.rst
deleted file mode 100644
index 6969165..0000000
--- a/docs/api.rst
+++ /dev/null
@@ -1,19 +0,0 @@
-.. currentmodule:: topgg
-
-#############
-API Reference
-#############
-
-The following section outlines the API of topggpy.
-
-Index:
-
- .. toctree::
- :maxdepth: 2
-
- api/autopost
- api/client
- api/data
- api/errors
- api/types
- api/webhook
\ No newline at end of file
diff --git a/docs/api/autopost.rst b/docs/api/autopost.rst
index 668af79..0151646 100644
--- a/docs/api/autopost.rst
+++ b/docs/api/autopost.rst
@@ -1,6 +1,6 @@
-#######################
-Auto-post API Reference
-#######################
+##################
+Autopost reference
+##################
.. automodule:: topgg.autopost
:members:
diff --git a/docs/api/client.rst b/docs/api/client.rst
index 1bac197..1d8966e 100644
--- a/docs/api/client.rst
+++ b/docs/api/client.rst
@@ -1,6 +1,6 @@
-####################
-Client API Reference
-####################
+################
+Client reference
+################
.. automodule:: topgg.client
:members:
diff --git a/docs/api/data.rst b/docs/api/data.rst
index 3f10ff2..090494e 100644
--- a/docs/api/data.rst
+++ b/docs/api/data.rst
@@ -1,6 +1,6 @@
-##################
-Data API Reference
-##################
+##############
+Data reference
+##############
.. automodule:: topgg.data
:members:
diff --git a/docs/api/errors.rst b/docs/api/errors.rst
index 804fdfa..d54af67 100644
--- a/docs/api/errors.rst
+++ b/docs/api/errors.rst
@@ -1,7 +1,6 @@
-####################
-Errors API Reference
-####################
+################
+Errors reference
+################
.. automodule:: topgg.errors
- :members:
- :inherited-members:
\ No newline at end of file
+ :members:
\ No newline at end of file
diff --git a/docs/api/index.rst b/docs/api/index.rst
new file mode 100644
index 0000000..4c4e05b
--- /dev/null
+++ b/docs/api/index.rst
@@ -0,0 +1,13 @@
+#############
+API reference
+#############
+
+ .. toctree::
+ :maxdepth: 2
+
+ autopost
+ client
+ data
+ errors
+ types
+ webhook
\ No newline at end of file
diff --git a/docs/api/types.rst b/docs/api/types.rst
index a6a70f8..14b983d 100644
--- a/docs/api/types.rst
+++ b/docs/api/types.rst
@@ -1,6 +1,6 @@
-####################
-Models API Reference
-####################
+################
+Models reference
+################
.. automodule:: topgg.types
:members:
diff --git a/docs/api/webhook.rst b/docs/api/webhook.rst
index 53a41c9..c1b067a 100644
--- a/docs/api/webhook.rst
+++ b/docs/api/webhook.rst
@@ -1,6 +1,6 @@
-#####################
-Webhook API Reference
-#####################
+#################
+Webhook reference
+#################
.. automodule:: topgg.webhook
:members:
diff --git a/docs/conf.py b/docs/conf.py
index 2d36857..50eaf9d 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -21,23 +21,10 @@
import os
import sys
-import alabaster
-
sys.path.insert(0, os.path.abspath("../"))
-from topgg import __version__ as version
-
-# import re
+from topgg import __version__ as version
-# -- General configuration ------------------------------------------------
-
-# If your documentation needs a minimal Sphinx version, state it here.
-#
-# needs_sphinx = '1.0'
-
-# Add any Sphinx extension module names here, as strings. They can be
-# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
-# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
@@ -45,12 +32,13 @@
"sphinx.ext.extlinks",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
+ "sphinx_reredirects",
]
autodoc_member_order = "groupwise"
extlinks = {
- "issue": ("https://github.com/top-gg/python-sdk/issues/%s", "GH-"),
+ "issue": ("https://github.com/top-gg-community/python-sdk/issues/%s", "#%s"),
}
intersphinx_mapping = {
@@ -59,167 +47,46 @@
"aiohttp": ("https://docs.aiohttp.org/en/stable/", None),
}
-releases_github_path = "top-gg/python-sdk"
-
-# Add any paths that contain templates here, relative to this directory.
-templates_path = ["_templates"]
+redirects = {
+ "repository": "https://github.com/top-gg-community/python-sdk",
+ "support": "https://discord.gg/dbl",
+ "api/index": "autopost.html",
+ "examples/index": "discord_py.html",
+ "examples/discord_py": "https://github.com/Top-gg-Community/python-sdk/tree/master/examples/discordpy_example",
+ "examples/hikari": "https://github.com/Top-gg-Community/python-sdk/tree/master/examples/hikari_example",
+}
-# The suffix(es) of source filenames.
-# You can specify multiple suffix as a list of string:
-#
-# source_suffix = ['.rst', '.md']
+releases_github_path = "top-gg-community/python-sdk"
source_suffix = ".rst"
-
-# The master toctree document.
master_doc = "index"
-# General information about the project.
project = "topggpy"
-copyright = "2021, Assanali Mukhanov"
-author = "Assanali Mukhanov"
-
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-# The short X.Y version.
-
-# with open('../dbl/__init__.py') as f:
-# version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1)
-# The full version, including alpha/beta/rc tags.
+copyright = "2021 Assanali Mukhanov; 2024 null8626"
+author = "null8626"
release = version
-# The language for content autogenerated by Sphinx. Refer to documentation
-# for a list of supported languages.
-#
-# This is also used if you do content translation via gettext catalogs.
-# Usually you set "language" from the command line for these cases.
-language = None
-
-# List of patterns, relative to source directory, that match files and
-# directories to ignore when looking for source files.
-# This patterns also effect to html_static_path and html_extra_path
+language = "en"
exclude_patterns = ["_build"]
-# -- Options for HTML output ----------------------------------------------
-
-html_theme_options = {"navigation_depth": 2}
-html_theme_path = [alabaster.get_path()]
-# The theme to use for HTML and HTML Help pages. See the documentation for
-# a list of builtin themes.
-#
-html_theme = "insegel"
-
-# The name of an image file (relative to this directory) to place at the top
-# of the sidebar.
+html_js_files = ["script.js"]
+html_css_files = [
+ "style.css",
+ "https://fonts.googleapis.com/css2?family=Inter:wght@100..900&family=Roboto+Mono&display=swap",
+]
+html_favicon = "_static/favicon.ico"
+html_theme = "furo"
html_logo = "topgg.svg"
-
-# Add any paths that contain custom static files (such as style sheets) here,
-# relative to this directory. They are copied after the builtin static files,
-# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
-
-# Add any extra paths that contain custom files (such as robots.txt or
-# .htaccess) here, relative to this directory. These files are copied
-# directly to the root of the documentation.
-# html_extra_path = []
-
-# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
-# using the given strftime format.
-# html_last_updated_fmt = '%b %d, %Y'
-
-# If true, SmartyPants will be used to convert quotes and dashes to
-# typographically correct entities.
-# html_use_smartypants = True
-
-# Custom sidebar templates, maps document names to template names.
-# html_sidebars = {}
-
-# Additional templates that should be rendered to pages, maps page names to
-# template names.
-# html_additional_pages = {}
-
-# If false, no module index is generated.
-# html_domain_indices = True
-
-# If false, no index is generated.
-# html_use_index = True
-
-# If true, the index is split into individual pages for each letter.
-# html_split_index = False
-
-# If true, links to the reST sources are added to the pages.
-# html_show_sourcelink = True
-
-# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
html_show_sphinx = False
-
-# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
html_show_copyright = True
-
-# If true, an OpenSearch description file will be output, and all pages will
-# contain a tag referring to it. The value of this option must be the
-# base URL from which the finished HTML is served.
-# html_use_opensearch = ''
-
-# This is the file name suffix for HTML files (e.g. ".xhtml").
-# html_file_suffix = None
-
-# Language to be used for generating the HTML full-text search index.
-# Sphinx supports the following languages:
-# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
-# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
-# html_search_language = 'en'
-
-# A dictionary with options for the search language support, empty by default.
-# Now only 'ja' uses this config value
-# html_search_options = {'type': 'default'}
-
-# The name of a javascript file (relative to the configuration directory) that
-# implements a search results scorer. If empty, the default will be used.
-# html_search_scorer = 'scorer.js'
-
-
-# -- Options for HTMLHelp output ------------------------------------------
-
-# Output file base name for HTML help builder.
htmlhelp_basename = "topggpydoc"
-# -- Options for LaTeX output ---------------------------------------------
-
-latex_elements = {
- # The paper size ('letterpaper' or 'a4paper').
- #
- # 'papersize': 'letterpaper',
- # The font size ('10pt', '11pt' or '12pt').
- #
- # 'pointsize': '10pt',
- # Additional stuff for the LaTeX preamble.
- #
- # 'preamble': '',
- # Latex figure (float) alignment
- #
- # 'figure_align': 'htbp',
-}
-
-# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title,
-# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, "topggpy.tex", "topggpy Documentation", "Assanali Mukhanov", "manual"),
]
-# -- Options for manual page output ---------------------------------------
-
-# One entry per manual page. List of tuples
-# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, "topggpy", "topggpy Documentation", [author], 1)]
-# -- Options for Texinfo output -------------------------------------------
-
-# Grouping the document tree into Texinfo files. List of tuples
-# (source start file, target name, title, author,
-# dir menu entry, description, category)
texinfo_documents = [
(
master_doc,
diff --git a/docs/examples/discord_py.rst b/docs/examples/discord_py.rst
new file mode 100644
index 0000000..e77808d
--- /dev/null
+++ b/docs/examples/discord_py.rst
@@ -0,0 +1,5 @@
+==================
+Discord.py example
+==================
+
+You should be redirected in a few moments. Otherwise, click here: https://github.com/Top-gg-Community/python-sdk/tree/master/examples/discordpy_example
\ No newline at end of file
diff --git a/docs/examples/hikari.rst b/docs/examples/hikari.rst
new file mode 100644
index 0000000..89fc651
--- /dev/null
+++ b/docs/examples/hikari.rst
@@ -0,0 +1,5 @@
+==============
+Hikari example
+==============
+
+You should be redirected in a few moments. Otherwise, click here: https://github.com/Top-gg-Community/python-sdk/tree/master/examples/hikari_example
\ No newline at end of file
diff --git a/docs/examples/index.rst b/docs/examples/index.rst
new file mode 100644
index 0000000..2057326
--- /dev/null
+++ b/docs/examples/index.rst
@@ -0,0 +1,9 @@
+########
+Examples
+########
+
+ .. toctree::
+ :maxdepth: 2
+
+ discord_py
+ hikari
\ No newline at end of file
diff --git a/docs/index.rst b/docs/index.rst
index a634d38..f2aebe2 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -3,19 +3,51 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
-###################################
-Welcome to topggpy's documentation!
-###################################
+#####################
+Top.gg Python Library
+#####################
-.. toctree::
- :maxdepth: 1
+.. image:: https://img.shields.io/pypi/v/topggpy.svg
+ :target: https://pypi.python.org/pypi/topggpy
+ :alt: View on PyPI
+.. image:: https://img.shields.io/pypi/dm/topggpy?style=flat-square
+ :target: https://topggpy.readthedocs.io/en/latest/?badge=latest
+ :alt: Monthly PyPI downloads
- api
- whats_new
+A simple API wrapper for `Top.gg `_ written in Python.
+
+Installation
+------------
+
+.. code:: bash
+
+ pip install topggpy
+
+Features
+--------
-Indices and tables
-==================
+* POST server count
+* GET bot info, server count, upvote info
+* GET user info
+* GET widgets (large and small) including custom ones. See `docs.top.gg `_ for more info.
+* GET weekend status
+* Built-in webhook to handle Top.gg votes
+* Automated server count posting
+* Searching for bots via the API
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
+Additional information
+----------------------
+
+* Before using the webhook provided by this library, make sure that you have specified port open.
+* Optimal values for port are between 1024 and 49151.
+* If you happen to need help implementing topggpy in your bot, feel free to ask in the ``#development`` or ``#api`` channels in our `Discord server `_.
+
+.. toctree::
+ :maxdepth: 2
+ :hidden:
+
+ api/index.rst
+ examples/index.rst
+ whats_new
+ repository
+ support
\ No newline at end of file
diff --git a/docs/repository.rst b/docs/repository.rst
new file mode 100644
index 0000000..a542ad6
--- /dev/null
+++ b/docs/repository.rst
@@ -0,0 +1,5 @@
+=================
+GitHub repository
+=================
+
+You should be redirected in a few moments. Otherwise, click here: https://github.com/top-gg-community/python-sdk
\ No newline at end of file
diff --git a/docs/support.rst b/docs/support.rst
new file mode 100644
index 0000000..531270f
--- /dev/null
+++ b/docs/support.rst
@@ -0,0 +1,5 @@
+==============
+Support server
+==============
+
+You should be redirected in a few moments. Otherwise, click here: https://discord.gg/dbl
\ No newline at end of file
diff --git a/docs/topgg.svg b/docs/topgg.svg
index 9afe235..63f5812 100644
--- a/docs/topgg.svg
+++ b/docs/topgg.svg
@@ -1,10 +1,4 @@
-