lita-discord_oauth 0.1.2.alpha.48 → 0.1.2.alpha.49
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lita/adapters/discord_oauth.rb +18 -3
- 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: e14675a2f966a4f5013655a128b38761f147302b
|
4
|
+
data.tar.gz: 0772731e0d8871d742660625d9b35bad377ff118
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5f98ec1f6940900a234591d7723ff500fddc465159eabde6e65d14e69de526b93ff84c90f404b902912c476c54c7ae51de27d003d5589295187bce5e44d33b5
|
7
|
+
data.tar.gz: 948ec8b7e0fe2cd6514c22b3d827eaaddc743f2fb35d9d6b925c56d421f73901d66802d90262a8f23bc077037b17d30632e3aa6e2ef33e6a2b4b38bb9d4e886e
|
@@ -23,11 +23,26 @@ module Lita
|
|
23
23
|
@client.message do |event|
|
24
24
|
message = event.message
|
25
25
|
author_id = message.author.id.to_s
|
26
|
+
author_name = message.author.display_name.to_s
|
26
27
|
|
27
|
-
Lita.logger.debug(
|
28
|
+
Lita.logger.debug("Received message from #{author_name}(#{author_id}): #{message.content}")
|
29
|
+
Lita.logger.debug("Finding user #{author_name}")
|
28
30
|
|
29
|
-
user = Lita::User.
|
30
|
-
|
31
|
+
user = Lita::User.find_by_name(author_name)
|
32
|
+
|
33
|
+
if user == nil
|
34
|
+
Lita.logger.debug("User #{author_name} not found, trying ID #{author_id}")
|
35
|
+
user = Lita::User.find_by_id(author_id)
|
36
|
+
|
37
|
+
if user != nil
|
38
|
+
Lita.logger.debug("User #{author_id} found, updating name to #{author_name}")
|
39
|
+
user.name = author_name
|
40
|
+
user.save
|
41
|
+
end
|
42
|
+
|
43
|
+
Lita.logger.debug("User #{author_id} not found, creating now")
|
44
|
+
user = Lita::User.create(author_id, {name: author_name}) unless user
|
45
|
+
end
|
31
46
|
|
32
47
|
Lita.logger.debug('User ID: ' + user.id)
|
33
48
|
|