From: Hendrik Jäger Date: Sun, 24 Sep 2023 19:44:17 +0000 (+0200) Subject: fix: TCPSocked.gethostbyname is deprecated X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=db97054c4ecdb228f313df5a3a0191aff9745a88;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git fix: TCPSocked.gethostbyname is deprecated --- diff --git a/data/rbot/plugins/url.rb b/data/rbot/plugins/url.rb index e974c96b..934144cc 100644 --- a/data/rbot/plugins/url.rb +++ b/data/rbot/plugins/url.rb @@ -3,6 +3,8 @@ # # :title: Url plugin +require 'socket' + define_structure :Url, :channel, :nick, :time, :url, :info class UrlPlugin < Plugin @@ -78,8 +80,7 @@ class UrlPlugin < Plugin # also check the ip, the canonical name and the aliases begin - checks = TCPSocket.gethostbyname(url.host) - checks.delete_at(-2) + checks = Addrinfo.getaddrinfo(url.host, nil).map { |addr| addr.ip_address } rescue => e return "Unable to retrieve info for #{url.host}: #{e.message}" end