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 +4 -4
- data/lib/lita/handlers/discord_help.rb +14 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec3c700e6f793e37ca013d9bbbeffcf1b9f75ab3
|
4
|
+
data.tar.gz: 4ceb3f3b190fdb2bf8e5f224d34f8deabff745c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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 -
|
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
|
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")
|