|
|
|
@ -5,6 +5,7 @@ import logging
|
|
|
|
|
from datetime import datetime
|
|
|
|
|
from random import choice
|
|
|
|
|
|
|
|
|
|
import pytz
|
|
|
|
|
from discord import Embed, Intents
|
|
|
|
|
from discord.ext import commands
|
|
|
|
|
from settings.config import IMAGE_TYPES, OW_API_CONFIG, PERMISSIONS
|
|
|
|
@ -317,15 +318,18 @@ async def news(bot: object) -> None:
|
|
|
|
|
f"""
|
|
|
|
|
Return some news from Google.
|
|
|
|
|
"""
|
|
|
|
|
_news = News(quantity=2)
|
|
|
|
|
_news = News(quantity=5)
|
|
|
|
|
news = _news.news()
|
|
|
|
|
embed = Embed(type='rich')
|
|
|
|
|
|
|
|
|
|
for new in news:
|
|
|
|
|
# TODO: Descomentar o código do match case
|
|
|
|
|
dt = datetime.fromisoformat(new['publishedAt'])
|
|
|
|
|
dt = datetime.fromisoformat(
|
|
|
|
|
new['publishedAt']
|
|
|
|
|
).astimezone(pytz.timezone('America/Sao_Paulo'))
|
|
|
|
|
embed.add_field(name='Published at', value=dt.isoformat(), inline=False)
|
|
|
|
|
embed.add_field(name='link', value=new['url'], inline=False)
|
|
|
|
|
embed.add_field(name=new['title'], value=new['description'], inline=False)
|
|
|
|
|
embed.add_field(name='---', value='---')
|
|
|
|
|
|
|
|
|
|
return await bot.send(f'**`{new["source"]["name"]}`**', embed=embed)
|
|
|
|
|