make message trim length a constant
This commit is contained in:
		
							
								
								
									
										3
									
								
								bot.rb
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								bot.rb
									
									
									
									
									
								
							@@ -4,6 +4,7 @@ require 'discordrb'
 | 
			
		||||
bot = Discordrb::Bot.new token: ENV['DISCORD_TOKEN']
 | 
			
		||||
 | 
			
		||||
EMOJI = '🔖'
 | 
			
		||||
TRIM_MESSAGE_LENGTH = 500
 | 
			
		||||
 | 
			
		||||
bot.reaction_add do |event|
 | 
			
		||||
  return nil unless event.emoji.name == EMOJI
 | 
			
		||||
@@ -15,7 +16,7 @@ bot.reaction_add do |event|
 | 
			
		||||
 | 
			
		||||
  message_author_fname = "#{message_author_nickname} (#{message_author_distinct})" # this is the 'author' field of the embed
 | 
			
		||||
 | 
			
		||||
  trimmed_msg = "#{event.message.content[0..500]}#{'...' if event.message.content.length > 500}" # trim the string to 500 chars max to not make the embed too huge
 | 
			
		||||
  trimmed_msg = "#{event.message.content[0..TRIM_MESSAGE_LENGTH]}#{'...' if event.message.content.length > TRIM_MESSAGE_LENGTH}" # trim the string to TRIM_MESSAGE_LENGTH chars max to not make the embed too huge
 | 
			
		||||
  original_msg_link = event.message.link
 | 
			
		||||
 | 
			
		||||
  pm = event.user.pm
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user