Auto responder

ConstraintBase

class daf.responder.constraints.baseconstraint.ConstraintBase
abstract check(message: Message, client: Client) bool

Verifies if the constraint is fulfilled.

Parameters:

message (discord.Message) – Potential message to be responded to.

BaseGuildConstraint

class daf.responder.constraints.guildconstraint.BaseGuildConstraint

Constraint base for all guild constraints.

abstract check(message: Message, client: Client) bool

Verifies if the constraint is fulfilled.

Parameters:

message (discord.Message) – Potential message to be responded to.

GuildConstraint

class daf.responder.constraints.guildconstraint.GuildConstraint(guild: int | Guild)

Constraint that checks if the message originated from the specific guild.

Parameters:

guild (int | discord.Guild) – The guild to which the message must be sent for the constraint to be fulfilled.

check(message: Message, client: Client) bool

Verifies if the constraint is fulfilled.

Parameters:

message (discord.Message) – Potential message to be responded to.

BaseDMConstraint

class daf.responder.constraints.dmconstraint.BaseDMConstraint

Base for constraints that are DM specific.

abstract check(message: Message, client: Client) bool

Verifies if the constraint is fulfilled.

Parameters:

message (discord.Message) – Potential message to be responded to.

MemberOfGuildConstraint

class daf.responder.constraints.dmconstraint.MemberOfGuildConstraint(guild: int | Guild)

Constraint that checks if the DM message author is part of the guild.

Parameters:

guild (int | discord.Guild) – The guild to which the message’s author must belong for the constraint to be fulfilled.

check(message: Message, client: Client) bool

Verifies if the constraint is fulfilled.

Parameters:

message (discord.Message) – Potential message to be responded to.

BaseResponse

class daf.responder.actions.response.BaseResponse(data: BaseTextData)

Base response class.

Parameters:

data (BaseTextData) – The data that can be sent into the text / DM channel.

abstract async perform(message: Message)

Perform the action.

Parameters:

message (discord.Message)

DMResponse

class daf.responder.actions.response.DMResponse(data: BaseTextData)

DM response class. Used for responding into DM messages of the message’s author.

Parameters:

data (BaseTextData) – The data that will be sent into message author’s DM channel.

async perform(message: Message)

Perform the action.

Parameters:

message (discord.Message)

GuildResponse

class daf.responder.actions.response.GuildResponse(data: BaseTextData)

Guild response class. Used for responding into the same channel as the message that triggered the response. The response is a reply.

Parameters:

data (BaseTextData) – The data that will be sent into the channel.

async perform(message: Message)

Perform the action.

Parameters:

message (discord.Message)

DMResponder

class daf.responder.DMResponder(condition: BaseLogic, action: DMResponse, constraints: List[BaseDMConstraint] = [])

DM responder implementation. The responder is an object capable of making automatic replies to messages based on some keyword condition and constraints.

Parameters:
  • condition (BaseLogic) – The match condition. The condition represents the match condition of message’s text.

  • action (BaseResponse) – Represents the action taken on both condition and constraints being fulfilled.

  • constraints (list[ConstraintBase]) – In addition to condition, constraints add additional checks that need to be fulfilled before performing an action. All of the constraints inside the constraints list need to be fulfilled.

async handle_message(message: Message)

Processes message and performs an action if all constraints satisfied.

GuildResponder

class daf.responder.GuildResponder(condition: BaseLogic, action: BaseResponse, constraints: List[BaseGuildConstraint] = [])

Guild responder implementation. The responder is an object capable of making automatic replies to messages based on some keyword condition and constraints.

Parameters:
  • condition (BaseLogic) – The match condition. The condition represents the match condition of message’s text.

  • action (BaseResponse) – Represents the action taken on both condition and constraints being fulfilled.

  • constraints (list[ConstraintBase]) – In addition to condition, constraints add additional checks that need to be fulfilled before performing an action. All of the constraints inside the constraints list need to be fulfilled.

async handle_message(message: Message)

Processes message and performs an action if all constraints satisfied.