Sha256: 44b3ed65993448bfacf3bbbfde397cbfbb42df76521448cad98a76e3cefa3577
Contents?: true
Size: 819 Bytes
Versions: 1
Compression:
Stored size: 819 Bytes
Contents
module Elephrame module Bots # a superclass for other bots # holds common functions and the rest api client class BaseBot attr_reader :client def initialize @client = Mastodon::REST::Client.new(base_url: ENV['INSTANCE'], bearer_token: ENV['TOKEN']) end def post(text, visibility: 'unlisted', spoiler: '', reply_id: '', media: []) if not media.empty? media.collect! {|m| @client.upload_media(m).id } end options = { visibility: visibility, spoiler_text: spoiler, in_reply_to_id: reply_id, media_ids: media, } @client.create_status text, options end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
elephrame-0.2.0 | lib/elephrame/bot.rb |