Skip to content

Commit 636e9f1

Browse files
committed
fix: improve TwitchAlert regex
1 parent 6cfa38f commit 636e9f1

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

KoalaBot.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,14 @@ def check_guild_has_ext(ctx, extension_id):
160160
async def on_command_error(ctx, error):
161161
if isinstance(error, commands.MissingRequiredArgument):
162162
await ctx.send(embed=error_embed(description=error))
163-
# elif isinstance(error, commands.CommandInvokeError):
164-
# await ctx.send(embed=error_embed(description=error.original))
165163
elif isinstance(error, commands.CommandOnCooldown):
166164
await ctx.send(embed=error_embed(description=f"{ctx.author.mention}, this command is still on cooldown for "
167165
f"{str(error.retry_after)}s."))
168166
elif isinstance(error, commands.errors.ChannelNotFound):
169167
await ctx.send(embed=error_embed(description=f"The channel ID provided is either invalid, or not in this server."))
168+
elif isinstance(error, commands.CommandInvokeError):
169+
# logger.warning("CommandInvokeError(%s), guild_id: %s, message: %s", error.original, ctx.guild.id, ctx.message)
170+
await ctx.send(embed=error_embed(description=error.original))
170171
else:
171172
await ctx.send(embed=error_embed(
172173
description=f"An unexpected error occured, please contact an administrator Timestamp: {time.time()}")) # FIXME: better timestamp

devdocs/sqlalchemy-alembic.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# sqlalchemy and alembic
2+
3+
sqlalchemy: Python SQL toolkit and Object Relational Mapper
4+
alembic: a lightweight database migration tool for usage with the SQLAlchemy Database Toolkit for Python.
5+
6+
## Documentation
7+
[sqlalchemy docs](https://sqlalchemy.org)
8+
[alembic docs](https://alembic.sqlalchemy.org)
9+
10+
## Tutorials/ Talks
11+
[Talk: Hannah Stepanek - Let's talk Databases in Python: SQLAlchemy and Alembic](https://www.youtube.com/watch?v=36yw8VC3KU8)
12+
["SQLAlchemy 2.0 - The One-Point-Four-Ening 2021" by: Mike Bayer](https://www.youtube.com/watch?v=1Va493SMTcY)

koala/cogs/twitch_alert/env.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
load_dotenv()
55

66
TWITCH_KEY = os.environ.get('TWITCH_TOKEN')
7-
TWITCH_SECRET = os.environ.get('TWITCH_SECRET')
7+
TWITCH_SECRET = os.environ.get('TWITCH_SECRET')

koala/cogs/twitch_alert/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
DEFAULT_MESSAGE = ""
1313
TWITCH_ICON = "https://cdn3.iconfinder.com/data/icons/social-messaging-ui-color-shapes-2-free" \
1414
"/128/social-twitch-circle-512.png"
15-
TWITCH_USERNAME_REGEX = "^[a-z0-9][a-z0-9_]{3,24}$"
15+
TWITCH_USERNAME_REGEX = "^[a-z0-9][a-z0-9_-]{3,24}$"
1616

1717
LOOP_CHECK_LIVE_DELAY = 1
1818
TEAMS_LOOP_CHECK_LIVE_DELAY = 1

koala/db.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
# Libs
1515
from pathlib import Path
16-
from sqlalchemy import select, update, insert, delete, and_, func, create_engine
16+
from sqlalchemy import select, update, delete, and_, func, create_engine
1717
from sqlalchemy.orm import sessionmaker
1818

1919

0 commit comments

Comments
 (0)