@@ -56,6 +56,19 @@ async def handle_wol_stream(self, interaction: Interaction) -> None:
5656 case ComputerBootResult .ERROR :
5757 await interaction .followup .send ("エラーが発生しました。" , ephemeral = True )
5858
59+ async def handle_wol_kizai (self , interaction : Interaction ) -> None :
60+ await interaction .response .defer (ephemeral = True )
61+ res = await boot_computer ("kizai" )
62+
63+ match res :
64+ case ComputerBootResult .STARTED :
65+ self .status .set_state (lambda c : {** c , "kizai" : True })
66+ await interaction .followup .send ("映像機材PCの起動を開始しました。" , ephemeral = True )
67+ case ComputerBootResult .CANCELED :
68+ await interaction .followup .send ("映像機材PCは既に起動しています。" , ephemeral = True )
69+ case ComputerBootResult .ERROR :
70+ await interaction .followup .send ("エラーが発生しました。" , ephemeral = True )
71+
5972 async def handle_refresh (self , interaction : Interaction ) -> None :
6073 await interaction .response .defer (ephemeral = True )
6174 current_status = await get_computer_status ()
@@ -84,6 +97,7 @@ def get_label(*, status: bool | None) -> str:
8497 e .add_field (name = "左PC" , value = get_label (status = self .status ()["left" ]))
8598 e .add_field (name = "右PC" , value = get_label (status = self .status ()["right" ]))
8699 e .add_field (name = "配信PC" , value = get_label (status = self .status ()["stream" ]))
100+ e .add_field (name = "映像機材PC" , value = get_label (status = self .status ()["kizai" ]))
87101
88102 return ViewObject (
89103 embeds = [e ],
@@ -106,6 +120,12 @@ def get_label(*, status: bool | None) -> str:
106120 style = {"color" : "blurple" , "disabled" : self .disabled () or bool (self .status ()["stream" ]), "row" : 0 },
107121 on_click = self .handle_wol_stream ,
108122 ),
123+ Button (
124+ "映像機材PCを起動する" ,
125+ custom_id = "wol_kizai" ,
126+ style = {"color" : "blurple" , "disabled" : self .disabled () or bool (self .status ()["kizai" ]), "row" : 0 },
127+ on_click = self .handle_wol_kizai ,
128+ ),
109129 Button (
110130 "表示を更新する" ,
111131 custom_id = "wol_refresh" ,
0 commit comments