You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: user_silencer.rb
    path of file: ./repos/discourse/app/services
    
    the code of the file until where you have to start completion: # frozen_strin
    
  def silence
    hide_posts unless @opts[:keep_posts]
    return false if @user.silenced_till.present?
    @user.silenced_till = @opts[:silenced_till] || 1000.years.from_now
    if @user.save
      message_type = @opts[:message] || :silenced_by_staff

      details = StaffMessageFormat.new(:silence, @opts[:reason], @opts[:message_body]).format

      context = "#{message_type}: #{@opts[:reason]}"

      if @by_user
        log_params = { context: context, details: details }
        log_params[:post_id] = @opts[:post_id].to_i if @opts[:post_id]

        @user_history = StaffActionLogger.new(@by_user).log_silence_user(@user, log_params)
      end