-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
58 additions
and
7 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
Sources/DiscordKitBot/ApplicationCommand/Option/UserOption.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Elizabeth (lizclipse) on 09/08/2023. | ||
// | ||
|
||
import Foundation | ||
import DiscordKitCore | ||
|
||
public struct UserOption: CommandOption { | ||
public init(_ name: String, description: String, `required`: Bool? = nil, choices: [AppCommandOptionChoice]? = nil, minLength: Int? = nil, maxLength: Int? = nil, autocomplete: Bool? = nil) { | ||
type = .user | ||
|
||
self.required = `required` | ||
self.choices = choices | ||
self.name = name | ||
self.description = description | ||
self.autocomplete = autocomplete | ||
} | ||
|
||
public var type: CommandOptionType | ||
|
||
public var required: Bool? | ||
|
||
/// Choices for the user to pick from | ||
/// | ||
/// > Important: There can be a max of 25 choices. | ||
public let choices: [AppCommandOptionChoice]? | ||
|
||
public let name: String | ||
public let description: String | ||
|
||
/// If autocomplete interactions are enabled for this option | ||
public let autocomplete: Bool? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters