summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Jäger <gitcommit@henk.geekmail.org>2023-09-24 21:44:17 +0200
committerHendrik Jäger <gitcommit@henk.geekmail.org>2023-09-25 11:05:31 +0200
commitcd00feda271c9eba43ffa6099099a22542543141 (patch)
tree28e3716e20784f1e0c49d7360d28413dc104de37
parent3ace72d5642284665fce2c33c99dfeb1b931b2c6 (diff)
fix: TCPSocked.gethostbyname is deprecatedfix/deprecated_gethostbyname
-rw-r--r--data/rbot/plugins/url.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/data/rbot/plugins/url.rb b/data/rbot/plugins/url.rb
index 3faeeab9..bb660c7e 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