@@ -48,7 +48,8 @@ public async Task CheckSteam(
4848 var steamCollection = _databaseService . SteamChecks ( ) ;
4949
5050 var embed = new EmbedBuilder ( ) ;
51- embed . WithImageUrl ( $ "https://cdn.cloudflare.steamstatic.com/steam/apps/{ response . servers [ 0 ] . appid } /header.jpg")
51+ embed . WithImageUrl (
52+ $ "https://cdn.cloudflare.steamstatic.com/steam/apps/{ response . servers [ 0 ] . appid } /header.jpg")
5253 . AddField ( "Game" , response . servers [ 0 ] . gamedir , true )
5354 . AddField ( "Address" , response . servers [ 0 ] . addr , true )
5455 . AddField ( "App ID" ,
@@ -71,6 +72,7 @@ public async Task CheckSteam(
7172 menuBuilder . AddOption ( $ "[{ server . gamedir } ]: { server . addr } ", index . ToString ( ) ,
7273 isDefault : 0 == index ) ;
7374 }
75+
7476 var builder = new ComponentBuilder ( )
7577 . WithSelectMenu ( menuBuilder ) ;
7678
@@ -91,17 +93,102 @@ public async Task CheckSteam(
9193 }
9294 }
9395
96+ [ SlashCommand ( "gamedig" , "Runs a gamedig query on the specified server" ) ]
97+ public async Task GameDig (
98+ [ Choice ( "Valheim" , "valheim" ) ]
99+ [ Choice ( "Counter-Strike: Global Offensive" , "csgo" ) ]
100+ [ Choice ( "Counter-Strike 2" , "cs2" ) ]
101+ [ Choice ( "Project Zomboid" , "przomboid" ) ]
102+ [ Choice ( "Ark: Survival Evolved" , "arkse" ) ]
103+ [ Choice ( "Minecraft" , "minecraft" ) ]
104+ [ Choice ( "Teamspeak 3" , "teamspeak3" ) ]
105+ [ Choice ( "Rust" , "rust" ) ]
106+ [ Choice ( "7 Days to Die" , "7d2d" ) ]
107+ [ Choice ( "Minecraft: Bedrock Edition" , "minecraftpe" ) ]
108+ [ Choice ( "Garry's Mod" , "garrysmod" ) ]
109+ [ Choice ( "Team Fortress 2" , "tf2" ) ]
110+ [ Choice ( "Left 4 Dead 2 (2009)" , "left4dead2" ) ]
111+ [ Choice ( "Counter-Strike 1.6" , "cs16" ) ]
112+ [ Choice ( "Counter-Strike: Source" , "css" ) ]
113+ [ Choice ( "DayZ" , "dayz" ) ]
114+ [ Choice ( "Terraria" , "terraria" ) ]
115+ [ Choice ( "ARMA 3" , "arma3" ) ]
116+ [ Choice ( "Assetto Corsa" , "assettocorsa" ) ]
117+ [ Choice ( "Unreal Tournament" , "ut" ) ]
118+ [ Choice ( "Core Keeper" , "corekeeper" ) ]
119+ [ Choice ( "Insurgency: Sandstorm" , "insurgencysandstorm" ) ]
120+ [ Choice ( "Squad" , "squad" ) ]
121+ [ Choice ( "Insurgency" , "insurgency" ) ]
122+ [ Choice ( "Killing Floor 2" , "killingfloor2" ) ]
123+ string type ,
124+ [ Summary ( description : "The server ip address or FQDN to check" ) ]
125+ string address )
126+ {
127+ await DeferAsync ( true ) ;
128+
129+ try
130+ {
131+ var result = await Helpers . GameDig ( type , address ) ;
132+
133+ var embed = new EmbedBuilder ( ) ;
134+
135+ embed . WithTitle ( result . name )
136+ . AddField ( "Map" , result . map , true )
137+ . AddField ( "Players" , $ "{ result . players . Length } /{ result . maxplayers } ", true )
138+ . AddField ( "Ping" , result . ping , true )
139+ . WithFooter ( $ "Connect { result . connect } ")
140+ . WithColor ( Color . Blue ) ;
141+
142+ await FollowupAsync ( embed : embed . Build ( ) , ephemeral : true ) ;
143+ }
144+ catch ( Exception exc )
145+ {
146+ await FollowupAsync ( $ "Error, please try again later: { exc } ") ;
147+ }
148+ }
149+
150+ [ SlashCommand ( "gamedig2" , "Runs a gamedig query on the specified server" ) ]
151+ public async Task GameDigType (
152+ [ Summary ( description : "https://github.com/gamedig/node-gamedig/blob/HEAD/GAMES_LIST.md" ) ]
153+ string type ,
154+ [ Summary ( description : "The server ip address or FQDN to check" ) ]
155+ string address )
156+ {
157+ await DeferAsync ( true ) ;
158+
159+ try
160+ {
161+ var result = await Helpers . GameDig ( type , address ) ;
162+
163+ var embed = new EmbedBuilder ( ) ;
164+
165+ embed . WithTitle ( result . name )
166+ . AddField ( "Map" , result . map , true )
167+ . AddField ( "Players" , $ "{ result . players . Length } /{ result . maxplayers } ", true )
168+ . AddField ( "Ping" , result . ping , true )
169+ . WithFooter ( $ "Connect { result . connect } ")
170+ . WithColor ( Color . Blue ) ;
171+
172+ await FollowupAsync ( embed : embed . Build ( ) , ephemeral : true ) ;
173+ }
174+ catch ( Exception exc )
175+ {
176+ await FollowupAsync ( $ "Error, please try again later: { exc } ") ;
177+ }
178+ }
179+
94180 [ ComponentInteraction ( "ss-s" ) ]
95181 public async Task ProcessSteamCheckServerSelection ( string [ ] selectedServer )
96182 {
97183 await DeferAsync ( true ) ;
98184
99185 var serverIndex = Convert . ToInt32 ( selectedServer [ 0 ] ) ;
100186 var steamCollection = _databaseService . SteamChecks ( ) ;
101-
187+
102188 try
103189 {
104- var steamChecks = steamCollection . FindOne ( x => x . Id == ( ( SocketMessageComponent ) Context . Interaction ) . Message . Id ) ;
190+ var steamChecks =
191+ steamCollection . FindOne ( x => x . Id == ( ( SocketMessageComponent ) Context . Interaction ) . Message . Id ) ;
105192
106193 var menuBuilder = new SelectMenuBuilder ( )
107194 . WithPlaceholder ( "Select a server" )
@@ -120,7 +207,8 @@ public async Task ProcessSteamCheckServerSelection(string[] selectedServer)
120207
121208 var embed = new EmbedBuilder ( ) ;
122209
123- embed . WithImageUrl ( $ "https://cdn.cloudflare.steamstatic.com/steam/apps/{ steamChecks . SteamResponse . servers [ serverIndex ] . appid } /header.jpg")
210+ embed . WithImageUrl (
211+ $ "https://cdn.cloudflare.steamstatic.com/steam/apps/{ steamChecks . SteamResponse . servers [ serverIndex ] . appid } /header.jpg")
124212 . AddField ( "Game" , steamChecks . SteamResponse . servers [ serverIndex ] . gamedir , true )
125213 . AddField ( "Address" , steamChecks . SteamResponse . servers [ serverIndex ] . addr , true )
126214 . AddField ( "App ID" ,
0 commit comments