You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api.rst
+22-12Lines changed: 22 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,6 @@ Client
30
30
:members:
31
31
32
32
33
-
34
33
Event reference
35
34
---------------
36
35
@@ -50,32 +49,43 @@ Event reference
50
49
async def on_dbl_vote(data):
51
50
print(data)
52
51
53
-
The data returned can be found `here`_.
52
+
The returned data can be found `here`_.
54
53
55
54
.. _here: https://top.gg/api/docs#webhooks
56
55
57
-
.. function:: on_dbl_test(data)
56
+
Widgets
57
+
-------
58
58
59
-
Called when someone tests webhook system for your bot on top.gg
59
+
.. note:: General information about top.gg widgets can be in `top.gg docs`_.
60
60
61
-
:param data: The data with test info returned in dict object
61
+
In topggpy, :class:`DBLClient` has a :meth:`generate_widget` method that takes an ``options`` dictionary as a parameter.
62
62
63
-
Example: ::
63
+
All available values for each key:
64
+
* ``bot_id``: ID of a bot to generate widget for. Must resolve to an ID of a valid bot when converted to a string;
65
+
* ``format``: must be either ``png`` and ``svg``. Defaults to ``png``;
66
+
* ``type``: used for short widgets (``). For large widget, must be an empty string;
67
+
* ``noavatar``: indicates whether to exclude bot avatar from short widgets. Must be of type ``bool``;
68
+
* ``colors``: a dictionary consisting of a parameter as a key and HEX color as value. ``color`` will be appended to the key in case ``key.endswith("color")`` returns False. All available fields are mentioned in `top.gg docs`_.
64
69
65
-
@bot.event
66
-
async def on_dbl_test(data):
67
-
print(data)
70
+
Example: ::
68
71
69
-
The data returned can be found `here`_.
72
+
print(await self.topggpy.generate_widget(
73
+
{"id": 270904126974590976,
74
+
format: "svg",
75
+
colors: {
76
+
"username": 0xFFFFFF,
77
+
"top": 0x000000
78
+
}
79
+
}))
70
80
71
-
.. _here: https://top.gg/api/docs#webhooks
81
+
.. _top.gg docs: https://top.gg/api/docs#widgets
72
82
73
83
Exceptions
74
84
----------
75
85
76
86
The following exceptions are thrown by the library.
0 commit comments