Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ The community-maintained Python SDK for Top.gg.
- [Setting up](#setting-up)
- [Usage](#usage)
- [Getting your project's information](#getting-your-projects-information)
- [Updating your project's information](#updating-your-projects-information)
- [Getting your project's vote information of a user](#getting-your-projects-vote-information-of-a-user)
- [Getting a cursor-based paginated list of votes for your project](#getting-a-cursor-based-paginated-list-of-votes-for-your-project)
- [Posting an announcement for your project](#posting-an-announcement-for-your-project)
- [Posting your bot's application commands list](#posting-your-bots-application-commands-list)
- [Posting your project's metric stats](#posting-your-projects-metric-stats)
- [Generating widget URLs](#generating-widget-urls)
- [Webhooks](#webhooks)

Expand Down Expand Up @@ -44,6 +47,16 @@ client = topgg.Client(token)
project = await client.get_self()
```

### Updating your project's information

```py
await client.edit_self(headline={
topgg.Locale.ENGLISH: 'A great bot with tons of features!'
}, content={
topgg.Locale.ENGLISH: '# Welcome\nThis is the full page description for your project...'
})
```

### Getting your project's vote information of a user

#### Discord ID
Expand Down Expand Up @@ -77,6 +90,15 @@ for vote in second_page:
third_page = await second_page.next()
```

### Posting an announcement for your project

```py
announcement = await client.post_announcement(
'Version 2.0 Released!',
'We just released version 2.0 with a bunch of new features and improvements.',
)
```

### Posting your bot's application commands list

#### Discord.py
Expand Down Expand Up @@ -107,6 +129,29 @@ await client.post_commands(
)
```

### Posting your project's metric stats

#### Single

```py
await client.post_metrics(topgg.Metrics.discord_bot(server_count=1, shard_count=1))
```

#### Batch

```py
from datetime import datetime


timestamp1 = datetime.now()
timestamp2 = datetime.now()

await client.post_metrics({
timestamp1: topgg.Metrics.discord_bot(server_count=1, shard_count=1),
timestamp2: topgg.Metrics.discord_bot(server_count=1, shard_count=1)
})
```

### Generating widget URLs

#### Large
Expand Down
10 changes: 5 additions & 5 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = topggpy
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

Expand All @@ -17,4 +17,4 @@ help:
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
7 changes: 0 additions & 7 deletions docs/_static/css/custom.css

This file was deleted.

Binary file added docs/_static/favicon.ico
Binary file not shown.
Binary file removed docs/_static/img/favicon-16x16.png
Binary file not shown.
40 changes: 40 additions & 0 deletions docs/_static/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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
}
})

const tocDrawer = document.querySelector('aside.toc-drawer')

if (document.querySelector('section#topggpy')) {
// we don't need the right sidebar on the main landing page
tocDrawer.remove()
} else {
tocDrawer.style.visibility = 'visible'
}

// remove related pages in the footer
document.querySelector('.related-pages').remove()

// remove all header links
for (const headerLink of document.querySelectorAll('.headerlink')) {
headerLink.remove()
}

for (const page of document.querySelectorAll('.sidebar-scroll li')) {
const link = page.querySelector('a')
const label = page.querySelector('label')

if (label) {
link.addEventListener('click', event => {
event.preventDefault()
label.click()
})
}
}
65 changes: 65 additions & 0 deletions docs/_static/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
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: "Manrope", 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 *, em {
font-style: normal !important;
text-decoration: none !important;
font-weight: normal !important;
}

.sig-paren, span.p, :not(.sig-name) > span.pre {
font-weight: normal !important;
}

:not(h1) > a.reference {
text-decoration: underline;
}

:not(h1) > a.reference:hover {
text-decoration: none;
}

.field-even p strong, .field-odd p strong {
font-family: var(--font-stack--monospace);
}

h1 > a.reference:hover {
text-decoration: underline;
}

h1 {
font-weight: 900;
}

.sidebar-brand-text {
font-weight: bolder;
}

.sidebar-scroll .reference.internal {
color: var(--color-brand-primary);
}
19 changes: 0 additions & 19 deletions docs/api.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/api/autopost.rst

This file was deleted.

23 changes: 17 additions & 6 deletions docs/api/client.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
####################
Client API Reference
####################
Client reference
================

.. automodule:: topgg.client
:members:
:inherited-members:
.. autoclass:: topgg.client.Client
:members:

.. autoclass:: topgg.locale.Locale()
:members:
:undoc-members:

.. autoclass:: topgg.errors.Error()
:members:

.. autoclass:: topgg.errors.RequestError()
:members:

.. autoclass:: topgg.errors.Ratelimited()
:members:
7 changes: 0 additions & 7 deletions docs/api/data.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/api/errors.rst

This file was deleted.

10 changes: 10 additions & 0 deletions docs/api/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
API reference
=============

.. toctree::
:maxdepth: 2

client
project
user
widget
22 changes: 22 additions & 0 deletions docs/api/project.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Project reference
=================

.. autoclass:: topgg.project.Project()
:members:

.. autoclass:: topgg.project.PartialProject()
:members:

.. autoclass:: topgg.project.ProjectType()
:members:
:undoc-members:

.. autoclass:: topgg.project.Platform()
:members:
:undoc-members:

.. autoclass:: topgg.project.Announcement()
:members:

.. autoclass:: topgg.project.Metrics()
:members:
42 changes: 0 additions & 42 deletions docs/api/types.rst

This file was deleted.

19 changes: 19 additions & 0 deletions docs/api/user.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
User reference
==============

.. autoclass:: topgg.user.User()
:members:

.. autoclass:: topgg.user.UserSource()
:members:
:undoc-members:

.. autoclass:: topgg.user.PartialVote()
:members:

.. autoclass:: topgg.user.Vote()
:members:
:inherited-members:

.. autoclass:: topgg.user.PaginatedVotes()
:members:
7 changes: 0 additions & 7 deletions docs/api/webhook.rst

This file was deleted.

Loading