hashtablebot.memory_entity package

Submodules

hashtablebot.memory_entity.no_prefix_command module

class hashtablebot.memory_entity.no_prefix_command.DefaultNoPrefix(names: str, response: str)

Bases: NoPrefixCommand

Default class for commands without a prefix.

async is_a_match(message: Message) bool

Check if every name in the names attribute matches the start of the message.

Can’t use str.startswith() because the message could start matching the names and not be a match, like in an emote that starts with the same prefix as others.

Parameters:

message

Returns:

async respond(message)
class hashtablebot.memory_entity.no_prefix_command.NoPrefixCommand(names: str, response: str)

Bases: ABC

Abstract class for commands without a prefix, that are not handled by the twitchio API

abstract async is_a_match(message: Message) bool
abstract async respond(message)

hashtablebot.memory_entity.point_amount module

class hashtablebot.memory_entity.point_amount.PointAmountConverter

Bases: object

Handles the conversion of point values to an actual integer, somewhat based on the factory pattern.

If a user wants to gamble points, for example, they could want to pass 10%, 1, or all as an argument and still get a result based on how many points they have.

static convert(amount: str, bank_user: BankUser) int

Convert an amount of points from any format to an integer value. :param bank_user: :param amount: string with a percentage, number or word describing an amount :raises: PointConversionError if one of these conditions is met:

  • the amount passed is invalid

  • bank_user is not passed for a numeric amount

  • amount exceeds 20 digits

Module contents