lita-discord_oauth 0.1.2.alpha.74 → 0.1.2.alpha.75

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
  SHA1:
3
- metadata.gz: 3cbb7c68e204f1e97e4cda27a8af27f69da90d8f
4
- data.tar.gz: e5dd67f84b1d36ca8cb092a7c60122c91e0151f3
3
+ metadata.gz: ec3c700e6f793e37ca013d9bbbeffcf1b9f75ab3
4
+ data.tar.gz: 4ceb3f3b190fdb2bf8e5f224d34f8deabff745c8
5
5
  SHA512:
6
- metadata.gz: 0842a50a880c0273c750376264be5b745c726212079d49b90ad8b046777ab0ac32bc7ac4d5b7a382e82ac770568658ca5573ac8ba660f350f981a569f2f91a7d
7
- data.tar.gz: f0616fa903da16c1f0e8191a20cb084c6a67cf99d436f563ec66ced0383c82a322fa694e4fc5c975cc9dbecf34a74dac2e21a74d0179a178319da03084216c1a
6
+ metadata.gz: ec6f1d395b61024058a435b0aa7cb4b780a55d28cb50dd2d23db59a0f55e0213505d820ecda37e63aaeb4ddaf55ab3aaef83307adf22e1797a4a18863205c4eb
7
+ data.tar.gz: 3fce25eaba8a402178bd3aa2965aeb828b736a8799716836d63fd57ffcb690b5d5d3aaddf45b41ead701873e3857b7c465de7745e89543c09f85a31dc568145e
@@ -21,15 +21,25 @@ module Lita
21
21
 
22
22
  output = "```\n" + output.join("\n") + "\n```"
23
23
 
24
- split_message(output)
24
+ messages = split_message(output)
25
25
 
26
- response.reply_privately(output)
26
+ messages.each do |message|
27
+ if message[0...3] != '```'
28
+ message = '```' + "\n" + message
29
+ end
30
+
31
+ if message[-3] != '```'
32
+ message = '```' + "\n" + message
33
+ end
34
+
35
+ response.reply_privately(message)
36
+ end
27
37
  end
28
38
 
29
39
  private
30
40
 
31
41
  def split_message(message)
32
- max_length = 2000 - 25 # Substract 25 for mention safety
42
+ max_length = 2000 - 30 # Substract 25 for mention safety
33
43
  messages = Array.new
34
44
 
35
45
  if message.length < max_length
@@ -54,7 +64,7 @@ module Lita
54
64
  end
55
65
 
56
66
  def get_message_part(message, limit)
57
- message if message.length < limit # No need to check anything if the message is short enough
67
+ message if message.length <= limit # No need to check anything if the message is short enough
58
68
 
59
69
  part = message.to_s[0...limit - 1]
60
70
  break_index = part.rindex("\n")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-discord_oauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2.alpha.74
4
+ version: 0.1.2.alpha.75
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cas Eliëns