Skip to content

Commit

Permalink
Fix twitch streamer url and send history message ephemeral
Browse files Browse the repository at this point in the history
- Add dot at the end of error phrase
- Fix ignore WebSocket closed with 1000
- Add www to the twitch streamer url to show the streamer icon
- Add ephemeral message in history view
- Remove twitch challenge log
  • Loading branch information
rukasudev committed Aug 13, 2024
1 parent 06c5aee commit ad13a89
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/languages/errors/errors.pt-br.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ pt-br:
command-default-roles-low-permissions:
title: Permissões de Cargo Insuficientes
message: "Desculpe, mas não tenho permissão para atribuir cargos neste servidor.\n\n
Por favor, me atribua um cargo com esses privilégios ou eleve a posição do meu cargo **Keiko** na hierarquia de cargos do servidor"
Por favor, me atribua um cargo com esses privilégios ou eleve a posição do meu cargo **Keiko** na hierarquia de cargos do servidor."

command-default-roles-missing-permissions:
message: "🚨 **ATENÇÃO!!!**\n
Não tenho mais permissão para atribuir os seguintes cargos no servidor: **$roles**\n\n
Por favor, me atribua um cargo com esses privilégios ou eleve a posição do meu cargo **Keiko** na hierarquia de cargos do servidor"
Por favor, me atribua um cargo com esses privilégios ou eleve a posição do meu cargo **Keiko** na hierarquia de cargos do servidor."

command-default-roles-disactivated:
message: A funcionalidade de atribuir cargos automaticamente está desabilitada. Para ativar e configurar a funcionalidade, sinta-se a vontade de rodar o comando `cargos padrao` 🐶
Expand Down
2 changes: 1 addition & 1 deletion app/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def emit(self, record):
self.bot.config.ADMIN_LOGS_COMMAND_CALL_ID
)

if record.levelno == logging.ERROR and "WebSocket closed with 1000" in record.msg:
if record.levelno == logging.ERROR and "WebSocket closed with 1000" in record.exc_info[1]:
return

if not log_channel:
Expand Down
2 changes: 1 addition & 1 deletion app/services/notifications_twitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def unsubscribe_streamer(interaction: discord.Interaction, cogs: Dict[str, Any])

def compose_notification_message(notification: Dict[str, Any], streamer: str) -> str:
messages = notification.get("notification_messages").get("value")
stream_link = f"https://twitch.tv/{streamer}"
stream_link = f"https://www.twitch.tv/{streamer}"
random_message = random.choice(messages.split(";")).lstrip()

return parse_streamer_message(random_message, streamer, stream_link)
Expand Down
2 changes: 1 addition & 1 deletion app/views/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,4 @@ async def history_callback(self, interaction: discord.Interaction):
desc = parse_history_desc(interaction, self.command_key)
pagination_view = PaginationView(interaction, title, desc, data, sep=4)

await pagination_view.send()
await pagination_view.send(ephemeral=True)
4 changes: 2 additions & 2 deletions app/views/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ def __init__(

super().__init__()

async def send(self):
async def send(self, ephemeral: bool = False):
if hasattr(self, "select"):
self.select.update()

await self.interaction.response.send_message(view=self)
await self.interaction.response.send_message(view=self, ephemeral=ephemeral)
await self.update_message(self.get_current_page_data())

def create_embed(self, data):
Expand Down
1 change: 0 additions & 1 deletion app/webhooks/twitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def twitch_webhook():
data = request.json

if bot.twitch.check_request_is_a_challenge(request):
logger.info('Twitch webhook challenge received', log_type=logconstants.COMMAND_INFO_TYPE)
return data['challenge']

if data.get('subscription', {}).get('type') == 'stream.online':
Expand Down

0 comments on commit ad13a89

Please sign in to comment.