Skip to content

Conversation

@bolecki
Copy link

@bolecki bolecki commented Oct 31, 2015

Hello! I added another command that will delay the bots response for a number of seconds in IRC. This will make the bot seem more human by simulating time to think and type.

For example, !delay 7 will add a seven second delay to the bots response. !delay 7 11 will set a range, where the delay will be a random number between 7 and 11. Set the delay back to 0 seconds with !delay 0

Thanks!

@bdrewery
Copy link
Owner

That's really cool!

# Calculate delay
delay = self.settings.delay[0]
if len(self.settings.delay) == 2:
delay = random.randint(self.settings.delay[0], self.settings.delay[1])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For even more realism I'd suggest using

delay = random.uniform(self.settings.delay[0], self.settings.delay[1])

so that a random float is picked instead of just an integer amount of seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants