73 Commits

Author SHA1 Message Date
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
Kowlin
4580a13e98
Minor bugfixes resolving around modlog UI (#5615)
Multiple bugfixes
 * Fixed unbound channel_value
 * Fixed lack of new lines for listcases
 * Fixed response text for case. It can only be used in the current server.
2022-06-05 17:38:46 +02:00
Jakub Kuczys
27bed5010f
Make controls in menu() optional (#5678)
* Make `controls` in `menu()` optional

You might wonder, shouldn't we pass `None` to functions from controls?
No, we shouldn't because when `None` is passed, only DEFAULT_CONTROLS
can be used and that means that the length of pages list won't change.

* Update usage in core and core cogs

* Add missing docstrings to `redbot.core.utils.menus` module
2022-04-16 13:29:12 -06: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
c69e8d31fd Reformat with Black 22.1.0 2022-03-22 18:37:17 +01: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
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
Kowlin
67bcd72d9c
Update the timestamping we forgot to Discord compatible timestamping (#5395) 2021-10-16 21:38:52 +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
23997d7a71
[Docs] Modlog Cog Guide (#4919)
* Initial commit

* Docstring changes and index

* Add modlog cog guide to labeler
2021-05-26 13:30:23 -04:00
Kreusada
c36665e755
[Modlog] Add confirmation prompt to [p]modlogset resetcases (#4976)
* [Modlog] Confirmation for resetting modlog cases

* We need to return there

* Update modlog.py

* style

* Update redbot/cogs/modlog/modlog.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2021-05-19 12:39:41 +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
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
TrustyJAID
e106dfaece
Add [p]listcases command and typing indicator to [p]casesfor (#4426)
* [ModLog] Add [p]listcases and typing indicator to casesfor

* weird

* Address review

* Update redbot/cogs/modlog/modlog.py

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

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2021-01-23 20:48:31 +01: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]
e50b32cc27
[i18n] Automated Crowdin downstream (#4596)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-11-16 18:26:02 +01:00
github-actions[bot]
ffcf104dfc
Automated Crowdin downstream (#4567)
Red I18n: "Context comments are changed edition"

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-11-02 17:32:43 +01:00
Kowlin
a9656dea38
Delete no-NO in favor of nb-NO (#4396) 2020-09-05 02:48:55 +02:00
github-actions[bot]
f8fcabfe10
Automated Crowdin downstream (#4395)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-09-03 17:26:47 +02:00
github-actions[bot]
e1a9b31e9b
Automated Crowdin downstream (#4394)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-09-03 15:48:34 +02:00
github-actions[bot]
ec7c2ca4b9
Automated Crowdin downstream (#4373)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-08-30 17:42:37 +02:00
Kowlin
eeb5f651b2
Stop the insanity that is this inconsistent command name! (#4328) 2020-08-25 05:18:50 -06:00
github-actions[bot]
8c7848f18b
Automated Crowdin downstream (#4327)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-08-20 19:30:44 +02:00
github-actions[bot]
d1b7e0eafb
Automated Crowdin downstream (#4181)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-08-14 08:40:04 +02:00
Dav
914f82f352
[Modlog] add timestamp to [p]casesfor and [p]case (#4137)
* add timestamp to casesfor and case

* [Casereader] add timestamp + i18nify

* of course it was needed...

* Update redbot/cogs/modlog/modlog.py

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

* Update redbot/cogs/modlog/modlog.py

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

* well that was easier than expected

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

* thx for the help jack

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

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-08-13 23:17:02 +02:00
DevilXD
6e63ed4e60
Use aware objects when storing and reading UTC timestamps (#4017)
* Use aware objects instead of naive ones

* Use aware objects when storing and reading UTC timestamps

* Remove unneeded parentheses

* Fixed naive and aware objects unable to be compared here

* Address feedback

* Fix the newly added `modlog.create_case()` calls

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-08-12 10:46:32 +02:00
github-actions[bot]
5f52fb872a
[i18n] Automated Crowdin downstream (#4166)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-08-06 17:19:59 +02:00
Michael H
c0b1e50a5f
Begin work on a data request API (#4045)
[Core] Data Deletion And Disclosure APIs

 - Adds a Data Deletion API
   - Deletion comes in a few forms based on who is requesting
   - Deletion must be handled by 3rd party
 - Adds a Data Collection Disclosure Command
   - Provides a dynamically generated statement from 3rd party
   extensions
 - Modifies the always available commands to be cog compatible
   - Also prevents them from being unloaded accidentally
2020-08-03 15:09:07 +02:00
github-actions[bot]
fb96392e73
Automated Crowdin downstream (#4103)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-07-28 03:05:19 +02:00
github-actions[bot]
a7a18ad956
Automated Crowdin downstream (#4060)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-07-09 18:53:49 +02:00
github-actions[bot]
0358473af5
Automated Crowdin downstream (#3984)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-06-18 14:33:59 +02:00
jack1142
8d553a3fc6
Improve command error responses (#3951)
* Update settings.py

* Update modlog.py
2020-06-18 13:46:20 +02:00
github-actions[bot]
480c3129bd
Automated Crowdin downstream (#3830)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-05-07 16:37:33 +02:00
github-actions[bot]
36a0eabf4a
Automated Crowdin downstream (#3739)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-04-09 21:27:35 +02:00
github-actions[bot]
3e1bb88ab7
Automated Crowdin downstream (#3650)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-03-18 20:48:15 +01:00
github-actions[bot]
4db77c9051
Automated Crowdin downstream (#3616) 2020-02-28 01:02:44 +01:00
github-actions[bot]
0913b68a1e
Automated Crowdin downstream (#3543) 2020-02-13 12:54:28 -05:00
Cog-Creators Bot
4370ec922b
Automated Crowdin downstream (#3531)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-02-08 19:49:30 +01:00
Michael H
6219f0da67
[Modlog API] Add resolution for people inpacted by bad casetypes (#3333)
* add resolution for people inpacted by bad casetypes

* *some* amount of notice on this

* Fine.

* clearer warnings

* actually, unnneded
2020-01-17 18:51:49 -05:00
Michael H
a73b174d9f
update translation catalogs (#3280) 2020-01-07 17:16:21 -05:00
Toby Harradine
ef8b9b81c3 [ModLog] Optimise get_next_case_number() (#2908)
* [ModLog] Optimise get_next_case_number()

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>

* Address reviews

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>

* Add changelog entry

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>

* Delete get_next_case_number

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>

* Add modlog.get_latest_case() and fix `[p]reason`

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-08-02 10:49:22 -04:00
Toby Harradine
8676dd3ce3 [i18n] Update translation catalogs (#2867)
* [i18n] Update translation catalogs

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>

* Install redgettext 3.1 in travis crowdin deployment

Last time the catalog templates were updated, redgettext 3.0 was used. I'd rather Travis didn't upload them after extracting with an older version.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-07-13 23:52:18 -04:00
Flame442
687b88ca6f Added some periods to some strings (#2852) 2019-07-12 18:29:27 -04:00
PredaaA
03fe3ee720 [i18n] Fix some missing i18n strings in the whole bot (#2633) 2019-06-30 01:13:53 +10:00
Toby Harradine
628073cbe1
Update Translations (#2486)
Also included a Makefile recipe which makes use of the Crowdin CLI's `crowdin download` command. This requires whoever is using it to provide the project's API key in an environment variable, but we may automate this at some point.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-03-04 08:55:01 +11:00
Toby Harradine
cf18b601e2
[Mod] Use consume-rest in [p]casesfor 2019-02-22 17:52:30 +11:00
DiscordLiz
9966668307 adds function to modlg API to get cases by member (#2453)
adds command using this to view all of a member's cases demonstrating this

closes #2266
2019-02-22 03:31:37 +01:00