diff --git a/src/connectomnibot.jl b/src/connectomnibot.jl index 120aa09a8dc20cd29ccfde57670718d00068e13b..ee870fde016933619c713adcf9a499b25a3c8442 100644 --- a/src/connectomnibot.jl +++ b/src/connectomnibot.jl @@ -10,8 +10,23 @@ end """ connectomnibot(ip::IPv4;port::Int) -Also callable with an IPv4 type argument +Connectomnibot is callable with an IPv4 type argument """ function connectomnibot(ip::IPv4, port::Int) return connect(ip,port) end + + +""" + connectomnibot(f::Function, args...) + +Connectomnibot is callable with `do`-functionality +""" +function connectomnibot(f::Function, args...) + bot = connectomnibot(args...) + try + f(bot) + finally + close(bot) + end +end \ No newline at end of file