Skip to content

Enhance the !server command.#1166

Merged
mbaruh merged 21 commits into
masterfrom
feat/info/server-cmd-enhancements
Jan 24, 2021
Merged

Enhance the !server command.#1166
mbaruh merged 21 commits into
masterfrom
feat/info/server-cmd-enhancements

Conversation

@kosayoda

@kosayoda kosayoda commented Sep 21, 2020

Copy link
Copy Markdown
Contributor

The !server command is now more compact, and has more information.

In a regular channel

image

In a moderation channel

image

For contrast, the old embed:
image

I have no idea what I'm doing with the test.

Rather than do two passes over the channels, a single loop is used to
collect all the channel counts into a single dictionary.

The get_channel_type_counts method now returns a dictionary of channel
to count, allowing the caller liberty to format the values.
Includes useful information like the number of nominated/watched
members, number of unverified members, defcon status etc.

Will not show up if the command is ran outside of a moderation channel.
@kosayoda kosayoda requested a review from a team as a code owner September 21, 2020 15:32
@kosayoda kosayoda requested review from GhostofGoes and dementati and removed request for a team September 21, 2020 15:32
@ghost ghost added the needs 2 approvals label Sep 21, 2020
@kosayoda kosayoda added a: frontend Related to output and formatting a: information Related to information commands: (doc, help, information, reddit, site, tags) p: 3 - low Low Priority labels Sep 21, 2020
@Numerlor

Copy link
Copy Markdown
Contributor

The roles count feels a bit out of place under the member counts, maybe the description "header" would be more fitting for it?
Are the features necessary for the (user) embed? The information they expose feels unnecessary to know in almost all cases and they clutter it quite a bit

@kosayoda

Copy link
Copy Markdown
Contributor Author

The roles count <-- snip --> description "header" would be more fitting for it?

That's a good idea, and it would make some code a tad bit clearer.

Are the features necessary for the (user) embed?

By features I assume you mean the server features in the embed description. I agree, it gets quite long in the actual server.

@python-discord/core-developers I'll be removing the features section from the embed outside of a moderation channel if no one has an objection to it.

@Akarys42

Copy link
Copy Markdown
Contributor

Maybe we should also add a count for the missing roles: core devs, event team, python community and partners ?

@MarkKoz MarkKoz added the t: feature New feature or request label Sep 24, 2020
@thomaspet

thomaspet commented Sep 29, 2020

Copy link
Copy Markdown

Does the statuses look good with a big number on all 4? even on mobile?
like online, dnd, away and offline all being 10,000 at least.. offline and online might one day both me 100,000 as well.

@thomaspet thomaspet left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good to me, if we need the presence? I believe thats up for debate

Comment thread bot/exts/info/information.py Outdated
Comment on lines +45 to +46
channel.overwrites_for(guild.get_role(staff_role)).read_messages is True
and channel.overwrites_for(guild.default_role).read_messages is False

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Not against verbosity, but just making sure it was intended, and not be

Suggested change
channel.overwrites_for(guild.get_role(staff_role)).read_messages is True
and channel.overwrites_for(guild.default_role).read_messages is False
channel.overwrites_for(guild.get_role(staff_role)).read_messages
and not channel.overwrites_for(guild.default_role).read_messages

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

overwrites_for returns a PermissionOverwrite object.

Unlike a regular Permissions, the default value of a permission is equivalent to None and not False. Setting a value to False is explicitly denying that permission, while setting a value to True is explicitly allowing that permission.

An implicit check would also count the default permission as a deny, hence we explicitly check for True or False. I'm not resolving this yet since I think this could be clarified a bit more in the comment.

@kwzrd

kwzrd commented Oct 3, 2020

Copy link
Copy Markdown
Contributor

This PR will have conflicts with #1196 and should probably wait until we start using d.py 1.5; some of the presence tracking will no longer be possible.

@Xithrius

Copy link
Copy Markdown
Contributor

Updating:

The master branch now runs off of discord.py 1.5.1, and #1196 has been merged.

We do not have the Developers role anymore, so there's no such thing as
verified/unverified members.
@kosayoda kosayoda requested a review from Akarys42 as a code owner January 15, 2021 06:59
@coveralls

coveralls commented Jan 15, 2021

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.1%) to 56.607% when pulling e658e23 on feat/info/server-cmd-enhancements into abe439e on master.

@Xithrius Xithrius left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The code looks good to me, and I'm really into this new embed.

But should we have defcon days as None instead of -?

@kosayoda

Copy link
Copy Markdown
Contributor Author

But should we have defcon days as None instead of -?

I'm fine with either, - gives me a more "not applicable" feel than None though

@Xithrius

Copy link
Copy Markdown
Contributor

I see. It does look fine to me as of now.

If the staff doesn't like it for some reason, it can always be changed.

Comment thread bot/exts/info/information.py Outdated
Comment thread bot/exts/info/information.py Outdated
Comment thread bot/exts/info/information.py Outdated
Comment thread bot/exts/info/information.py Outdated
Comment thread bot/exts/info/information.py Outdated
Comment thread bot/exts/info/information.py Outdated
Comment thread bot/exts/info/information.py
Comment thread bot/exts/info/information.py Outdated
Comment thread bot/exts/info/information.py Outdated
Comment thread bot/exts/info/information.py Outdated
Comment thread bot/exts/info/information.py Outdated
@Xithrius Xithrius requested a review from mbaruh January 24, 2021 07:32
@mbaruh mbaruh merged commit 8ec2a4d into master Jan 24, 2021
@mbaruh mbaruh deleted the feat/info/server-cmd-enhancements branch January 24, 2021 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: frontend Related to output and formatting a: information Related to information commands: (doc, help, information, reddit, site, tags) p: 3 - low Low Priority t: feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants