クラス: UiService
定義: plugins/utils/src/UiService.ts:32
this.services.ui — テーマ済みの埋め込みと UI ヘルパー。
await interaction.reply({ embeds: [this.services.ui.success("保存しました。")] });
if (!(await this.services.ui.confirm(interaction, { content: "削除しますか?" }))) return;
拡張
コンストラクター
コンストラクター
new UiService(): UiService;
戻り値
UiService
継承元
プロパティ
container
readonly container: Container;
定義: src/component/Component.ts:30
フレームワーク共有サービスを持つコンテナ。
継承元
location
readonly location: string | null;
定義: src/component/Component.ts:39
自動探索されたファイルの絶対パス。明示登録の場合は null。
継承元
logger
readonly logger: Logger;
定義: src/component/Component.ts:36
このコンポーネント用の子ロガー({ store, component } が付与済み)。
継承元
name
readonly name: string;
定義: src/component/Component.ts:27
ストア内で一意なコンポーネント名。
継承元
store
readonly store: ComponentStore<Component>;
定義: src/component/Component.ts:33
このコンポーネントが属するストア。
継承元
アクセッサー
client
署名を取得する
get client(): Client;
定義: src/component/Component.ts:42
フレームワーククライアント。
戻り値
継承元
colors
署名を取得する
get colors(): ColorTheme;
定義: plugins/utils/src/UiService.ts:41
テーマの色。
戻り値
embeds
署名を取得する
get embeds(): Embeds;
定義: plugins/utils/src/UiService.ts:100
戻り値
services
署名を取得する
get services(): Services;
定義: src/component/Component.ts:50
ロード済みサービスへのアクセス(services/ から自動収束)。
import せずに this.services.<名前> で参照できます。
戻り値
継承元
theme
署名を取得する
get theme(): Theme;
定義: plugins/utils/src/UiService.ts:36
このクライアントのテーマ。
戻り値
メソッド
confirm()
confirm(target, options?): Promise<boolean>;
定義: plugins/utils/src/UiService.ts:71
確認ダイアログ。テーマのラベル・色・待ち時間が既定になります。
パラメータ
target
options?
ConfirmOptions = {}
戻り値
Promise<boolean>
error()
error(description?): EmbedBuilder;
定義: plugins/utils/src/UiService.ts:51
失敗(テーマの色)。Error をそのまま渡せます。
パラメータ
description?
string | Error
戻り値
EmbedBuilder
formatDuration()
formatDuration(ms, options?): string;
定義: plugins/utils/src/UiService.ts:91
時計表記。テーマの区切り・ゼロ埋めが既定になります。
パラメータ
ms
number
options?
戻り値
string
humanize()
humanize(ms, options?): string;
定義: plugins/utils/src/UiService.ts:86
大まかな長さ。テーマの単位・区切り・単位数が既定になります。
パラメータ
ms
number
options?
戻り値
string
info()
info(description?): EmbedBuilder;
定義: plugins/utils/src/UiService.ts:61
情報(テーマの色)。
パラメータ
description?
string
戻り値
EmbedBuilder
of()
of(color, description?): EmbedBuilder;
定義: plugins/utils/src/UiService.ts:66
任意の色。テーマの色名か色コードを渡します。
パラメータ
color
number | keyof ColorTheme
description?
string | Error
戻り値
EmbedBuilder
onLoad()?
optional onLoad(): unknown;
定義: src/component/Component.ts:55
初期化後・ストア追加前に呼ばれます。
戻り値
unknown
継承元
onUnload()?
optional onUnload(): unknown;
定義: src/component/Component.ts:58
ストアから取り除かれるときに呼ばれます(クライアント終了時を含む)。
戻り値
unknown
継承元
paginate()
paginate(target, options): Promise<Message<boolean>>;
定義: plugins/utils/src/UiService.ts:76
ページ送り。テーマのボタン・待ち時間が既定になります。
パラメータ
target
options
戻り値
Promise<Message<boolean>>
progressBar()
progressBar(
value,
total,
options?): string;
定義: plugins/utils/src/UiService.ts:81
進捗バー。テーマの文字と幅が既定になります。
パラメータ
value
number
total
number
options?
ProgressBarOptions = {}
戻り値
string
success()
success(description?): EmbedBuilder;
定義: plugins/utils/src/UiService.ts:46
成功(テーマの色)。
パラメータ
description?
string
戻り値
EmbedBuilder
truncate()
truncate(
text,
max,
suffix?): string;
定義: plugins/utils/src/UiService.ts:96
文字列の切り詰め。テーマの省略記号が既定になります。
パラメータ
text
string
max
number
suffix?
string = ...
戻り値
string
warning()
warning(description?): EmbedBuilder;
定義: plugins/utils/src/UiService.ts:56
警告(テーマの色)。
パラメータ
description?
string
戻り値
EmbedBuilder
define()
static define(options?): (_target, context) => void;
サービスのメタデータを宣言します。省略可能です。
パラメータ
options?
ServiceOptions = {}
戻り値
(_target, context) => void