Fix TwitterBot arguments (#634)
* Fix TwitterBot arguments * Fix ::random_identity
This commit is contained in:
parent
1181a952ed
commit
a3788dfbd1
1 changed files with 5 additions and 6 deletions
|
|
@ -97,11 +97,10 @@ class Tweet < ApplicationRecord
|
|||
end
|
||||
|
||||
def self.random_identity
|
||||
if Rails.env.production?
|
||||
Identity.where(provider: "twitter").last(250).sample
|
||||
else
|
||||
Identity.where(provider: "twitter").last ||
|
||||
{ token: ApplicationConfig["TWITTER_KEY"], secret: ApplicationConfig["TWITTER_SECRET"] }
|
||||
end
|
||||
iden = Identity.where(provider: "twitter").last(250).sample
|
||||
{
|
||||
token: iden&.token || ApplicationConfig["TWITTER_KEY"],
|
||||
secret: iden&.secret || ApplicationConfig["TWITTER_SECRET"],
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue