Skip to content
This repository was archived by the owner on Mar 8, 2022. It is now read-only.

Commit 5f86e22

Browse files
committed
updated doc theme
1 parent 83d23d7 commit 5f86e22

File tree

13 files changed

+168
-5
lines changed

13 files changed

+168
-5
lines changed

discord_ui/client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ async def sync_commands(self, delete_unused=False):
283283
----------
284284
delete_unused: :class:`bool`, optional
285285
Whether the unused command should be deleted from the api; default ``False``
286+
286287
Raises
287288
------
288289
:raises: :class:`InvalidArgument` : A slash command has an invalid guild_id
@@ -442,6 +443,7 @@ async def create_command(self, command):
442443
----------
443444
command: :class:`SlashCommand` | :class:`ContextCommand`
444445
The command that should be added
446+
445447
Raises
446448
------
447449
:raises: :class:`InvalidArgument` : When a guild-id in ``guild_ids`` is not a valid server where the bot client is in it
@@ -577,6 +579,7 @@ async def edit_command(self, old_name, typ: Literal["slash", 1, "user", 2, "mess
577579
The new guild permissions for the command
578580
callback: :class:`function`, optional, optional
579581
The new command callback; default ``MISSING``
582+
580583
Raises
581584
------
582585
:raises: :class:`NotFound` : When a command in the internal cache doesn't exsist
@@ -710,6 +713,7 @@ def add_command(self, name, callback=None, description=MISSING, options=[], guil
710713
711714
name: :class:`str`
712715
1-32 characters long name
716+
713717
.. note::
714718
715719
The name will be corrected automaticaly (spaces will be replaced with "-" and the name will be lowercased)
@@ -749,6 +753,7 @@ def command(self, name=MISSING, description=MISSING, options=[], guild_ids=MISSI
749753
----------
750754
name: :class:`str`, optional
751755
1-32 characters long name; default MISSING
756+
752757
.. note::
753758
754759
The name will be corrected automaticaly (spaces will be replaced with "-" and the name will be lowercased)
@@ -829,6 +834,7 @@ def subcommand(self, base_names, name=MISSING, description=MISSING, options=[],
829834
If you want to make a subcommand (``/base name``), you have to use a str instead of a list
830835
name: :class:`str`, optional
831836
1-32 characters long name; default MISSING
837+
832838
.. note::
833839
834840
The name will be corrected automaticaly (spaces will be replaced with "-" and the name will be lowercased)
@@ -990,6 +996,7 @@ def message_command(self, name=MISSING, guild_ids=MISSING, default_permission=Tr
990996
The used slash command
991997
message: :class:`~Message`
992998
The message on which the command was used
999+
9931000
.. note::
9941001
9951002
``ctx`` and ``message`` are just example names, you can use whatever you want for that
@@ -1255,6 +1262,7 @@ def send_webhook(self, webhook, content=MISSING, *, wait=False, username=MISSING
12551262
allowed mentions for the message; default None
12561263
components: List[:class:`~Button` | :class:`~LinkButton` | :class:`~SelectMenu`], optional
12571264
the message components to include with the message; default None
1265+
12581266
Returns
12591267
-------
12601268
:returns: The message sent, if wait was True, else nothing will be returned

discord_ui/cogs.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ def slash_cog(name=MISSING, description=MISSING, options=[], guild_ids=MISSING,
307307
----------
308308
name: :class:`str`, optional
309309
1-32 characters long name; default MISSING
310+
310311
.. note::
311312
312313
The name will be corrected automaticaly (spaces will be replaced with "-" and the name will be lowercased)
@@ -371,6 +372,7 @@ def subslash_cog(base_names, name=MISSING, description=MISSING, options=[], guil
371372
If you want to make a subcommand (``/base name``), you have to use a str instead of a list
372373
name: :class:`str`, optional
373374
1-32 characters long name; default MISSING
375+
374376
.. note::
375377
376378
The name will be corrected automaticaly (spaces will be replaced with "-" and the name will be lowercased)
@@ -463,6 +465,7 @@ def context_cog(type: Literal["user", 2, "message", 3], name=MISSING, guild_ids=
463465
The used slash command
464466
message: :class:`~Message`
465467
The message on which the command was used
468+
466469
.. note::
467470
468471
``ctx`` and ``message`` are just example names, you can use whatever you want for that

discord_ui/components.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,7 @@ def filter(self, check = lambda x: ...):
789789
----------
790790
check: :class:`lambda`
791791
What condition has to be True that the component will pass the filter
792+
792793
Returns
793794
-------
794795
:returns: The filtered components

discord_ui/receive.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,7 @@ async def edit(self, **fields):
639639
r = BetterRoute("PATCH", f"/webhooks/{self._application_id}/{self._interaction_token}/messages/{self.id}")
640640
self._update(await self._state.http.request(r, json=jsonifyMessage(**fields)))
641641
async def delete(self):
642+
"""Override for delete function that will throw an exception"""
642643
raise EphemeralDeletion()
643644

644645
class EphemeralResponseMessage(Message):
@@ -674,6 +675,7 @@ async def testing(ctx):
674675
route = BetterRoute("PATCH", f"/webhooks/{self.interaction.application_id}/{token}/messages/{self.id}")
675676
self._update(await self._state.http.request(route, json=jsonifyMessage(**fields)))
676677
async def delete(self):
678+
"""Override for delete function that will throw an exception"""
677679
raise EphemeralDeletion()
678680
async def disable_components(self, token, disable = True):
679681
"""Disables all component in the message

discord_ui/slash/tools.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ def create_choice(name, value) -> dict:
194194
The name of the choice
195195
value: :class:`Any`
196196
The value that will be received when the user selected this choice
197+
197198
Returns
198199
-------
199200
:returns: The created choice

discord_ui/slash/types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ class SlashCommand():
351351
name: :class:`str`
352352
1-32 characters long name
353353
If name is not passed, the name of the callback function will be used; default MISSING
354+
354355
.. important::
355356
356357
The name will be corrected automaticaly (spaces will be replaced with "-" and the name will be lowercased)

discord_ui/tools.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ def components_to_dict(*components) -> List[dict]:
107107
Raises
108108
------
109109
:raises: :class:`Exception` : Invalid Data was passed
110+
110111
Returns
111112
-------
112113
:returns: The converted data

docs/source/_static/css/main.css

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
.wy-nav-content, .wy-nav-content-wrap {
2+
/* background-color: #23272A; */
3+
/* color: white; */
4+
}
5+
6+
.btn.btn-neutral {
7+
border: 1px solid #2C2F33;
8+
border-radius: 5px;
9+
color: white
10+
}
11+
12+
.admonition-title {
13+
border-top: 1px solid white;
14+
border-radius: 5px;
15+
}
16+
17+
.admonition {
18+
border: 1px solid white;
19+
border-radius: 10px;
20+
color: black;
21+
}
22+
23+
code.docutils.literal.notranslate, .highlight, div.highlight-default.notranslate {
24+
background-color: #2C2F33;
25+
border: 2px solid #2C2F33;
26+
border-radius: 5px;
27+
line-height: 1em;
28+
font-weight: 80;
29+
color: white;
30+
}
31+
32+
.wy-nav-side {
33+
background-color: #23272A;
34+
}
35+
.wy-side-nav-search {
36+
background-color: #5865F2;
37+
border: 4px solid #5865F2;
38+
border-bottom-left-radius: 6px;
39+
border-bottom-right-radius: 6px;
40+
}
41+
42+
.toctree-l1.current {
43+
/* border: 0.5px solid white; */
44+
border-radius: 2.5px;
45+
}
46+
47+
dt::before {
48+
content: " "
49+
}
50+
51+
/* #region Scrollbar */
52+
/* Breite */
53+
::-webkit-scrollbar {
54+
width: 8px;
55+
height: 6px;
56+
}
57+
58+
/* Hintergrund von dem außer dem Scrollding */
59+
::-webkit-scrollbar-track {
60+
background: #1b1b1b ;
61+
border: 1px solid #1b1b1b;
62+
/* border-radius: 15px; */
63+
}
64+
65+
/* Farbe von dem Scrollding */
66+
::-webkit-scrollbar-thumb {
67+
background: #5865F2;
68+
border: 1px solid #5865F2;
69+
border-radius: 15px;
70+
}
71+
72+
/* Hover Farbe */
73+
::-webkit-scrollbar-thumb:hover {
74+
background: #5865F2;
75+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
function change_color(class_name, color) {
2+
result = document.getElementsByClassName(class_name)
3+
for (var i = 0; i < result.length; i++) {
4+
result[i].style.color = color
5+
result[i].style["font-weight"] = 100
6+
};
7+
}
8+
9+
window.onload = function() {
10+
//#region colors
11+
let string_green = "#afff7d"
12+
let self_red = "#ff525d"
13+
let int_orange = "#ffed85"
14+
15+
// numbers
16+
change_color("mi", int_orange)
17+
// '' string
18+
change_color("s1", string_green)
19+
// "" string
20+
change_color("s2", string_green)
21+
// """""" docstring
22+
change_color("sd", string_green)
23+
// bools
24+
change_color("kc", self_red)
25+
26+
// import statements
27+
change_color("kn", "#d962fc")
28+
// import package
29+
change_color("nn", "orange")
30+
// comments
31+
change_color("c1", "grey")
32+
33+
34+
// class name
35+
change_color("nc", "orange")
36+
// __init__
37+
change_color("fm", "#5865F2")
38+
// self
39+
change_color("bp", self_red)
40+
41+
// async, def, await
42+
change_color("k", "#eb52ff")
43+
// function name
44+
change_color("nf", "#5865F2")
45+
46+
// built-in function calls
47+
change_color("nb", "#ecfc5b")
48+
// +, -, *, /, =
49+
change_color("o", "#69f5f2")
50+
//#endregion
51+
52+
// fix code
53+
result = document.getElementsByTagName("code");
54+
for (let i = 0; i < result.length; i++)
55+
result[i].style["font-weight"] = 100
56+
}

docs/source/cogs.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ To use cog tools, you have to import the module
1313
1414
from discord_ui.cogs import slash_cog, subslash_cog, context_cog, listening_component_cog
1515
16-
.. important::
16+
.. important::
1717

18-
You need a :class:`~Slash` instance for slashcommands cogs and a :class:`~Component` instance for listening components.
19-
The best would be to initialze a `~UI` instance, because it will initialize a component instance and a slash instance
18+
You need a :class:`~Slash` instance for slashcommands cogs and a :class:`~Component` instance for listening components.
19+
The best would be to initialze a :class:`~UI` instance, because it will initialize a component instance and a slash instance
2020

2121

2222
Example

0 commit comments

Comments
 (0)