|
25 | 25 |
|
26 | 26 | from __future__ import annotations
|
27 | 27 |
|
28 |
| -import contextlib |
29 | 28 | import datetime
|
30 | 29 | from typing import TYPE_CHECKING, Any, Callable, Iterable, Mapping, TypeVar, overload
|
31 | 30 |
|
@@ -1170,10 +1169,9 @@ async def edit(self, *, reason=None, **options):
|
1170 | 1169 | HTTPException
|
1171 | 1170 | Editing the channel failed.
|
1172 | 1171 | """
|
1173 |
| - with contextlib.suppress(KeyError): |
1174 |
| - require_tag = options.pop("require_tag") |
| 1172 | + if "require_tag" in options: |
1175 | 1173 | options["flags"] = ChannelFlags._from_value(self.flags.value)
|
1176 |
| - options["flags"].require_tag = require_tag |
| 1174 | + options["flags"].require_tag = options.pop("require_tag") |
1177 | 1175 |
|
1178 | 1176 | payload = await self._edit(options, reason=reason)
|
1179 | 1177 | if payload is not None:
|
@@ -1432,8 +1430,11 @@ class MediaChannel(ForumChannel):
|
1432 | 1430 | """
|
1433 | 1431 |
|
1434 | 1432 | @property
|
1435 |
| - def hides_media_download_options(self) -> bool: |
1436 |
| - """Whether media download options are hidden in this media channel.""" |
| 1433 | + def media_download_options_hidden(self) -> bool: |
| 1434 | + """Whether media download options are hidden in this media channel. |
| 1435 | +
|
| 1436 | + .. versionadded:: 2.7 |
| 1437 | + """ |
1437 | 1438 | return self.flags.hide_media_download_options
|
1438 | 1439 |
|
1439 | 1440 | @overload
|
@@ -1528,19 +1529,14 @@ async def edit(self, *, reason=None, **options):
|
1528 | 1529 | HTTPException
|
1529 | 1530 | Editing the channel failed.
|
1530 | 1531 | """
|
1531 |
| - with contextlib.suppress(KeyError): |
1532 |
| - require_tag = options.pop("require_tag") |
1533 |
| - options["flags"] = options.get("flags") or ChannelFlags._from_value( |
1534 |
| - self.flags.value |
1535 |
| - ) |
1536 |
| - options["flags"].require_tag = require_tag |
1537 | 1532 |
|
1538 |
| - with contextlib.suppress(KeyError): |
1539 |
| - hide_media_download_options = options.pop("hide_media_download_options") |
1540 |
| - options["flags"] = options.get("flags") or ChannelFlags._from_value( |
1541 |
| - self.flags.value |
| 1533 | + if "require_tag" in options or "hide_media_download_options" in options: |
| 1534 | + flags = ChannelFlags._from_value(self.flags.value) |
| 1535 | + flags.require_tag = options.pop("require_tag", flags.require_tag) |
| 1536 | + flags.hide_media_download_options = options.pop( |
| 1537 | + "hide_media_download_options", flags.hide_media_download_options |
1542 | 1538 | )
|
1543 |
| - options["flags"].hide_media_download_options = hide_media_download_options |
| 1539 | + options["flags"] = flags |
1544 | 1540 |
|
1545 | 1541 | payload = await self._edit(options, reason=reason)
|
1546 | 1542 | if payload is not None:
|
|
0 commit comments