58 Commits

Author SHA1 Message Date
Ryan
1fbd6d854b
[General] Fix [p]lmgtfy URL generation (#5909)
Co-authored-by: Jakub Kuczys <me@jacken.men>
2022-11-17 17:22:44 -05:00
Jakub Kuczys
86c6f199b3
Get rid of localized guild feature list in serverinfo (#5830) 2022-10-13 14:04:57 +02:00
Lemon Rose
4d1381d7c9
[General] show stage channels in [p]serverinfo 1 (#5785)
* [General] show stage channels in `[p]serverinfo 1`

* [General] Formatted with black

* fix black

* [General] Newline `\n` to match the current formatting.

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

Co-authored-by: Lemon Rose <japandotorg@users.noreply.github.com>
Co-authored-by: Flame442 <34169552+Flame442@users.noreply.github.com>
2022-08-08 19:55:43 -04:00
MAX
23023da09c
[General] update [p]serverinfo 1 guild features. (#5655) 2022-04-18 23:47:30 +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
PredaaA
4e469ce15e
Remove voice region field in [p]serverinfo (#5449)
* [General] Remove guild region on serverinfo

* Remove in string too.
2021-12-25 01:02:37 +01: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
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
TrustyJAID
631adc282f
[General] Fix usage in choose help (#5015)
Co-authored-by: Draper <27962761+Drapersniper@users.noreply.github.com>
2021-05-26 10:23:46 +01:00
Kreusada
700802c303
Merge pull request #5014
* [General] Provide the urban command with embed color

* spelling consistency...
2021-05-19 12:25:54 +01:00
Jamie
ae2bae058c
change domain to .app (#4840) 2021-02-20 23:50:40 +01:00
jack1142
2ce4a275fc
Fix command usage of [p]choose command (#4733)
* Fix usage in more commands with variadic required arguments

* Restore filter.py
2021-01-22 19:24:27 -05:00
Slave In Utero
e8aef1e923
[General] Add new available guild features in [p]serverinfo (#4678)
* add new available guild features

* Remove `ENABLED_DISCOVERABLE_BEFORE`

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-12-23 21:20:12 +01:00
Jyu Viole Grace
f4ef3ea8eb
Merge pull request #4507
* change `boosters` to `boosts`
2020-10-18 15:36:53 +01:00
Fixator10
009dc9ae4d
fix exception for empty strings in [p]choice (#4499) 2020-10-18 08:46:11 +01:00
MeatyChunks
6ea2a403be
[General] Fix error on long titles in [p]urban (#4474)
There's a few titles that are greater than 256 which causes a console error. The example I saw was scrolling through the pages of `[p]urban Jackin' Off` which leads to http://synonyms-chokin-the-chicken-spanking-the-monkey-flogging-the-do.urbanup.com/3169366
2020-10-11 17:14:21 +02:00
Nathaniel F
59f69c7727
[General] URL encode user input for [p]urban and [p]lmgtfy (#4024)
* URL encode user input in the general cog

Adds URL encoding to `[p]lmgtfy` via `urllib2.parse.quote_plus()`
and to `[p]urban` via `aiohttp.ClientSession.get`'s `params` argument

* Black reformatting
2020-09-03 00:35:27 +02:00
jack1142
85afe19455
Bump black to 20.8b1 (and reformat) (#4371)
* Bump black version

* Reformat with black
2020-08-29 19:12:28 +02:00
jack1142
01a6ef3a8f
Add variation selector-16 as appropriate to emojis across Red (#4127) 2020-08-10 03:05:57 +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
Predeactor
dce10d7282
Propose more info on simple serverinfo (#4121)
* Propose more info on simple serverinfo

* Fixed black + serverinfo

* Fix black (Sorry)

* Merge jack's suggestions

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

* Change separator

👍

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

* Black

* Update general.py

Co-authored-by: Ubuntu <ubuntu@vps-35e65bf5.vps.ovh.net>
Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-07-30 01:30:50 +02:00
PredaaA
28b5be21b3
[General] Change PUBLIC feature to COMMUNITY in serverinfo (#4116) 2020-07-25 22:05:11 +02:00
PredaaA
ecdcc27749
Fix count of streaming members and a typo in [p]serverinfo (#3701) 2020-03-28 20:15:16 +01:00
PredaaA
a88b2af4a9
[General] Fix streaming count in serverinfo command. (#3680)
* [General] Fix streaming count on serverinfo command.

* Update general.py

* Update general.py

* is
2020-03-21 22:23:56 +01:00
PredaaA
4de7ce32dd
[General] Add shard ID to serverinfo if bot uses multiple shards (#3659)
* [General] Add shard ID on serverinfo if there is over than two shards

* Update general.py

* Update general.py

* Update general.py

* Update general.py
2020-03-16 01:42:35 +01:00
PredaaA
6128d54601
[General] Add toggle to [p]serverinfo that shows more details (#2382)
* Improvements of "serverinfo" command

- Added some more informations about the server.
  (Verification level, AFK channel and timeout, custom emojis and special features).
- Added custom texts for Region (and Verification levels).
- Added more details about members (Number of humans, bots, and all status).
- Show special features only if the server has one.
- Show "Verified" logo only if the server is verified.
- And changed the footer by adding how many time the bot as join the server.

* Black formatting for serverinfo

* Black formatting fix and Sinbad suggestions

* Fix the discord.errors.NotFound on server command

Added exception on server command for the phrase "To leave a server, just type its number.".

* Update core_commands.py

* Delete core_commands.py

* Create core_commands.py

* Update core_commands.py

* Update core_commands.py

* Delete core_commands.py

* Create core_commands.py

* Update core_commands.py

* Update core_commands.py

* Little changes on serverinfo command

- Adding "lurkers" check, for the new feature that are on bot which allow users to join a server in read-only (Works only on verified servers for now)
- Adding streaming status.
- Adding mobile status with suggestion of Sinbad.

* Black style fix

* Add verbose for serverinfo and disable lurkers

I've added a bool that are False by default and sent the original serverinfo command, and if set to True send my edited version.
And I've disabled the lurkers detection until this bug (https://github.com/discordapp/discord-api-docs/issues/855) isn't fixed.

* Add of India region

* Code cleanup

* Emojis are not needed to be translated

* Update serverinfo

* Changelog.

* Update 2382.enhancement.rst

* Adress Jack's requests changes.

* oops

* Put guild description first + few last nitpicks

Co-authored-by: PredaMart <46051820+PredaMart@users.noreply.github.com>
Co-authored-by: Toby Harradine <Tobotimus@users.noreply.github.com>
Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-03-15 23:46:21 +01:00
Stonedestroyer
b085c1501f [General] Max amount to roll (#3395)
* [General] Rolls max amount

Adds max amount to roll.

* Removed redundant code.

* QA changes

* Add typehinting.
2020-01-20 16:49:46 -05:00
Draper
3c1b6ae4cf [Utils] Add humanize_number() function to chat formatting (#2836)
This adds babel as a dependency, and also includes `redbot.core.i18n.get_babel_locale()`
2019-08-28 08:44:52 +10:00
Toby Harradine
2bdc3ac10c [General] Fix KeyError in [p]urban
Resolves #2841.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2019-07-07 18:51:36 +10:00
PredaaA
03fe3ee720 [i18n] Fix some missing i18n strings in the whole bot (#2633) 2019-06-30 01:13:53 +10:00
jack1142
9d0ca00f89 [General]: shorten descriptions properly with disabled embeds in urban (#2684)
fix #2683
2019-05-16 02:06:46 -04:00
aikaterna
9973b2e3b8 [General] [p]urban: Handle no embeds (#2285) 2018-11-14 23:21:11 +01:00
aikaterna
d008a2559a [General] Clearer error message for [p]rps (#2284) 2018-11-14 22:56:08 +01:00
Toby Harradine
fa692ccc0b [i18n] Pass over economy, filter, general, image, mod
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-10-06 09:00:31 +10:00
Michael H
aa8c9c350e [i18n] Start work on named format arguments (#1795) 2018-10-06 08:42:38 +10:00
Toby Harradine
0870403299
Permissions redesign (#2149)
API changes:
- Cogs must now inherit from `commands.Cog` (see #2151 for discussion and more details)
- All functions which are not decorators in the `redbot.core.checks` module are now deprecated in favour of their counterparts in `redbot.core.utils.mod`. This is to make this module more consistent and end the confusing naming convention.
- `redbot.core.checks.check_overrides` function is now gone, overrideable checks can now be created with the `@commands.permissions_check` decorator
- Command, Group, Cog and Context have some new attributes and methods, but they are for internal use so shouldn't concern cog creators (unless they're making a permissions cog!).
- `__permissions_check_before` and `__permissions_check_after` have been replaced:  A cog method named `__permissions_hook` will be evaluated as permissions hooks in the same way `__permissions_check_before` previously was. Permissions hooks can also be added/removed/verified through the new `*_permissions_hook()` methods on the bot object, and they will be verified even when permissions is unloaded.
- New utility method `redbot.core.utils.chat_formatting.humanize_list`
- New dependency [`schema`](https://github.com/keleshev/schema)

User-facing changes:
- When a `@bot_has_permissions` check fails, the bot will respond saying what permissions were actually missing.
- All YAML-related `[p]permissions` subcommands now reside under the `[p]permissions acl` sub-group (tbh I still think the whole cog has too many top-level commands)
- The YAML schema for these commands has been changed
- A rule cannot be set as allow and deny at the same time (previously this would just default to allow)

Documentation:
- New documentation for `redbot.core.commands.requires` and `redbot.core.checks` modules
- Renewed documentation for the permissions cog
- `sphinx.ext.doctest` is now enabled

Note: standard discord.py checks will still behave exactly the same way, in fact they are checked before `Requires` is looked at, so they are not overrideable. 

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-10-01 13:19:25 +10:00
Toby Harradine
b2497386bb
Update dependencies (#2148)
Core dependencies:
- discord.py: Rapptz/discord.py@00a659c6 -> Rapptz/discord.py@00a659c6
- multidict: 4.4.0 -> 4.4.2

[docs]
- pyparsing: 2.2.0 -> 2.2.1
- sphinx: 1.7.8 -> 1.7.9

[test]
- pytest: 3.7.4 -> 3.8.1

[style]
- toml: 0.9.4 -> 0.9.6

----

I've also replaced usages of `discord.utils.get(guild.roles, id=id)` with the new O(1) `guild.get_role(id)` method.

Signed-off-by: Toby <tobyharradine@gmail.com>
2018-09-25 16:09:36 +10:00
Brramble
e77cfff892 [p]serverinfo respects set embed colour (#2083) 2018-09-04 13:01:50 +10:00
Toby Harradine
1b196bf0fb
[i18n] Use redgettext over pygettext (#2023)
* [i18n] Use redgettext over pygettext

* Clear out autogenerated `messages.pot` files

* Remove redundant `regen_messages.py` files

* Refactor `generate_strings.py` to use redgettext

* Install redgettext in Travis Crowdin job

* Clean up some problematic usages of gettext function

* Reformat

* Replace generate_strings.py with Makefile argument

* Update to redgettext 2.1, use exclusion pattern

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
2018-08-26 23:35:42 +10:00
Redjumpman
06f986b92e [General] Fix lmgtfy with '+' in search (#1991) 2018-08-10 14:41:23 +10:00
lionirdeadman
9d4f9ef73c [General] UI improvements to [p]urban (#1871)
* Changed urban dictionary for my embed version

* Used black for formatting

* Fixed everything according to Tobotimus's review

* Fixed the description limit to 2048 characters

* Better fix adding "..." at the end if neccessary

* Add non-embed version

* Blackify
2018-08-07 16:33:39 +10:00
Twentysix
1ad1744054 [V3 General] Fix online user count in [p]serverinfo (#1844)
* [General] Fix online user count in [p]serverinfo

* [General] Attempt to please the black gods
2018-06-10 23:25:54 +10:00
Eslyium
60a72b2ba4 [V3] Cleanup quotes in cogs (#1782)
* Cleanup quotes in cogs

* More quote cleanup that I missed

fixed a little bit of grammar here and there as well.

* [V3 Warnings] Change allowcustomreasons docstring

To help not confuse users who would believe that the command would use allow or disallow.

* Run black reformat
2018-06-07 00:42:59 -04:00
Tobotimus
14cc701b25 [V3] Update black version and reformat (#1745)
* Update black version and reformat

* Pin black in extras_require
2018-05-29 18:37:00 -08:00
palmtree5
5c9b1c9a3d Move [p]userinfo to Mod + refactor [p]names (#1719) 2018-05-28 03:23:24 +02:00
Michael H
d3f406a34a [V3 Travis] Update travis to not skip pipfile lock... (#1678)
* Update travis to not sip pipfile lock

update pipfile dependencies

additional black formatting pass to conform to black 18.5b

* .

* pin async timeout until further discussion of 3.5 support

* .
2018-05-18 17:48:22 -08:00
Michael H
b88b5a2601 [V3] Update code standards (black code format pass) (#1650)
* ran black: code formatter against `redbot/` with `-l 99`

* badge
2018-05-14 15:33:24 -04:00
Michael H
8739c04024 [V3] Ping changes (#1618)
* moves ping to core commands
defaults ping behavior to reacting with a ping pong paddle with ball
adds an optional boolean flag to ping to get the avg latency from the bot
(strikes a middle ground with intended behavior from dev standpoint, and how users want it)

* casing for @Kowlin

* use correct check for permissions

* remove latency
2018-05-13 15:03:17 -08:00