Skip to content

Commit

Permalink
small improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumChemist committed Aug 28, 2024
1 parent 35f8bf1 commit 87b9176
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def generate_convo_text(start_line: str = None)->str:
lines.insert(random_index, start_word)
text = ''.join(lines[6:]) # Join the lines starting from index 6 (line 7)
# Build the model.
text_model = markovify.Text(text, state_size=3)
state = random.choice([2,3])
text_model = markovify.Text(text, state_size=state)

# Generate a random number between 5 and 10
random_number = random.randint(5, 10)
Expand Down Expand Up @@ -463,7 +464,8 @@ async def on_message(self, message):

# Handle Replies to the Bot
if message.reference and message.reference.resolved and message.reference.resolved.author == bot.user:
await handle_conversation(message)
words = message.content.split()
await message.reply(generate_convo_text(words))
return

# Handle Mentions of the Bot
Expand Down

0 comments on commit 87b9176

Please sign in to comment.