blackcat.js-discord - v1.0.10
    Preparing search index...

    Function findRole

    • Tìm một Discord role trong guild bằng nhiều phương thức khác nhau.

      Hỗ trợ các dạng input:

      • Role mention (<@&roleId>)
      • Role ID
      • Role name (exact match)
      • Role name (partial match)
      • Role color (hex, ví dụ #ff0000)
      • Role position (số thứ tự role trong hierarchy)

      Thứ tự tìm kiếm:

      1. Role mention
      2. Raw role ID
      3. Exact name match
      4. Partial name match
      5. Color match
      6. Position match

      Parameters

      • guild: Guild

        Guild nơi cần tìm role.

      • query: string

        Chuỗi dùng để tìm role (mention, ID, name, color hoặc position).

      Returns Promise<Role | null>

      Promise trả về:

      • Role nếu tìm thấy
      • null nếu không có role phù hợp
      const role = await findRole(message.guild!, "admin");
      
      const role = await findRole(message.guild!, "<@&123456789012345678>");