245 Commits

Author SHA1 Message Date
github-actions[bot]
d04cc36bc6
Automated Crowdin downstream (#6212)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-07-24 20:15:23 +02:00
Jakub Kuczys
10e09d6abc
d.py 2.3 / pomelo changes (#6130)
Co-authored-by: Michael Oliveira <34169552+Flame442@users.noreply.github.com>
2023-06-14 04:56:50 +02:00
github-actions[bot]
a59e73a605
Automated Crowdin downstream (#6161)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-05-14 22:17:45 +02:00
Vexed
2386b8363f
Fix visual issues with Discord's new Markdown (#6101)
Co-authored-by: Jakub Kuczys <me@jacken.men>
2023-05-13 12:39:57 +02:00
github-actions[bot]
7b80043d19
Automated Crowdin downstream (#6119)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-05-04 03:04:41 +02:00
Jakub Kuczys
b7c710ac04
Make it possible to set slowmode in stage/voice channels (#6108) 2023-05-02 16:05:51 -04:00
Kreusada
79d11e947c
Use the commands module instead of checks for permission decorators (#5463)
Co-authored-by: Flame442 <34169552+Flame442@users.noreply.github.com>
2023-04-13 14:16:12 -04:00
Lioness100
a89a27cadf
docs: fix typos (#5989)
Co-authored-by: Flame442 <34169552+Flame442@users.noreply.github.com>
2023-02-13 21:36:09 -05:00
Kowlin
72172ff1cb
Bump discord.py to version 2.1.0 (#5920) 2022-12-02 19:40:15 +01:00
Vexed
3be22b683c
[Mod] Account for roles in mention spam (#5388)
Co-authored-by: Kowlin <10947836+Kowlin@users.noreply.github.com>
2022-10-20 18:56:40 +02:00
Flame442
76c0ee243e
[Mod] Hide config migration commands (#5870) 2022-10-11 22:57:18 +02:00
Jakub Kuczys
f02528378f
discord.py 2.0 update (3d914e08->2.0.1) (#5709) 2022-10-03 16:07:15 +02:00
jack1142
febca8ccbb
Migration to discord.py 2.0 (#5600)
* Temporarily set d.py to use latest git revision

* Remove `bot` param to Client.start

* Switch to aware datetimes

A lot of this is removing `.replace(...)` which while not technically
needed, simplifies the code base. There's only a few changes that are
actually necessary here.

* Update to work with new Asset design

* [threads] Update core ModLog API to support threads

- Added proper support for passing `Thread` to `channel`
  when creating/editing case
- Added `parent_channel_id` attribute to Modlog API's Case
    - Added `parent_channel` property that tries to get parent channel
- Updated case's content to show both thread and parent information

* [threads] Disallow usage of threads in some of the commands

- announceset channel
- filter channel clear
- filter channel add
- filter channel remove
- GlobalUniqueObjectFinder converter
    - permissions addglobalrule
    - permissions removeglobalrule
    - permissions removeserverrule
    - Permissions cog does not perform any validation for IDs
      when setting through YAML so that has not been touched
- streamalert twitch/youtube/picarto
- embedset channel
- set ownernotifications adddestination

* [threads] Handle threads in Red's permissions system (Requires)

- Made permissions system apply rules of (only) parent in threads

* [threads] Update embed_requested to support threads

- Threads don't have their own embed settings and inherit from parent

* [threads] Update Red.message_eligible_as_command to support threads

* [threads] Properly handle invocation of [p](un)mutechannel in threads

Usage of a (un)mutechannel will mute/unmute user in the parent channel
if it's invoked in a thread.

* [threads] Update Filter cog to properly handle threads

- `[p]filter channel list` in a threads sends list for parent channel
- Checking for filter hits for a message in a thread checks its parent
  channel's word list. There's no separate word list for threads.

* [threads] Support threads in Audio cog

- Handle threads being notify channels
- Update type hint for `is_query_allowed()`

* [threads] Update type hints and documentation to reflect thread support

- Documented that `{channel}` in CCs might be a thread
- Allowed (documented) usage of threads with `Config.channel()`
    - Separate thread scope is still in the picture though
      if it were to be done, it's going to be in separate in PR
- GuildContext.channel might be Thread

* Use less costy channel check in customcom's on_message_without_command

This isn't needed for d.py 2.0 but whatever...

* Update for in-place edits

* Embed's bool changed behavior, I'm hoping it doesn't affect us

* Address User.permissions_in() removal

* Swap VerificationLevel.extreme with VerificationLevel.highest

* Change to keyword-only parameters

* Change of `Guild.vanity_invite()` return type

* avatar -> display_avatar

* Fix metaclass shenanigans with Converter

* Update Red.add_cog() to be inline with `dpy_commands.Bot.add_cog()`

This means adding `override` keyword-only parameter and causing
small breakage by swapping RuntimeError with discord.ClientException.

* Address all DEP-WARNs

* Remove Context.clean_prefix and use upstream implementation instead

* Remove commands.Literal and use upstream implementation instead

Honestly, this was a rather bad implementation anyway...

Breaking but actually not really - it was provisional.

* Update Command.callback's setter

Support for functools.partial is now built into d.py

* Add new perms in HUMANIZED_PERM mapping (some from d.py 1.7 it seems)

BTW, that should really be in core instead of what we have now...

* Remove the part of do_conversion that has not worked for a long while

* Stop wrapping BadArgument in ConversionFailure

This is breaking but it's best to resolve it like this.

The functionality of ConversionFailure can be replicated with
Context.current_parameter and Context.current_argument.

* Add custom errors for int and float converters

* Remove Command.__call__ as it's now implemented in d.py

* Get rid of _dpy_reimplements

These were reimplemented for the purpose of typing
so it is no longer needed now that d.py is type hinted.

* Add return to Red.remove_cog

* Ensure we don't delete messages that differ only by used sticker

* discord.InvalidArgument->ValueError

* Move from raw <t:...> syntax to discord.utils.format_dt()

* Address AsyncIter removal

* Swap to pos-only for params that are pos-only in upstream

* Update for changes to Command.params

* [threads] Support threads in ignore checks and allow ignoring them

- Updated `[p](un)ignore channel` to accept threads
- Updated `[p]ignore list` to list ignored threads
- Updated logic in `Red.ignored_channel_or_guild()`

Ignores for guild channels now work as follows (only changes for threads):
- if channel is not a thread:
    - check if user has manage channels perm in channel
      and allow command usage if so
    - check if channel is ignored and disallow command usage if so
    - allow command usage if none of the conditions above happened
- if channel is a thread:
    - check if user has manage channels perm in parent channel
      and allow command usage if so
    - check if parent channel is ignored and disallow command usage
      if so
    - check if user has manage thread perm in parent channel
      and allow command usage if so
    - check if thread is ignored and disallow command usage if so
    - allow command usage if none of the conditions above happened

* [partial] Raise TypeError when channel is of PartialMessageable type

- Red.embed_requested
- Red.ignored_channel_or_guild

* [partial] Discard command messages when channel is PartialMessageable

* [threads] Add utilities for checking appropriate perms in both channels & threads

* [threads] Update code to use can_react_in() and @bot_can_react()

* [threads] Update code to use can_send_messages_in

* [threads] Add send_messages_in_threads perm to mute role and overrides

* [threads] Update code to use (bot/user)_can_manage_channel

* [threads] Update [p]diagnoseissues to work with threads

* Type hint fix

* [threads] Patch vendored discord.ext.menus to check proper perms in threads

I guess we've reached time when we have to patch the lib we vendor...

* Make docs generation work with non-final d.py releases

* Update discord.utils.oauth_url() usage

* Swap usage of discord.Embed.Empty/discord.embeds.EmptyEmbed to None

* Update usage of Guild.member_count to work with `None`

* Switch from Guild.vanity_invite() to Guild.vanity_url

* Update startup process to work with d.py's new asynchronous startup

* Use setup_hook() for pre-connect actions

* Update core's add_cog, remove_cog, and load_extension methods

* Update all setup functions to async and add awaits to bot.add_cog calls

* Modernize cogs by using async cog_load and cog_unload

* Address StoreChannel removal

* [partial] Disallow passing PartialMessageable to Case.channel

* [partial] Update cogs and utils to work better with PartialMessageable

- Ignore messages with PartialMessageable channel in CustomCommands cog
- In Filter cog, don't pass channel to modlog.create_case()
  if it's PartialMessageable
- In Trivia cog, only compare channel IDs
- Make `.utils.menus.menu()` work for messages
  with PartialMessageable channel
- Make checks in `.utils.tunnel.Tunnel.communicate()` more rigid

* Add few missing DEP-WARNs
2022-04-03 03:21:20 +02:00
jack1142
d932abad16
Use Guild.fetch_ban() over Guild.bans() (#5656) 2022-04-02 01:44:30 +02:00
jack1142
c69e8d31fd Reformat with Black 22.1.0 2022-03-22 18:37:17 +01:00
jack1142
ed4f2cf466
Switch from low-level loop.create_task and asyncio.ensure_future (#5626)
* Switch from low-level loop.create_task and asyncio.ensure_future

* Patch vendored discord.ext.menus to use modern APIs as well

That ext is no longer maintained by Danny anyway so...

* black
2022-03-21 10:24:46 -06:00
Dav
c6517d5087
[Core/Core Cogs] Prevent translation errors and use formatting utils (#5435)
* Use proper syntax for inline formatting in core_commands

* use proper formating utils in core and core cogs wherever reasonable

* tests are awesome

* ensure "(continued)" is translated in help.py

* add colons to translatable strings for easier context comprehension by translators

* Thx flame :)

Co-authored-by: Flame442 <34169552+Flame442@users.noreply.github.com>

* good point

Co-authored-by: Dav <dav@mail.stopdavabuse.de>
Co-authored-by: Flame442 <34169552+Flame442@users.noreply.github.com>
2022-02-15 20:25:21 -05:00
sravan
442cad7917
[Mod] Typo in unban command (#5470) 2021-12-23 02:51:55 +01:00
palmtree5
6acdcdeae9
Move modlogset/bankset commands to core (#4486)
* Move bankset and modlogset to core commands

* Move prune over too

* Finish moving prune

* Move [p]economyset registeramount to [p]bankset registeramount

* style fix

* Fix circular import issue with another breaking change

* Apparently I missed a conflict and git still let me commit...

* Really git?

* Rename RawUserIds -> RawUserIdConverter, improve documentation

* Improve documentation of `is_owner_if_bank_global()`

* MENTION_REGEX -> USER_MENTION_REGEX

* Add 'bank.' prefix

* Fix command examples in docstrings

* Missing docstring change from `bankset prune`

* Missing changes for commands in modlogset

* Update docs

* Remove duplicated info in `economyset showsettings`

* Fix toctree in index.rst

* Add command group prefixes to names of functions for bankset/modlogset

* Remaining string updates due to command name changes

* Ensure that the bank folder is actually gone

Co-authored-by: palmtree5 <palmtree5+3577255@users.noreply.github.com>
Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2021-11-25 10:06:30 +01:00
WreckRox
9aee8ce28f
Fix descriptions for examples of ID-based command invocations in Mod (#5372)
* Fix wording in redbot/cogs/mod/kickban.py to match with the command example

* Made changes as requested in PR Review #770078179

* Added changes to docs/cog_guides/mod.rst as requested in PR Review #70784066

* Fixed kick wording

* Fix kick wording
2021-10-16 01:29:15 +02:00
krak3n
17dc9e0c47
[Mod] Indicate successful run in [p]voicekick (#5367) 2021-10-16 00:50:58 +02:00
Fixator10
b4037a80d8
fix possible issue when joined_at is None (#5361) 2021-10-02 11:08:17 -04:00
jack1142
a0a433b13d
Improve and add more usage of discord timestamps (#5241)
* Improve and add more usage of discord timestamps

* How did that whitespace get there?
2021-09-04 09:14:05 +02:00
Enul
8880251749
[Mod] Add user hierarchy check to [p]rename (#5211)
* added hierarchy check for rename

added hierarchy check for rename from utils

* format and self check

changed formats and added statement if me != member

* black format

apply black formatting and fix typo

* tox style 

tox i guess

* tox again 

:<

* Update redbot/cogs/mod/names.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Fix styling

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2021-09-03 01:08:46 +00:00
Kreus Amredes
4e2e4bfe6a
[Mod] Send ban reason on Temp Bans (#4837)
* [Mod] Send ban reason on Temp Bans

* If none

* Locale friendly

* Fixes for black style

* Use double line break to distinguish between reason header

* Check settings

* Black

* Reduce the number of config calls

* remove additional config call

* fixes

* style

* We're already in `if reason` so this is always True

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2021-09-02 19:07:07 +02:00
Kowlin
f05debc923
Initial support for Discord timestamping (#5155)
* Initial support for Discord timestamping

* Fix timezones

* Fix userinfo for users with member.joined_at equal to None

* Simplify

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2021-08-31 19:55:33 +00:00
PredaaA
b586c2f990
[Mod] Check if guild is unavailable in tempban expirations (#5173)
* [Mod] Check if guild.me is None else continue in tempban expirations.

* Check for guild.unavailable instead of guild.me being None.
2021-08-31 20:48:21 +02:00
github-actions[bot]
5f0b4403bc
[i18n] Automated Crowdin downstream (#5132)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-06-12 18:53:21 +02:00
github-actions[bot]
ce4fd6cca8
[i18n] Automated Crowdin downstream (#5087)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-05-28 20:09:47 +02:00
Kreusada
410b2419dd
[Docs] Mod Cog Guide (#4886)
* Initial commit

* Add some args

* bool prolog

* index

* Add more arguments

* more arguments, style fixes

* improve naming of arguments

* Fix up backlog

* Run black

* extra corrections from backlog

* Update tempban arg names

* backlog

* change prolog type

* Change kick argument prolog to member instead of user

* Update argument names

* missed a colon

* Update prolog to be friendly with non-positional args

* Edit through the decorator instead

* Add back docstring spacing

* black

* usage in decorator for name commands

* Fix command signature

* fixup docstring spacing

* style fixes

* Add spacing inside unban docstring

* Rename args instead of using usage

* black - simple

* Add labeler glob

* unify style

* rename variables instead of usage

* Update docstrings correspondingly

* run black

* update description in usage

* ehh this isn't necessary...

* fix up tags

* fix grammar and accuracy issues

* fix docstring too
2021-05-18 17:10:30 -04:00
github-actions[bot]
6cae1c0204
[i18n] Automated Crowdin downstream (#4946)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-04-06 00:55:36 +02:00
jack1142
adda30cbee
Bump discord.py to 1.7.0 (#4928)
* Bump discord.py, but to the git version for now

* Import GuildConverter from d.py and deprecate our implementation

* Import PartialMessageConverter in our commands extension

* Use newly added `Cog.has_error_handler()` rather than private method

* Update snowflake regex to use 20 as max length

See Rapptz/discord.py#6501

* Use new supported way for custom cooldown buckets

* Include group args in command signature

* Update code to use `Client.close()` over `Client.logout()`

* Add StageChannelConverter and StoreChannelConverter

* Fix AttributeError in licenseinfo
2021-04-05 21:33:19 +02:00
PredaaA
363a2e8a17
[Mod] Only loop through guilds in config when checking tempbans (#4907)
* [Mod] No longer loop through all guilds on check_tempban_expirations.

* Address Jack's review.

* I don't think this comment actually served any purpose

* Split this into more methods

* Small optimization for cases where the guild tempbans weren't updated

* Blackify

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2021-04-03 23:59:41 +02:00
jack1142
be00a59ab3
Fix the tracking of nicks that were set just before nick reset (#4830) 2021-03-29 13:54:37 +02:00
github-actions[bot]
51b73fdd1a
[i18n] Automated Crowdin downstream (#4857)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-02-26 19:51:59 +01:00
github-actions[bot]
e80a00ec1b
[i18n] Automated Crowdin downstream (#4829)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-02-16 19:22:05 +00:00
Flame442
7b04c04551
[Mod] Add two new settings to disable name/nickname tracking (#4799)
* Add default settings for name tracking

* Add configuration command for name tracking

* Check the track names settings before tracking

* *grumble*

* Fix permissions levels

* Update settings.py

* Use clean_prefix in inline, and don't use f-strings in `_()`

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2021-02-16 20:13:37 +01:00
PhenoM4n4n
62411bc2a5
Add a command for deleting usernames and nicknames to Mod cog (#4827)
* mod delete names

* sTyLe fOrMAttInG

* Remove `[p]deletemodkeys` and have `[p]deletenames` remove empty keys

* Rename `[p]deletenames` to `[p]modset deletenames`

* Fix wrong variable being used

* Add confirmation to avoid mistakes

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2021-02-16 19:58:00 +01:00
aleclol
acec5c6efe
[Mod] Add default bot color to kick & ban DM (#4822) 2021-02-15 01:34:05 +01:00
github-actions[bot]
663876fba3
Automated Crowdin downstream (#4804)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-02-11 13:20:38 +00:00
github-actions[bot]
0f8f33fed2
Automated Crowdin downstream (#4734)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-02-04 18:05:40 +00:00
MAX
c11e9afec7
[mod] Improve help of ban/kick commands. (#4715)
* better explain on how to use.

* i.... dont know why i removed that dot.

* don't think that was meant to

* Update kickban.py

* smh

* style????

* hm?

* last try to fix style......

i dont even know how to do this :/

* failing style is fun, trynna learn.

* .....

* not the best way but lets try?

* yep, didnt work dropping softban.

* Update kickban.py

* grammar fix
2021-01-23 21:18:29 -05:00
jack1142
537656c365
Fix role position checks (#4740) 2021-01-20 13:32:43 -07:00
Dav
d7a3da49f0
[Mod] Make tempban not fail if no vanity url is set up (#4714)
* catch if a vanity url is not set up

* black

Co-authored-by: David Bauch <david.bauch@capgemini.com>
2021-01-17 23:42:00 +01:00
github-actions[bot]
b76b6305d1
Automated Crowdin downstream (#4703)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-01-07 17:26:35 +00:00
github-actions[bot]
13cd751932
Automated Crowdin downstream (#4689)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-12-24 15:45:31 +01:00
Predeactor
d53ff57794
Shorten the audit log reason appropriately, remove unused vars (#4189)
* [Mod] Check for reason length & remove unused vars

This PR also remove unused variable.

* Blame me

* Apply Kowlin order.

Text will get truncate in audit logs in case we're going over 512 characters.

* This is already handled by ban_user()

* Use `get_audit_reason()` in `[p]tempban`

* Add a new kwarg to `get_audit_reason()` instead

* Include `[p]voiceban` and `[p]voiceunban`

* Include Mutes cog

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-12-23 03:22:59 +01:00
jack1142
b36a702e62
Make command usage in help for required arguments consistent (#4589)
* Make command usage in help for required arguments consistent

* Bob 3

* Bob 1

* Docstring updates

* Address Flame's review

* Update cog guides in docs
2020-12-22 14:14:47 -05:00
github-actions[bot]
7f587ea46b
Automated Crowdin downstream (#4664)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-12-18 19:10:17 +01:00
github-actions[bot]
e2adb29cf3
Automated Crowdin downstream (#4638)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-11-29 22:04:43 +01:00