Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
239 commits
Select commit Hold shift + click to select a range
b207c8a
[commands] Add perms object param to default_permissions decorator
codeofandrin Oct 12, 2024
2087564
Fix MessageReferenceType not being public
z03h Oct 12, 2024
5734996
Fix soundboard sounds event data type
Rapptz Oct 12, 2024
442ad40
[commands] Add SoundboardSoundConverter
z03h Oct 13, 2024
ca85782
[commands] Fix Context.defer unconditionally deferring
Rapptz Oct 13, 2024
9da131e
Fix variance typing issue with CommandTree.error decorator
PythonCoderAS Oct 14, 2024
b0c66b7
Fix NameError in sku.py
Soheab Oct 16, 2024
c5e7406
[commands] Unwrap Parameter if given as default to commands.parameter
Soheab Oct 16, 2024
354ae42
Fix abc.GuildChannel.clone implementations
Soheab Oct 16, 2024
c8ecbd8
Add Message.forward flag
diceroll123 Oct 22, 2024
e94fb45
Add note about using venvs on Linux
Rapptz Oct 22, 2024
a0b0a97
Support enforce_nonce and add random nonce for message creation
Rapptz Oct 27, 2024
ed61588
Handle improper 1000 closures by Discord
Rapptz Oct 28, 2024
d08fd59
Avoid returning in finally
mikeshardmind Oct 30, 2024
af75985
Fix incorrect import
diceroll123 Oct 31, 2024
c7305b0
[commands] Respect enabled kwarg for hybrid app commands
Soheab Nov 7, 2024
814ce3c
Add command target to MessageInteractionMetadata
Soheab Nov 9, 2024
7db879b
Clear up add_roles and remove_roles documentation
MajorTanya Nov 9, 2024
5c4c281
Sanitize invite argument before calling the invite info endpoint
Rapptz Nov 24, 2024
e1b6310
Remove / from being safe from URI encoding when constructing paths
Rapptz Nov 24, 2024
7f95357
Add mention property to PartialMessageable
Soheab Dec 1, 2024
9806aeb
Add public method to get session start limits
mikeshardmind Dec 1, 2024
fcd9239
Add Client.fetch_guild_preview method
gingershaped Jan 15, 2025
bb5a470
Bump Sphinx to 5.3.0
LevBernstein Jan 15, 2025
f2aa0b8
[tasks] Fix race condition with set_result
mikeshardmind Jan 15, 2025
eb15aa8
Add exclude_deleted parameter to Client.entitlements
DA-344 Jan 15, 2025
6214942
Fix SessionStartLimits and SKU.subscriptions docstrings
DA-344 Jan 15, 2025
9dc8e27
Add ForumChannel.members property
LostLuma Jan 15, 2025
ed95f2f
Parse full message for raw message edit event
Soheab Jan 15, 2025
7c8503f
Fix callable FlagConverter defaults on hybrid commands
DA-344 Jan 15, 2025
1646471
Revert "Bump Sphinx to 5.3.0"
Rapptz Jan 15, 2025
55974eb
Fix MessageSnapshot sticker_items typo
vionya Jan 15, 2025
cf6d7ff
Fix bug due to typo in async pagination of entitlements loop
AbstractUmbra Jan 15, 2025
1537102
Temporary dependency for docs extra on python 3.13+
mikeshardmind Jan 15, 2025
fa1cc00
Return new instance in Poll.end to avoid inconsistencies
nthnwj Jan 15, 2025
1edec93
Update Member.timed_out_until docstring
scrazzz Jan 15, 2025
2c3938d
Update Client.create_application_emoji docs
tom-jm69 Jan 16, 2025
7db3911
Add __repr__ to Interaction
owocado Jan 16, 2025
d956058
[commands] Fix _fallback attr not being set on replace for Parameter
AbstractUmbra Jan 16, 2025
d5c80b6
Add optional dev dependencies
Soheab Jan 16, 2025
b1b7369
Added scopeless kwarg to discord.utils.oauth_url
Depreca1ed Jan 17, 2025
743ef27
[commands] Correct ExtensionNotFound error message
Soheab Jan 19, 2025
ff2ad34
Add support for multiple subscription tier SKUs
DA-344 Jan 19, 2025
afbbc07
Add support for poll result messages
DA-344 Jan 19, 2025
418a791
Add raw presence update evemt
EvieePy Jan 21, 2025
db7b2d9
Change default file size limit
mikeshardmind Jan 22, 2025
88d7bd1
Fix message_pin, message_unpin target id being None
iyad-f Feb 9, 2025
7f51136
Fix wait_for overloads
Soheab Feb 9, 2025
a8134df
Fix Embed type attribute ddocs link
MajorTanya Feb 9, 2025
42e4a87
Fix typo in voice server update state handling
dolfies Feb 9, 2025
52967ec
Fix path sanitation for absolute Windows paths
tailoric Feb 9, 2025
76eb126
Add 'mention' property in PartialWebhookChannel
Gooraeng Feb 9, 2025
8a95c01
Add support for embed flags and update attachment flags
DA-344 Feb 12, 2025
4c3ce8f
Fix Member.roles having None members
Depreca1ed Feb 12, 2025
8edf433
Implement rich role.move interface
LeoCx1000 Feb 12, 2025
6ab747f
Add support for sending views in stateless webhooks
DA-344 Feb 17, 2025
fa158a5
Add support for getting and editing integration_types_config applicat…
Soheab Feb 18, 2025
5b78097
Add support for Interaction Callback Resource
DA-344 Feb 18, 2025
776fc22
[commands] Use interaction response within Context.send
Rapptz Feb 18, 2025
1cdf710
Rename InteractionCallback to InteractionCallbackResponse
Rapptz Feb 18, 2025
8953938
Update Pyright to v1.1.394
Rapptz Feb 18, 2025
43e1c55
Remove with_response parameter documentation
Rapptz Feb 18, 2025
e8d571b
Add missing Poll attribute documentation
Rapptz Feb 18, 2025
3ad0662
Document SoundboardSoundConverter
Rapptz Feb 18, 2025
a1aa597
Add changelog for v2.5
Rapptz Feb 18, 2025
e837ac1
Version bump to v2.5.0
Rapptz Feb 18, 2025
2cf1bab
Version bump for development
Rapptz Feb 18, 2025
4703234
Pass BotT type argument to DeferTyping
itswilliboy Feb 19, 2025
0e4f061
Fix InteractionCallbackResponse.resource having incorrect state
DA-344 Feb 19, 2025
19f02c4
Document message types that can have a default message reference
Jackenmen Feb 24, 2025
a8b4eb1
Create ScheduledEvent on cache miss in SCHEDULED_EVENT_DELETE
dolfies Feb 24, 2025
93426da
Improve on_timeout FAQ
Soheab Feb 24, 2025
66f3548
Add defaults for message object parsing
dolfies Feb 28, 2025
fbe2b35
Add note about NotFound for Messageable.send
Rapptz Feb 28, 2025
de5720e
Fix attachment is_spoiler() and is_voice_message()
dolfies Mar 3, 2025
cab4732
Make embed flags required and add them to all media fields
dolfies Mar 4, 2025
6b0a6ee
Add v2.5.1 changelog
Rapptz Mar 4, 2025
73f261d
Version bump to v2.5.1
Rapptz Mar 4, 2025
973bb50
Version bump for development
Rapptz Mar 4, 2025
2f8b262
Fix improper class in audit log docs
LeoCx1000 Mar 4, 2025
8594dd1
Fix embed media flags regression
dolfies Mar 4, 2025
f4bce1c
Add changelog for v2.5.2
Rapptz Mar 5, 2025
d2a6ccf
Version bump to v2.5.2
Rapptz Mar 5, 2025
460d188
Version bump for development
Rapptz Mar 5, 2025
2685516
update PyNaCl minimum version dependency
rishitkhare Mar 5, 2025
8d8d5e1
fix docs for soundboard_sound_update event
owocado Jun 20, 2025
7f16a06
Copy Select options when creating View class
LeoCx1000 Jun 20, 2025
3e48119
Fix unreachable code not triggering privileged intent error
frxctura Jun 20, 2025
0ce1154
Add discord.Permissions.apps()
Depreca1ed Jun 20, 2025
aa5f4bd
Fix poll parameter defaulting to MISSING instead of None for Context.…
Soheab Jun 20, 2025
680fe9b
Add channel select to component type documentation
Tari-dev Jun 20, 2025
e84edf4
Add colours for new Discord themes
LeoCx1000 Jun 20, 2025
e177b4a
Fix EmbedMediaProxy boolean check
AbstractUmbra Jun 20, 2025
ef06d7d
Add Interaction.filesize_limit
LeoCx1000 Jun 20, 2025
b28a4a1
Fix potentially stuck ratelimit buckets
mikeshardmind Jun 20, 2025
adb93f4
Add deprecation warning to create_guild functions
Gooraeng Jun 20, 2025
4a8817a
Document return object for Guild.create_template
Soheab Jun 20, 2025
667e7c9
Fixed to_dict() bug for user-defined embed classes
cyberoby Jun 20, 2025
2bcbd49
Add __repr__ method to various classes
owocado Jun 20, 2025
c524f65
Use human_join internal helper in BaseChannelTransformer
owocado Jun 20, 2025
826aa22
Add platform key in __repr__ method for Game and Streaming
owocado Jun 20, 2025
fe942d1
Properly transform media channels in app commands
owocado Jun 20, 2025
d00c124
Add MessageApplication.__str__
owocado Jun 20, 2025
4862ea2
Return invites when deleting them via Invite.delete or Client.delete_…
owocado Jun 20, 2025
f6e0f72
Add ability to create a media-only forum channel
Soheab Jun 20, 2025
6af9de0
Ensure COPYING notice is included
mikeshardmind Jun 20, 2025
7fe1102
Allow creating NSFW voice/stage channels
Soheab Jun 20, 2025
e9f807e
Fix Thread.applied_tags for media channels
owocado Jun 20, 2025
a62b25c
Add missing attributes in AppCommandChannel
owocado Jun 20, 2025
20055e7
Fix calculation of hashed rate limit keys
dolfies Jun 26, 2025
2175bd5
Fix voice connection issues and upgrade to voice v8
DA-344 Jun 30, 2025
59546a4
Add support for launch_activity interaction response
Joosemi02 Jul 2, 2025
774b934
Add support for guest invites
Soheab Jul 2, 2025
2502a78
Add BCP47 unicode tags for Locale enum
exorcize Jul 8, 2025
cb73009
Add role parameters to support new gradient and holographic roles
makerze Jul 8, 2025
66922cc
Fix documentation on Role secondary and tertiary colours
DA-344 Jul 9, 2025
b1be7de
Handle empty guild_ids list for app_commands
laggron42 Jul 9, 2025
a005109
Support new role colours in audit log
z03h Jul 9, 2025
13dc9c9
Fix miswording in docstring about bot.emojis
Ken-Miles Jul 15, 2025
7724764
Add ability to use primary guild (clan) data for users
blord0 Jul 18, 2025
0e97ef2
Fix key error on role create or delete
z03h Jul 22, 2025
5f4a822
Add missing fill_with_flags decorator to InviteFlags class
Sacul0457 Jul 27, 2025
e715ad6
Add support for automod_quarantined_guild_tag member flag
Sacul0457 Jul 27, 2025
5b81a99
Fix error when sending non-interactive views via partial webhooks
Amjuks Jul 27, 2025
22ade98
Skip GUILD_MEMBER_ADD if member already cached
tudubucket Jul 27, 2025
ce9f5ad
Fix context install decorators to correctly restrict commands
px1w Apr 28, 2025
2695fa0
Fix guild_only app command decorator
owocado Jul 30, 2025
348c7d7
Fix audit log automod_rule_trigger_type extra missing
AbstractUmbra Jul 30, 2025
6e7fc13
Add support for new RPC Activity fields
Soheab Jul 30, 2025
1cd90f8
[commands] Fix converters not working with Optional for hybrids
Soheab Jul 30, 2025
cb7f170
Deprecate Guild.delete and various parameters for Guild.edit
Soheab Jul 30, 2025
4496df7
Fix crash in Activity.__init__ with missing keys
owocado Jul 30, 2025
21fed31
Add FAQ about guild specific app commands
Soheab Aug 8, 2025
7b3f798
Add support for guild onboarding
Soheab Aug 8, 2025
db42eba
Add more attributes to AppCommandChannel/Thread
Sacul0457 Aug 8, 2025
ec409a0
Guard AppCommandThread.guild attribute access
Rapptz Aug 8, 2025
6ec2e53
Deprecate with_expiration param in fetch_invite
Sacul0457 Aug 12, 2025
50caa3c
Add support for components V2
DA-344 Aug 14, 2025
705eb2c
Update to support new pin endpoints
Soheab Aug 14, 2025
439bd71
Upstream change in Python
mikeshardmind Aug 14, 2025
8c18867
Don't recreate ItemCallbackType
Rapptz Aug 14, 2025
9fb74fd
Remove unnecessary TypeGuard
Rapptz Aug 14, 2025
3fb627d
Add support for label components and select in modals
Rapptz Aug 14, 2025
38c6407
Maintain a reference to View dispatched tasks
Rapptz Aug 14, 2025
773fcc8
Remove outdated note about having to delete owned guild
notSoti Aug 14, 2025
4839036
Add missing guild features in types.guild
Sacul0457 Aug 14, 2025
1343259
Fix various docs around UI items
Soheab Aug 14, 2025
983a9b8
Use Unpack where it's possible
Soheab Aug 15, 2025
08ef967
Typecheck when constructing MediaGalleryItem
Rapptz Aug 15, 2025
7e2ca02
Add total_message_sent attribute to threads
Sacul0457 Aug 15, 2025
4f539b7
Fix type errors in all examples
Rapptz Aug 16, 2025
24d3a12
Remove unused row parameter from TextDisplay
Rapptz Aug 16, 2025
4be15b5
Add example showcasing Container for Embed-like layouts
Rapptz Aug 16, 2025
22d6e8d
Add example showcasing how to do a settings panel
Rapptz Aug 17, 2025
eb84d0d
Add example showcasing ui.Label in modals
Rapptz Aug 18, 2025
2a69ac4
Document difference between View and LayoutView
Rapptz Aug 18, 2025
5887ce1
Fix settings example not resetting option default state
Rapptz Aug 18, 2025
9ef5b05
Refactor total children count to an overrideable method
Rapptz Aug 18, 2025
98d2113
Hide interaction_check where it isn't really applicable
Rapptz Aug 18, 2025
4854c56
Allow discord.File in places where UnfurledMediaItem or str are allowed
Rapptz Aug 18, 2025
0c98251
Move Locale.language_code documentation to where it belongs
Rapptz Aug 18, 2025
6f6d990
Fix type error with ItemCallbackType
Rapptz Aug 18, 2025
76258d0
Add note for File.uri and ASCII only names
Rapptz Aug 18, 2025
13d1fbe
Add more detail to what filenames are allowed in File.uri
Rapptz Aug 18, 2025
e00bb0b
Change info directive to note
Rapptz Aug 18, 2025
f08c042
Add content_length method to LayoutView and container items
Rapptz Aug 18, 2025
064cb7a
Add View.total_children_count
Rapptz Aug 18, 2025
fc12a41
Run black
Rapptz Aug 18, 2025
5d49f11
Remove View.from_dict typing
Rapptz Aug 18, 2025
714df2c
Add changelog for v2.6
Rapptz Aug 18, 2025
9845a53
Version bump to v2.6.0
Rapptz Aug 18, 2025
1bc330a
Version bump for development
Rapptz Aug 18, 2025
d58c055
Remove unused import
Rapptz Aug 18, 2025
3ef6272
Fix error with View.from_message when having multiple items
Rapptz Aug 18, 2025
44a44e9
Reformat entire project with ruff instead of black
Rapptz Aug 19, 2025
ad48815
Add Permissions.pin_messages
Rapptz Aug 19, 2025
a5a4bcf
Update Permissions.manage_messages docstring
Rapptz Aug 19, 2025
9dbf13c
Document Section.accessory as an attribute
Rapptz Aug 19, 2025
24aa98b
Fix Section.children and accessory's parent being None
DA-344 Aug 20, 2025
283ed20
Use List[Component] in docs instead of spelling them all out
Rapptz Aug 20, 2025
8f83267
Move UnfurledMediaItem and MediaGalleryItem to interactions page
Rapptz Aug 20, 2025
27d69e9
Fix note in button decorator in action row
Sacul0457 Aug 20, 2025
59e28af
Fix Section.accessory being MISSING
Rapptz Aug 20, 2025
20f4bc4
Remove outdated comment
Rapptz Aug 20, 2025
d897027
Create .git-blame-ignore-revs
Sachaa-Thanasius Aug 20, 2025
b2aab86
Add typing-extensions to lint workflow
diceroll123 Aug 20, 2025
0309aac
Add a swap method for dynamic item's dispatching
DA-344 Aug 20, 2025
9bda89b
Update total count tracking to always consider the wrapper object
Rapptz Aug 22, 2025
0b7d30b
Fallback to None for AuditLogAction.category
Rapptz Aug 22, 2025
de09031
Allow TextDisplay as a top-level component in modals
Rapptz Aug 22, 2025
6d50130
Flip if statement for wrapped ActionRow components in modals
Rapptz Aug 22, 2025
d00ac62
Remove uses of deprecated Logger.warn method
Rapptz Aug 22, 2025
ab6efd0
[tasks] Log handled exceptions before sleeping
Rapptz Aug 22, 2025
fe7ce98
Add second generic parameter for view for DynamicItem
Rapptz Aug 24, 2025
bb45e05
Change Modal inheritance to BaseView instead of View
Rapptz Aug 24, 2025
753db17
Add changelog for v2.6.1
Rapptz Aug 24, 2025
9677dad
Fix Modal not raising when hitting the 5 item limit
Rapptz Aug 24, 2025
63357e0
Revert "Add second generic parameter for view for DynamicItem"
Rapptz Aug 24, 2025
50b0d21
Add missing versionadded to some BaseView items
lmaotrigine Aug 24, 2025
91281f2
Add Set Voice Channel Status permission
Jackenmen Aug 24, 2025
d5946d1
Fix bounds for TextInput and Label generic
Rapptz Aug 25, 2025
69f06c9
Fix Select.required not being applied
z03h Aug 26, 2025
cbff6dd
Add support for user collectibles
Soheab Aug 26, 2025
7c52dbd
Fix spelling mistake in LabelComponent slots
Sacul0457 Aug 26, 2025
116107d
Add accessory to Section.__repr__
Rapptz Aug 26, 2025
2f1f5fe
Revert "Fix context install decorators to correctly restrict commands"
Rapptz Aug 27, 2025
89d5cbd
Move v2 item check from BaseView to View
Rapptz Aug 31, 2025
6c4f8c4
Add changelog for v2.6.2 and v2.6.3
Rapptz Aug 28, 2025
25a4dbe
Remove id from LabelComponent.__repr__
Rapptz Aug 31, 2025
1e165ee
Update docs for on_user_update to mention primary_guild
blord0 Sep 2, 2025
44956db
Update modal example in docstring
Sacul0457 Sep 2, 2025
3f47698
All __all__ to primary_guilds module
diceroll123 Sep 3, 2025
a7f3494
Upgrade code by using f-strings and yield from
Luc1412 Sep 3, 2025
fe4bf87
Add channel attribute to automod quarantine user AuditLogAction
Sacul0457 Sep 3, 2025
bd329b1
Add support for emoji_added message type
diceroll123 Sep 3, 2025
a2a2281
Fix various TypeDicts for Unpack
Soheab Sep 28, 2025
b837d94
Add silent parameter to ForumChannel.create_thread
martinbndr Sep 28, 2025
a2a00ae
Fix unordered list rendering for several AuditLogAction entries
AbstractUmbra Sep 28, 2025
6ad5541
Add missing InviteType and ReactionType exports
LeviPesin Sep 28, 2025
46300df
Add missing reason kwarg in delete_invite
Sacul0457 Sep 28, 2025
c050ed0
Support new fields in Modify Current Member
Sacul0457 Sep 28, 2025
78ff166
Fix certain component IDs not being able to be settable afterwards
Rapptz Sep 28, 2025
830858c
Add MessageType.is_deletable to fix Messageable.purge failing
Rapptz Sep 28, 2025
1d3642d
Fix KeyError on custom_id for modal components that don't support it
Soheab Sep 21, 2025
944ffe9
Handle resolved data for modal components and types
Soheab Sep 21, 2025
2d7e061
Add support for File Upload component
Soheab Sep 21, 2025
178ea66
Add missing required kwarg to all select classes
Soheab Sep 21, 2025
d786362
Correct supported types in docs for modal components
Soheab Sep 21, 2025
8f90b7d
Add shoutout to Button and Thumbnail accessories for Section
Rapptz Sep 28, 2025
c7575d9
Fix docstrings for version added in Member.edit
Sacul0457 Oct 2, 2025
651699f
Remove buggy and unintentional Container.children setter
Rapptz Oct 5, 2025
88294fe
Fix Section.accessory setter not updating view bindings
Rapptz Oct 8, 2025
e2b6fa8
Use obj reference target instead of data for typing objects
Rapptz Oct 8, 2025
463becb
Use compression.zstd for gateway compression on Python 3.14
beer-psi Oct 8, 2025
be3e332
Add v2.6.4 changelog
Rapptz Oct 8, 2025
6d19bc7
[commands] Fix flag annotations not working under 3.14
Rapptz Oct 14, 2025
9c327df
Use webp as the default emoji URL format
Rapptz Oct 14, 2025
c58b973
Add animated=true parameter to animated emoji
Rapptz Oct 14, 2025
ab8195b
Add support for role member counts
Rapptz Oct 16, 2025
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
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Replace Black with Ruff, then format whole project.
44a44e938fb2bd0bb085d8aa4577abeb01653ad3
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Install dependencies
id: install-deps
run: |
python -m pip install --upgrade pip setuptools wheel black==22.6 requests
python -m pip install --upgrade pip setuptools wheel ruff==0.12 requests "typing_extensions>=4.3,<5"
pip install -U -r requirements.txt

