modbot.moderation.Permitting

class modbot.moderation.Permitting(run_config)[source]

Bases: object

Class to handle user permits - if they are exempt from moderation actions or can post links.

Methods

add_permit(user, length)

Add user to permit queue for a given length of time

del_permit(user)

Delete user from permit queue

get_permit_time(msg)

Get length of time to permit user from message.

get_permit_user(msg)

Get user name from chat message for user to permit

has_permit(user)

Check if user has a permit

rep_permit(info)

Handle response to !permit command.

time_permit(user)

Keep track of time a user is permitted and remove them if max time has elapsed

add_permit(user, length)[source]

Add user to permit queue for a given length of time

Parameters
  • user (str) – Username

  • length (int) – Length of time in seconds

del_permit(user)[source]

Delete user from permit queue

Parameters

user (str) – Username

get_permit_time(msg)[source]

Get length of time to permit user from message. If message does not include a time then use default time.

Parameters

msg (str) – Message to get permit time from

Returns

Permit time in seconds

Return type

int

static get_permit_user(msg)[source]

Get user name from chat message for user to permit

Parameters

msg (str) – Message to get username from

Returns

Username

Return type

str

has_permit(user)[source]

Check if user has a permit

Parameters

user (str) – Username

Return type

bool

rep_permit(info)[source]

Handle response to !permit command. Check if we should permit the user in info

Parameters

info (dict) – dictionary storing attributes of user. e.g. recent message, badges, username, probability of non-wholesome message

Return type

bool

time_permit(user)[source]

Keep track of time a user is permitted and remove them if max time has elapsed

Parameters

user (str) – Username to check for whether they have a permit