Add dashboard

This commit is contained in:
2022-09-20 00:27:25 +01:00
parent bdfe02f776
commit e689c852e7
96 changed files with 16313 additions and 1 deletions

28
jobs/twitter.rb.disabled Normal file
View File

@@ -0,0 +1,28 @@
require 'twitter'
#### Get your twitter keys & secrets:
#### https://dev.twitter.com/docs/auth/tokens-devtwittercom
twitter = Twitter::REST::Client.new do |config|
config.consumer_key = 'YOUR_CONSUMER_KEY'
config.consumer_secret = 'YOUR_CONSUMER_SECRET'
config.access_token = 'YOUR_OAUTH_TOKEN'
config.access_token_secret = 'YOUR_OAUTH_SECRET'
end
search_term = URI::encode('#todayilearned')
SCHEDULER.every '10m', :first_in => 0 do |job|
begin
tweets = twitter.search("#{search_term}")
if tweets
tweets = tweets.map do |tweet|
{ name: tweet.user.name, body: tweet.text, avatar: tweet.user.profile_image_url_https }
end
send_event('twitter_mentions', comments: tweets)
end
rescue Twitter::Error
puts "\e[33mFor the twitter widget to work, you need to put in your twitter API keys in the jobs/twitter.rb file.\e[0m"
end
end