Skip to content

Commit 80e78b2

Browse files
Your Nameaider-chat-bot
andcommitted
feat: add function to count expressions in a message
Co-authored-by: aider (openrouter/anthropic/claude-3-haiku) <aider@aider.chat>
1 parent 9e4f3dd commit 80e78b2

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

bot.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from dotenv import load_dotenv
66
from threading import Thread
77
from flask import Flask
8+
import re
89

910
app = Flask(__name__)
1011

@@ -93,4 +94,10 @@ async def tophearts(ctx):
9394

9495
await ctx.send(msg)
9596

97+
@bot.command()
98+
async def count_expressions(ctx, message: str):
99+
"""Count the number of expressions in a message"""
100+
expressions = re.findall(r'\b\w+\b', message)
101+
await ctx.send(f"The message contains {len(expressions)} expressions.")
102+
96103
bot.run(TOKEN)

0 commit comments

Comments
 (0)