How to auto-assign a ticket to "self" (same agent replying)

How to auto-assign a ticket to "self" (same agent replying)

Hello, we are looking for a way that when an Agent replies to an unassigned ticket it automatically assigns it to the same agent replying.

Seems to me that in Automation Rules or Round Robin, the assignnment must be done to a specific agent, but what I'm looking to do is that the system assigns the ticket to the same agent replying (variable).

Example: Unassigned ticket #123 is opened and replied by Agent A. Upon replying, the ticket is assigned to Agent A because she or he is the agent replying ticket #123.

If this can be achieved with Deluge (custom functions), would anybody share a sample Script?