Module: DiscordStore

Defined in:
lib/discord_store.rb,
lib/discord_store/kv.rb,
lib/discord_store/log.rb,
lib/discord_store/codec.rb,
lib/discord_store/cipher.rb,
lib/discord_store/errors.rb,
lib/discord_store/replay.rb,
lib/discord_store/search.rb,
lib/discord_store/journal.rb,
lib/discord_store/railtie.rb,
lib/discord_store/version.rb,
lib/discord_store/snowflake.rb,
lib/discord_store/blob_store.rb,
lib/discord_store/log/record.rb,
lib/discord_store/guild_limits.rb,
lib/discord_store/channel_shard.rb,
lib/discord_store/configuration.rb,
lib/discord_store/transport/fake.rb,
lib/discord_store/transport/http.rb,
lib/discord_store/transport/rest.rb,
lib/discord_store/transport/quota.rb,
lib/discord_store/transport/bucket.rb,
lib/discord_store/transport/rate_limiter.rb

Overview

Uses Discord as a database.

It works, in the sense that the data goes in and comes back out. It is also an explicit violation of the Discord Developer Terms of Service, it is capped at a few megabytes per second by rate limits nobody can raise for you, and every byte of it lives at the pleasure of a company that has already shipped one change (signed, expiring CDN links) that broke this entire category of project overnight.

Read Configuration#i_understand_this_violates_discord_tos before using it.

Defined Under Namespace

Modules: Cipher, Snowflake, Transport Classes: APIError, AuthError, BlobStore, ChannelShard, Client, Codec, Configuration, ConfigurationError, CorruptRecordError, DecryptionError, Error, ExhaustedError, ForeignMessageError, GuildLimits, IndexNotReadyError, Journal, KV, Log, MissingIntentError, NotFoundError, PayloadTooLargeError, QuotaTimeoutError, Railtie, RateLimitedError, Replay, Search, SearchScopeError, UnacknowledgedError

Constant Summary collapse

VERSION =
"0.2.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.client ⇒ Client

The process-wide client.

Returns:



59
60
61
# File 'lib/discord_store.rb', line 59

def client
  @client ||= Client.new(config: configuration)
end

Class Method Details

.configuration ⇒ Configuration

Returns:



37
38
39
# File 'lib/discord_store.rb', line 37

def configuration
  @configuration ||= Configuration.new
end

.configure {|config| ... } ⇒ Configuration

Yield Parameters:

Returns:



43
44
45
46
# File 'lib/discord_store.rb', line 43

def configure
  yield(configuration) if block_given?
  configuration
end

.generate_key ⇒ String

Returns a fresh base64 encryption key.

Returns:

  • (String) —

    a fresh base64 encryption key



70
# File 'lib/discord_store.rb', line 70

def generate_key = Cipher.generate_key

.reset! ⇒ void

This method returns an undefined value.

Resets configuration and any memoized client. Mainly for tests.



51
52
53
54
# File 'lib/discord_store.rb', line 51

def reset!
  @configuration = nil
  @client = nil
end