code: def truncate_response(response: str) -> str:
      ending = "...\nTruncating response to 2000 characters due to discord api limits."
      if len(response) > 2000:
          return response[: 2000 - len(ending)] + ending
      else:
          return response
  
file_path: gradio/client/python/gradio_client/templates/discord_chat.py
imports: import asyncio
  import os
  import threading
  from threading import Event
  from typing import Optional
  import discord
  import gradio
  from discord import Permissions
  from discord.ext import commands
  from discord.utils import oauth_url
  import gradio_client
  from gradio_client.utils import QueueError
label_desc: Use image node_id 2 for calling a global function with example usage: truncate_response(response) and returns: unknown, response