- name: Setup node.js
Expand All @@ -38,11 +38,11 @@ jobs:
- name: Run Pyright
uses: jakebailey/pyright-action@v1
with:
version: '1.1.351'
version: '1.1.394'
warnings: false
no-comments: ${{ matrix.python-version != '3.x' }}

- name: Run black
- name: Run ruff
if: ${{ always() && steps.install-deps.outcome == 'success' }}
run: |
black --check discord examples
ruff format --check discord examples
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include README.rst
include LICENSE
include requirements.txt
include discord/bin/*.dll
include discord/bin/*
include discord/py.typed
7 changes: 7 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ Installing

To install the library without full voice support, you can just run the following command:

.. note::

A `Virtual Environment <https://docs.python.org/3/library/venv.html>`__ is recommended to install
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (typo): "A Virtual Environment" should start with a lowercase "a".

Suggested change
A `Virtual Environment <https://docs.python.org/3/library/venv.html>`__ is recommended to install
a `Virtual Environment <https://docs.python.org/3/library/venv.html>`__ is recommended to install

the library, especially on Linux where the system Python is externally managed and restricts which
packages you can install on it.


.. code:: sh

# Linux/macOS
Expand Down
10 changes: 7 additions & 3 deletions discord/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
__author__ = 'Rapptz'
__license__ = 'MIT'
__copyright__ = 'Copyright 2015-present Rapptz'
__version__ = '2.5.0a'
__version__ = '2.7.0a'

__path__ = __import__('pkgutil').extend_path(__path__, __name__)

Expand Down Expand Up @@ -72,17 +72,21 @@
from .poll import *
from .soundboard import *
from .subscription import *
from .presences import *
from .primary_guild import *
from .onboarding import *
from .collectible import *


class VersionInfo(NamedTuple):
major: int
minor: int
micro: int
releaselevel: Literal["alpha", "beta", "candidate", "final"]
releaselevel: Literal['alpha', 'beta', 'candidate', 'final']
serial: int


version_info: VersionInfo = VersionInfo(major=2, minor=5, micro=0, releaselevel='alpha', serial=0)
version_info: VersionInfo = VersionInfo(major=2, minor=7, micro=0, releaselevel='alpha', serial=0)

logging.getLogger(__name__).addHandler(logging.NullHandler())

Expand Down
14 changes: 10 additions & 4 deletions discord/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import argparse
import sys
from pathlib import Path
from pathlib import Path, PurePath, PureWindowsPath

import discord
import importlib.metadata
Expand Down Expand Up @@ -133,7 +133,7 @@ async def setup(bot):
await bot.add_cog({name}(bot))
'''

_cog_extras = '''
_cog_extras = """
async def cog_load(self):
# loading logic goes here
pass
Expand Down Expand Up @@ -170,7 +170,7 @@ async def cog_after_invoke(self, ctx):
# called after a command is called here
pass

'''
"""


# certain file names and directory names are forbidden
Expand Down Expand Up @@ -225,8 +225,14 @@ def to_path(parser: argparse.ArgumentParser, name: str, *, replace_spaces: bool
)
if len(name) <= 4 and name.upper() in forbidden:
parser.error('invalid directory name given, use a different one')
path = PurePath(name)
if isinstance(path, PureWindowsPath) and path.drive:
drive, rest = path.parts[0], path.parts[1:]
transformed = tuple(map(lambda p: p.translate(_translation_table), rest))
name = drive + '\\'.join(transformed)

name = name.translate(_translation_table)
else:
name = name.translate(_translation_table)
if replace_spaces:
name = name.replace(' ', '-')
return Path(name)
Expand Down
Loading