Skip to content

Add .pyfacts command#596

Merged
HassanAbouelela merged 15 commits into
python-discord:masterfrom
MrKomodoDragon:master
Mar 4, 2021
Merged

Add .pyfacts command#596
HassanAbouelela merged 15 commits into
python-discord:masterfrom
MrKomodoDragon:master

Conversation

@MrKomodoDragon
Copy link
Copy Markdown
Contributor

@MrKomodoDragon MrKomodoDragon commented Feb 16, 2021

Relevant Issues

Closes #587

Description

I added a text fie with some facts and made the command send an embed with the fact.

Reasoning

The text file would be simplest to edit and change.

Screenshots

image

Did you:

  • Join the Python Discord Community?
  • If dependencies have been added or updated, run pipenv lock?
  • Lint your code (pipenv run lint)?
  • Set the PR to allow edits from contributors?

Comment thread bot/exts/evergreen/pythonfacts.py Outdated
Comment thread bot/exts/evergreen/pythonfacts.py Outdated
Copy link
Copy Markdown
Member

@ChrisLovering ChrisLovering left a comment

Choose a reason for hiding this comment

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

Looks good to me, tested locally too.

We should definitely add more facts to this list!

@MrKomodoDragon
Copy link
Copy Markdown
Contributor Author

Any suggestions!

@ChrisLovering
Copy link
Copy Markdown
Member

ChrisLovering commented Feb 16, 2021

https://github.com/satwikkansal/wtfpython Has some interesting facts/behaviour of python.

Comment thread bot/exts/evergreen/pythonfacts.py Outdated
Comment thread bot/exts/evergreen/pythonfacts.py Outdated
Comment thread bot/exts/evergreen/pythonfacts.py Outdated
Comment thread bot/exts/evergreen/pythonfacts.py Outdated
Comment thread bot/resources/evergreen/python_facts.txt Outdated
Comment thread bot/exts/evergreen/pythonfacts.py Outdated
MrKomodoDragon and others added 4 commits February 16, 2021 17:57
Co-authored-by: Shivansh-007 <69356296+Shivansh-007@users.noreply.github.com>
Co-authored-by: Shivansh-007 <69356296+Shivansh-007@users.noreply.github.com>
Co-authored-by: Shivansh-007 <69356296+Shivansh-007@users.noreply.github.com>
Comment thread bot/exts/evergreen/pythonfacts.py Outdated
Comment thread bot/exts/evergreen/pythonfacts.py Outdated
with open('bot/resources/evergreen/python_facts.txt') as file:
FACTS = list(file)

COLORS = [0x4B8BBE, 0xFFD43B, ]
Copy link
Copy Markdown
Contributor

@Shivansh-007 Shivansh-007 Feb 17, 2021

Choose a reason for hiding this comment

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

Get the COLORS from constants.py or add this there.

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.

Done

@Xithrius Xithrius added area: backend Related to internal functionality and utilities priority: 2 - normal status: waiting for author Waiting for author to address a review or respond to a comment type: feature Relating to the functionality of the application. labels Feb 21, 2021
@Shivansh-007
Copy link
Copy Markdown
Contributor

One more thing, please update the screenshot you have put while opening the Pull Request.

Comment thread bot/exts/evergreen/pythonfacts.py Outdated
FACT_CYCLE = itertools.cycle(FACTS)

COLORS = [Colours.python_blue, Colours.python_yellow]
COLOR_CYCLE = itertools.cycle(COLORS)
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.

Since COLORS is not being used anywhere, directly put it in the cycle, same for the facts.

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.

Pardon?

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.

 COLOR_CYCLE = itertools.cycle([Colours.python_blue, Colours.python_yellow])

Copy link
Copy Markdown
Contributor

@Shivansh-007 Shivansh-007 left a comment

Choose a reason for hiding this comment

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

Thanks! Looks Good To Me!

@MrKomodoDragon
Copy link
Copy Markdown
Contributor Author

Just an idea, maybe make a google form for suggesting facts like for .topic?

@ks129
Copy link
Copy Markdown
Contributor

ks129 commented Feb 23, 2021

@MrKomodoDragon If we take suggestions, we should use GitHub Discussions instead.

@ChrisLovering
Copy link
Copy Markdown
Member

If we are going to be taking suggestions, should we add a footer to the embed with a link to the github discussion, like we do for .topics?

@MrKomodoDragon
Copy link
Copy Markdown
Contributor Author

Good idea chris!

@MrKomodoDragon
Copy link
Copy Markdown
Contributor Author

So, link to the discussion?

@RohanJnr
Copy link
Copy Markdown
Contributor

I would like an additional command which would append a python fact to the file and refresh the variable in the Cog which is storing the data loaded from the file.
This command would be only accessible to mods+.
What are your thoughts on this?

@RohanJnr
Copy link
Copy Markdown
Contributor

How about a background function which would send a python fact in the #python-general channel everyday ? (this would be cool if we have many facts tho)

@MrKomodoDragon
Copy link
Copy Markdown
Contributor Author

Nice Idea!

@MrKomodoDragon
Copy link
Copy Markdown
Contributor Author

How would I add it though? 🤔

@MrKomodoDragon
Copy link
Copy Markdown
Contributor Author

I don't like the idea of sending a random fact daily, i prefer it is used periodically when people feel like it.

Copy link
Copy Markdown
Contributor

@Kronifer Kronifer left a comment

Choose a reason for hiding this comment

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

This looks great, just one critique so far!

embed = discord.Embed(title='Python Facts',
description=next(FACTS),
colour=next(COLORS))
embed.add_field(name='Suggestions',
Copy link
Copy Markdown
Contributor

@Kronifer Kronifer Mar 4, 2021

Choose a reason for hiding this comment

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

replace the above embed code with:

embed.add_field(
   name='Suggestions',
   value="Suggest more facts [here!](https://github.com/python-discord/meta/discussions/93)"
)

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.

Hmmm... why do you want to take out “Want to suggest a fact?” 🤔

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.

Ok, i understand, a little wordy

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.

for consistency with .topic

Copy link
Copy Markdown
Contributor

@Kronifer Kronifer left a comment

Choose a reason for hiding this comment

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

Looks amazing!

@HassanAbouelela HassanAbouelela merged commit caacd7b into python-discord:master Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: backend Related to internal functionality and utilities status: waiting for author Waiting for author to address a review or respond to a comment type: feature Relating to the functionality of the application.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add command for fun facts about Python

8 participants