|
@@ -1,4 +1,4 @@
|
|
|
-def character_embed(character:, event:, section: nil, image: nil)
|
|
|
|
|
|
|
+def character_embed(character:, event:, section: nil, image: nil, journal: nil)
|
|
|
# Find the author, if they're a member, or in DMs use the event's author
|
|
# Find the author, if they're a member, or in DMs use the event's author
|
|
|
if event.server
|
|
if event.server
|
|
|
member = character.user_id.match(/public/i) ? 'Public' :
|
|
member = character.user_id.match(/public/i) ? 'Public' :
|
|
@@ -23,6 +23,7 @@ def character_embed(character:, event:, section: nil, image: nil)
|
|
|
case section
|
|
case section
|
|
|
when /all/i, /default/i, nil
|
|
when /all/i, /default/i, nil
|
|
|
embed.description = character.personality if character.personality
|
|
embed.description = character.personality if character.personality
|
|
|
|
|
+ fields = char_alias(character, fields)
|
|
|
fields = char_type(character, fields)
|
|
fields = char_type(character, fields)
|
|
|
fields = char_status(character, fields)
|
|
fields = char_status(character, fields)
|
|
|
fields = char_bio(character, fields)
|
|
fields = char_bio(character, fields)
|
|
@@ -30,6 +31,7 @@ def character_embed(character:, event:, section: nil, image: nil)
|
|
|
fields = char_dm_notes(character, fields, event)
|
|
fields = char_dm_notes(character, fields, event)
|
|
|
when /bio/i
|
|
when /bio/i
|
|
|
embed.description = character.personality if character.personality
|
|
embed.description = character.personality if character.personality
|
|
|
|
|
+ fields = char_alias(character, fields)
|
|
|
fields = char_bio(character, fields)
|
|
fields = char_bio(character, fields)
|
|
|
fields = char_dm_notes(character, fields, event)
|
|
fields = char_dm_notes(character, fields, event)
|
|
|
when /types?/i
|
|
when /types?/i
|
|
@@ -56,6 +58,10 @@ def character_embed(character:, event:, section: nil, image: nil)
|
|
|
embed.thumbnail = nil
|
|
embed.thumbnail = nil
|
|
|
when /bags?/i, /inventory/i
|
|
when /bags?/i, /inventory/i
|
|
|
fields = char_inv(character, fields)
|
|
fields = char_inv(character, fields)
|
|
|
|
|
+ when /journal/i
|
|
|
|
|
+ fields = char_journal(character, fields, journal)
|
|
|
|
|
+ when /forms?/i, /alt(ernate)?\sforms?/i
|
|
|
|
|
+ fields = alt_form_embed(character, fields)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
# Add fields to embed
|
|
# Add fields to embed
|
|
@@ -66,6 +72,14 @@ def character_embed(character:, event:, section: nil, image: nil)
|
|
|
author_footer(embed, member, footer_info)
|
|
author_footer(embed, member, footer_info)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
|
+def char_alias(char, fields)
|
|
|
|
|
+ fields.push(
|
|
|
|
|
+ { name: 'Known Aliases', value: char.aliases.join(', ') }
|
|
|
|
|
+ )if char.aliases
|
|
|
|
|
+
|
|
|
|
|
+ fields
|
|
|
|
|
+end
|
|
|
|
|
+
|
|
|
def char_bio(char, fields)
|
|
def char_bio(char, fields)
|
|
|
# Find the appropriate teams
|
|
# Find the appropriate teams
|
|
|
char_teams = CharTeam.where(char_id: char.id, active: true).map(&:team_id)
|
|
char_teams = CharTeam.where(char_id: char.id, active: true).map(&:team_id)
|
|
@@ -187,6 +201,21 @@ def char_inv(char, fields)
|
|
|
fields
|
|
fields
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
|
+def char_journal(char, fields, journal)
|
|
|
|
|
+ if journal.is_a? JournalEntry
|
|
|
|
|
+ fields.push({ name: journal.title, value: journal.entry })
|
|
|
|
|
+ elsif journal.empty?
|
|
|
|
|
+ fields.push({ name: 'Error', value: 'No journal entries found' })
|
|
|
|
|
+ else
|
|
|
|
|
+ # Display each journal entry
|
|
|
|
|
+ journal.each do |j|
|
|
|
|
|
+ fields.push({ name: j&.title || j.date, value: j.entry })
|
|
|
|
|
+ end
|
|
|
|
|
+ end
|
|
|
|
|
+
|
|
|
|
|
+ fields
|
|
|
|
|
+end
|
|
|
|
|
+
|
|
|
def char_dm_notes(char, fields, event)
|
|
def char_dm_notes(char, fields, event)
|
|
|
return fields unless ENV['DM_CH'].include?(event.channel.id.to_s)
|
|
return fields unless ENV['DM_CH'].include?(event.channel.id.to_s)
|
|
|
|
|
|
|
@@ -318,7 +347,7 @@ def user_char_embed(chars, member, nsfw=nil)
|
|
|
|
|
|
|
|
active.each.with_index do |char, i|
|
|
active.each.with_index do |char, i|
|
|
|
name = nsfw && char.rating == 'NSFW' ?
|
|
name = nsfw && char.rating == 'NSFW' ?
|
|
|
- "#{i+1} || #{char.name} ||" : "#{i+1} #{char.name}"
|
|
|
|
|
|
|
+ "#{Emoji::NUMBERS[i]} || #{char.name} ||" : "#{Emoji::NUMBERS[i]} #{char.name}"
|
|
|
fields.push({
|
|
fields.push({
|
|
|
name: name,
|
|
name: name,
|
|
|
value: "#{char.species} -- #{char.types}"
|
|
value: "#{char.species} -- #{char.types}"
|
|
@@ -366,6 +395,30 @@ def dup_char_embed(chars, name)
|
|
|
)
|
|
)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
|
+def alt_form_embed(char, fields)
|
|
|
|
|
+ # Find Base Character Form
|
|
|
|
|
+ chars = []
|
|
|
|
|
+ if char.alt_form
|
|
|
|
|
+ chars.push( Character.find(char.alt_form) )
|
|
|
|
|
+ else
|
|
|
|
|
+ chars.push(char)
|
|
|
|
|
+ end
|
|
|
|
|
+
|
|
|
|
|
+ # Add forms
|
|
|
|
|
+ chars.concat( Character.where(alt_form: chars.first.id) )
|
|
|
|
|
+
|
|
|
|
|
+ # Display forms
|
|
|
|
|
+ chars.each.with_index do |char, i|
|
|
|
|
|
+ fields.push({
|
|
|
|
|
+ name: "#{Emoji::NUMBERS[i]} #{char.name}",
|
|
|
|
|
+ value: "#{char.species} -- #{char.types}"
|
|
|
|
|
+ })
|
|
|
|
|
+ end
|
|
|
|
|
+
|
|
|
|
|
+ # return fields
|
|
|
|
|
+ fields
|
|
|
|
|
+end
|
|
|
|
|
+
|
|
|
def image_list_embed(character, event)
|
|
def image_list_embed(character, event)
|
|
|
# Find the author, if they're a member, or in DMs use the event's author
|
|
# Find the author, if they're a member, or in DMs use the event's author
|
|
|
if event.server
|
|
if event.server
|