class_docstr: The Discord handler implementation.
docstr: Call a Discord API method.
  Args:
      method_name (str): the method name
      params (dict): the method parameters
  Returns:
      pd.DataFrame
docstr_tok: ["Call","a","Discord","API","method",".","Args",":","method_name","(","str",")",":","the","method","name","params","(","dict",")",":","the","method","parameters","Returns",":","pd.DataFrame"]
code: def call_discord_api(
      self, operation: str, params: dict = None, filters: list = None
  ):
      """
      Call a Discord API method.
      Args:
          method_name (str): the method name
          params (dict): the method parameters
      Returns:
          pd.DataFrame
      """
  
      if operation == "get_messages":
          param_strings = {"limit": params["limit"]}
          if "after" in params:
              param_strings["after"] = self.utc_to_snowflake(
                  params["after"]
              )
          if "before" in params:
              param_strings["before"] = self.utc_to_snowflake(
                  params["before"]
              )
  
          url = f'https://discord.com/api/v10/channels/{params["channel_id"]}/messages'
          result = requests.get(
              url,
              headers={
                  "Authorization": f'Bot {self.connection_data["token"]}',
                  "Content-Type": "application/json",
              },
              params=param_strings,
          )
  
          if result.status_code != 200:
              raise ValueError(
                  f"Error calling Discord API: {result.json()}"
              )
  
          json = result.json()
          for message in json:
              author = message.get("author")
              if author is not None:
                  message["author_id"] = author.get("id")
                  message["author_username"] = author.get("username")
                  message["author_global_name"] = author.get(
                      "global_name"
                  )
  
          df = pd.DataFrame.from_records(json)
          return df
      elif operation == "send_message":
          url = f'https://discord.com/api/v10/channels/{params["channel_id"]}/messages'
          result = requests.post(
              url,
              headers={
                  "Authorization": f'Bot {self.connection_data["token"]}',
                  "Content-Type": "application/json",
              },
              json={
                  "content": params["text"],
              },
          )
  
          if result.status_code != 200:
              raise ValueError(
                  f"Error calling Discord API: {result.json()}"
              )
  
          df = pd.DataFrame.from_records([result.json()])
          return df
      else:
          raise ValueError(f"Unsupported method: {operation}")
  
file_path: mindsdb/mindsdb/integrations/handlers/discord_handler/discord_handler.py
imports: import requests
  import asyncio
  import pandas
  from mindsdb.integrations.handlers.discord_handler.discord_tables import MessagesTable
  from mindsdb.utilities import log
  from mindsdb.integrations.libs.api_handler import APIHandler, FuncParser
  from mindsdb.integrations.utilities.date_utils import parse_utc_date
  from mindsdb.integrations.libs.response import HandlerStatusResponse, HandlerResponse, RESPONSE_TYPE
label_desc: Use image node_id 6 for calling the DiscordHandler obj's underlying member method code with example usage: obj.call_discord_api(operation, params, filters) and returns: df, df