-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
pretty sure this is due to the fallback here
Teaching-Streamers-to-Code/Level 5/level_5_testing.py
Lines 110 to 123 in 8c2bbeb
| # Fallback: Look for cheer emotes in the message content | |
| if message.content: | |
| words = message.content.lower().split() | |
| for word in words: | |
| # Common cheer patterns: cheer100, kappa50, pogchamp25, etc. | |
| if any(word.startswith(cheer) for cheer in ['cheer', 'kappa', 'pogchamp']): | |
| # Extract number from the end of the cheer | |
| import re | |
| match = re.search(r'(\d+)$', word) | |
| if match: | |
| try: | |
| bits_amount += int(match.group(1)) | |
| except (ValueError, TypeError): | |
| pass |
here's a fiddle demonstrating the issue (it prints out 9001 even though the cheer is fake and uses cheerc9001 instead of a real cheer) https://python-fiddle.com/saved/3a02ef05-684a-41fd-bbba-78b2caddd14e
and here's the code from the fiddle in case that link breaks at some point
from types import SimpleNamespace
bits_amount = 0
message = SimpleNamespace(content="")
message.content = "cheerc9001 this is a fake cheer of over 9000"
words = message.content.lower().split()
for word in words:
# Common cheer patterns: cheer100, kappa50, pogchamp25, etc.
if any(word.startswith(cheer) for cheer in ['cheer', 'kappa', 'pogchamp']):
# Extract number from the end of the cheer
import re
match = re.search(r'(\d+)$', word)
if match:
try:
bits_amount += int(match.group(1))
except (ValueError, TypeError):
pass
print(bits_amount)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels