dispander.rb 0.2.0 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72ece3741f679c4e18bfe11980bf92baa46d74fa86269ed8e93facabac2f993c
4
- data.tar.gz: c6da4e5800057ef09807e4a878a4b6785ed13cfaa27e470149265617722a2390
3
+ metadata.gz: 8abef01b13dda9fa294f57b92345c0238b6cd064520d30c9443552ac1dc09679
4
+ data.tar.gz: 6acd1059efdf0497a642dddb21c3f3644a4bf69f54722c0575ff2e0331ad9a4c
5
5
  SHA512:
6
- metadata.gz: b72de3c9775d139c533cb037caa0fa900eaf85bdd7815151b92d4add249c96b04c5469a1401b6861563f5018a0ffe778100aabe5b36bbbff1f1088031586a1eb
7
- data.tar.gz: 02fdeac6d1c1fff4d728a19d37368955cb998ee3199b910c9d1867bc7a951ee91f7dd1eee44e6834e0a2f2de718e7e655d11d6ca8e6f8be3d857178b36e2b679
6
+ metadata.gz: 347f8ff590094e4638bda7875e4a96e0277c1f85e4fa7b1724390c45cb5bbe8b7e9c6cd39236f5ee33c6458271480fcbe11819cef57211619c8bad27bf042c11
7
+ data.tar.gz: ac3426f499d4a63d2fb2a65464eef439a62e94c240d00b81d8e1e5cb4338cf29a03770cdc3fa045d1043841676ec18e539b4dacc940ab2169fa08d38fcdbc6cc
data/dispander.gemspec CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ["lib"]
29
29
 
30
30
  # Uncomment to register a new dependency of your gem
31
- spec.add_dependency "discorb", "~> 0.10.1"
31
+ spec.add_dependency "discorb", "~> 0.13.0"
32
32
 
33
33
  # For more information and examples about making a new gem, checkout our
34
34
  # guide at: https://bundler.io/guides/creating_gem.html
@@ -1,7 +1,9 @@
1
1
  require "discorb"
2
2
 
3
3
  module Dispander
4
- class Core < Discorb::Extension
4
+ class Core
5
+ include Discorb::Extension
6
+
5
7
  @@discord_url_pattern = /(?!<)https:\/\/(ptb.|canary.)?discord(app)?.com\/channels\/(?<guild>[0-9]{18,})\/(?<channel>[0-9]{18,})\/(?<message>[0-9]{18,})(?!>)/
6
8
 
7
9
  def initialize(client, delete_emoji: Discorb::UnicodeEmoji["wastebasket"])
@@ -39,8 +41,10 @@ module Dispander
39
41
 
40
42
  sent_messages = []
41
43
  begin
42
- message = @client.guilds[guild_id].channels[channel_id].fetch_message(message_id).wait
43
- rescue Discorb::NotFoundError
44
+ next unless guild = @client.guilds[guild_id]
45
+ next unless channel = guild.channels[channel_id] || @client.fetch_channel(channel_id).wait
46
+ next unless message = channel.fetch_message(message_id).wait
47
+ rescue Discorb::NotFoundError, NoMethodError
44
48
  next
45
49
  else
46
50
  embed = create_embed_from_message(message)
@@ -49,7 +53,7 @@ module Dispander
49
53
  embeds += message.attachments[1..]&.filter(&:image?)&.map { |attachment| create_embed_from_attachment(attachment) }.to_a
50
54
 
51
55
  until (embeds_send = embeds.slice!(..10)).empty?
52
- sent_messages << message.channel.post(embeds: embeds_send).wait
56
+ sent_messages << base_message.channel.post(embeds: embeds_send).wait
53
57
  end
54
58
  embed.url = "http://a.io/#{base_message.author.id}-#{message.author.id}-#{sent_messages.map(&:id).join(",")}"
55
59
  first_embeds = sent_messages[0].embeds
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dispander
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dispander.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - sevenc-nanashi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-02 00:00:00.000000000 Z
11
+ date: 2021-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: discorb
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.10.1
19
+ version: 0.13.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.10.1
26
+ version: 0.13.0
27
27
  description:
28
28
  email:
29
29
  - sevenc-nanashi@sevenbot.jp