├── .gitignore ├── LICENSE ├── Plugin └── counterstrikesharp │ ├── configs │ └── plugins │ │ └── Cs2Telegram │ │ └── Cs2Telegram.json │ └── plugins │ └── Cs2Telegram │ ├── Cs2Telegram.deps.json │ ├── Cs2Telegram.dll │ ├── Microsoft.AspNetCore.Authentication.Abstractions.dll │ ├── Microsoft.AspNetCore.Authentication.dll │ ├── Microsoft.AspNetCore.Authorization.Policy.dll │ ├── Microsoft.AspNetCore.Authorization.dll │ ├── Microsoft.AspNetCore.Hosting.Abstractions.dll │ ├── Microsoft.AspNetCore.Http.Abstractions.dll │ ├── Microsoft.AspNetCore.Http.Features.dll │ ├── Microsoft.AspNetCore.Metadata.dll │ ├── Microsoft.AspNetCore.Mvc.Abstractions.dll │ ├── Microsoft.AspNetCore.Mvc.Core.dll │ ├── Microsoft.AspNetCore.Routing.Abstractions.dll │ ├── Microsoft.AspNetCore.Routing.dll │ ├── Microsoft.Extensions.ObjectPool.dll │ ├── PRTelegramBot.dll │ ├── System.IO.Pipelines.dll │ └── Telegram.Bot.dll ├── README.md ├── Source ├── Commands │ ├── AdminCommands.cs │ ├── CommonCommands.cs │ ├── PlayerCommands.cs │ └── ServerCommands.cs ├── Constants.cs ├── Cs2Telegram.csproj ├── Cs2TelegramPlugin.cs ├── CssCommands.cs ├── Enums │ └── HeaderCommand.cs ├── GameEvents.cs ├── Helpers.cs ├── InlineInstance │ ├── ChangeLevel.cs │ └── WorkshopChangeLevel.cs ├── Models │ ├── ChangeTeamPlayerCommand.cs │ ├── CustomCommand.cs │ ├── MapTCommand.cs │ └── ServerExecuteTCommand.cs ├── TelegramCfg.cs └── TelegramEvents │ └── CommonEvents.cs └── doc └── BotResult.png /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Ll]og/ 33 | [Ll]ogs/ 34 | 35 | # Visual Studio 2015/2017 cache/options directory 36 | .vs/ 37 | # Uncomment if you have tasks that create the project's static files in wwwroot 38 | #wwwroot/ 39 | 40 | # Visual Studio 2017 auto generated files 41 | Generated\ Files/ 42 | 43 | # MSTest test Results 44 | [Tt]est[Rr]esult*/ 45 | [Bb]uild[Ll]og.* 46 | 47 | # NUnit 48 | *.VisualState.xml 49 | TestResult.xml 50 | nunit-*.xml 51 | 52 | # Build Results of an ATL Project 53 | [Dd]ebugPS/ 54 | [Rr]eleasePS/ 55 | dlldata.c 56 | 57 | # Benchmark Results 58 | BenchmarkDotNet.Artifacts/ 59 | 60 | # .NET Core 61 | project.lock.json 62 | project.fragment.lock.json 63 | artifacts/ 64 | 65 | # ASP.NET Scaffolding 66 | ScaffoldingReadMe.txt 67 | 68 | # StyleCop 69 | StyleCopReport.xml 70 | 71 | # Files built by Visual Studio 72 | *_i.c 73 | *_p.c 74 | *_h.h 75 | *.ilk 76 | *.meta 77 | *.obj 78 | *.iobj 79 | *.pch 80 | *.pdb 81 | *.ipdb 82 | *.pgc 83 | *.pgd 84 | *.rsp 85 | *.sbr 86 | *.tlb 87 | *.tli 88 | *.tlh 89 | *.tmp 90 | *.tmp_proj 91 | *_wpftmp.csproj 92 | *.log 93 | *.tlog 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio 6 auto-generated project file (contains which files were open etc.) 298 | *.vbp 299 | 300 | # Visual Studio 6 workspace and project file (working project files containing files to include in project) 301 | *.dsw 302 | *.dsp 303 | 304 | # Visual Studio 6 technical files 305 | *.ncb 306 | *.aps 307 | 308 | # Visual Studio LightSwitch build output 309 | **/*.HTMLClient/GeneratedArtifacts 310 | **/*.DesktopClient/GeneratedArtifacts 311 | **/*.DesktopClient/ModelManifest.xml 312 | **/*.Server/GeneratedArtifacts 313 | **/*.Server/ModelManifest.xml 314 | _Pvt_Extensions 315 | 316 | # Paket dependency manager 317 | .paket/paket.exe 318 | paket-files/ 319 | 320 | # FAKE - F# Make 321 | .fake/ 322 | 323 | # CodeRush personal settings 324 | .cr/personal 325 | 326 | # Python Tools for Visual Studio (PTVS) 327 | __pycache__/ 328 | *.pyc 329 | 330 | # Cake - Uncomment if you are using it 331 | # tools/** 332 | # !tools/packages.config 333 | 334 | # Tabs Studio 335 | *.tss 336 | 337 | # Telerik's JustMock configuration file 338 | *.jmconfig 339 | 340 | # BizTalk build output 341 | *.btp.cs 342 | *.btm.cs 343 | *.odx.cs 344 | *.xsd.cs 345 | 346 | # OpenCover UI analysis results 347 | OpenCover/ 348 | 349 | # Azure Stream Analytics local run output 350 | ASALocalRun/ 351 | 352 | # MSBuild Binary and Structured Log 353 | *.binlog 354 | 355 | # NVidia Nsight GPU debugger configuration file 356 | *.nvuser 357 | 358 | # MFractors (Xamarin productivity tool) working folder 359 | .mfractor/ 360 | 361 | # Local History for Visual Studio 362 | .localhistory/ 363 | 364 | # Visual Studio History (VSHistory) files 365 | .vshistory/ 366 | 367 | # BeatPulse healthcheck temp database 368 | healthchecksdb 369 | 370 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 371 | MigrationBackup/ 372 | 373 | # Ionide (cross platform F# VS Code tools) working folder 374 | .ionide/ 375 | 376 | # Fody - auto-generated XML schema 377 | FodyWeavers.xsd 378 | 379 | # VS Code files for those working on multiple tools 380 | .vscode/* 381 | !.vscode/settings.json 382 | !.vscode/tasks.json 383 | !.vscode/launch.json 384 | !.vscode/extensions.json 385 | *.code-workspace 386 | 387 | # Local History for Visual Studio Code 388 | .history/ 389 | 390 | # Windows Installer files from build outputs 391 | *.cab 392 | *.msi 393 | *.msix 394 | *.msm 395 | *.msp 396 | 397 | # JetBrains Rider 398 | *.sln.iml 399 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Ilya Samarin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Plugin/counterstrikesharp/configs/plugins/Cs2Telegram/Cs2Telegram.json: -------------------------------------------------------------------------------- 1 | // This configuration was automatically generated by CounterStrikeSharp for plugin 'Cs2Telegram', at 2024/12/25 03:57:10 2 | { 3 | "Token": "", 4 | "Admins": [], 5 | "WhiteListUsers": [], 6 | "ClearUpdatesOnStart": true, 7 | "BotId": 0, 8 | "ServerCommandsMenuItems": [ 9 | "bot_add", 10 | "bot_kick" 11 | ], 12 | "NotifyAdminOnConnectUser": true, 13 | "ColumnMainMenu": 1, 14 | "CustomCommandsEnabled": false, 15 | "CustomCommands": { 16 | "Commands": [ 17 | { 18 | "ButtonName": "Custom Menu", 19 | "Message": "Custom Message", 20 | "AddInMainMenu": false, 21 | "Column": 1, 22 | "WebMenuItems": [ 23 | { 24 | "Name": "Google", 25 | "Url": "Https://google.com" 26 | } 27 | ] 28 | } 29 | ] 30 | }, 31 | "ConfigVersion": 4 32 | } -------------------------------------------------------------------------------- /Plugin/counterstrikesharp/plugins/Cs2Telegram/Cs2Telegram.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeTarget": { 3 | "name": ".NETCoreApp,Version=v8.0", 4 | "signature": "" 5 | }, 6 | "compilationOptions": {}, 7 | "targets": { 8 | ".NETCoreApp,Version=v8.0": { 9 | "Cs2Telegram/0.3.1": { 10 | "dependencies": { 11 | "CounterStrikeSharp.API": "1.0.296", 12 | "PRTelegramBot": "0.7.6" 13 | }, 14 | "runtime": { 15 | "Cs2Telegram.dll": {} 16 | } 17 | }, 18 | "CounterStrikeSharp.API/1.0.296": { 19 | "dependencies": { 20 | "McMaster.NETCore.Plugins": "1.4.0", 21 | "Microsoft.CSharp": "4.7.0", 22 | "Microsoft.DotNet.ApiCompat.Task": "8.0.203", 23 | "Microsoft.Extensions.Hosting": "8.0.0", 24 | "Microsoft.Extensions.Hosting.Abstractions": "8.0.0", 25 | "Microsoft.Extensions.Localization.Abstractions": "8.0.3", 26 | "Microsoft.Extensions.Logging": "8.0.0", 27 | "Scrutor": "4.2.2", 28 | "Serilog.Extensions.Logging": "8.0.0", 29 | "Serilog.Sinks.Console": "5.0.0", 30 | "Serilog.Sinks.File": "5.0.0", 31 | "System.Data.DataSetExtensions": "4.5.0" 32 | }, 33 | "runtime": { 34 | "lib/net8.0/CounterStrikeSharp.API.dll": { 35 | "assemblyVersion": "1.0.296.0", 36 | "fileVersion": "1.0.296.0" 37 | } 38 | } 39 | }, 40 | "McMaster.NETCore.Plugins/1.4.0": { 41 | "dependencies": { 42 | "Microsoft.DotNet.PlatformAbstractions": "3.1.6", 43 | "Microsoft.Extensions.DependencyModel": "6.0.0" 44 | }, 45 | "runtime": { 46 | "lib/netcoreapp3.1/McMaster.NETCore.Plugins.dll": { 47 | "assemblyVersion": "1.4.0.0", 48 | "fileVersion": "1.4.0.0" 49 | } 50 | } 51 | }, 52 | "Microsoft.CSharp/4.7.0": {}, 53 | "Microsoft.DotNet.ApiCompat.Task/8.0.203": {}, 54 | "Microsoft.DotNet.PlatformAbstractions/3.1.6": { 55 | "runtime": { 56 | "lib/netstandard2.0/Microsoft.DotNet.PlatformAbstractions.dll": { 57 | "assemblyVersion": "3.1.6.0", 58 | "fileVersion": "3.100.620.31604" 59 | } 60 | } 61 | }, 62 | "Microsoft.Extensions.Configuration/8.0.0": { 63 | "dependencies": { 64 | "Microsoft.Extensions.Configuration.Abstractions": "8.0.0", 65 | "Microsoft.Extensions.Primitives": "8.0.0" 66 | } 67 | }, 68 | "Microsoft.Extensions.Configuration.Abstractions/8.0.0": { 69 | "dependencies": { 70 | "Microsoft.Extensions.Primitives": "8.0.0" 71 | } 72 | }, 73 | "Microsoft.Extensions.Configuration.Binder/8.0.0": { 74 | "dependencies": { 75 | "Microsoft.Extensions.Configuration.Abstractions": "8.0.0" 76 | } 77 | }, 78 | "Microsoft.Extensions.Configuration.CommandLine/8.0.0": { 79 | "dependencies": { 80 | "Microsoft.Extensions.Configuration": "8.0.0", 81 | "Microsoft.Extensions.Configuration.Abstractions": "8.0.0" 82 | } 83 | }, 84 | "Microsoft.Extensions.Configuration.EnvironmentVariables/8.0.0": { 85 | "dependencies": { 86 | "Microsoft.Extensions.Configuration": "8.0.0", 87 | "Microsoft.Extensions.Configuration.Abstractions": "8.0.0" 88 | } 89 | }, 90 | "Microsoft.Extensions.Configuration.FileExtensions/8.0.0": { 91 | "dependencies": { 92 | "Microsoft.Extensions.Configuration": "8.0.0", 93 | "Microsoft.Extensions.Configuration.Abstractions": "8.0.0", 94 | "Microsoft.Extensions.FileProviders.Abstractions": "8.0.0", 95 | "Microsoft.Extensions.FileProviders.Physical": "8.0.0", 96 | "Microsoft.Extensions.Primitives": "8.0.0" 97 | } 98 | }, 99 | "Microsoft.Extensions.Configuration.Json/8.0.0": { 100 | "dependencies": { 101 | "Microsoft.Extensions.Configuration": "8.0.0", 102 | "Microsoft.Extensions.Configuration.Abstractions": "8.0.0", 103 | "Microsoft.Extensions.Configuration.FileExtensions": "8.0.0", 104 | "Microsoft.Extensions.FileProviders.Abstractions": "8.0.0", 105 | "System.Text.Json": "8.0.5" 106 | } 107 | }, 108 | "Microsoft.Extensions.Configuration.UserSecrets/8.0.0": { 109 | "dependencies": { 110 | "Microsoft.Extensions.Configuration.Abstractions": "8.0.0", 111 | "Microsoft.Extensions.Configuration.Json": "8.0.0", 112 | "Microsoft.Extensions.FileProviders.Abstractions": "8.0.0", 113 | "Microsoft.Extensions.FileProviders.Physical": "8.0.0" 114 | } 115 | }, 116 | "Microsoft.Extensions.DependencyInjection/8.0.0": { 117 | "dependencies": { 118 | "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0" 119 | } 120 | }, 121 | "Microsoft.Extensions.DependencyInjection.Abstractions/8.0.0": {}, 122 | "Microsoft.Extensions.DependencyModel/6.0.0": { 123 | "dependencies": { 124 | "System.Buffers": "4.5.1", 125 | "System.Memory": "4.5.4", 126 | "System.Runtime.CompilerServices.Unsafe": "6.0.0", 127 | "System.Text.Encodings.Web": "6.0.0", 128 | "System.Text.Json": "8.0.5" 129 | }, 130 | "runtime": { 131 | "lib/netstandard2.0/Microsoft.Extensions.DependencyModel.dll": { 132 | "assemblyVersion": "6.0.0.0", 133 | "fileVersion": "6.0.21.52210" 134 | } 135 | } 136 | }, 137 | "Microsoft.Extensions.Diagnostics/8.0.0": { 138 | "dependencies": { 139 | "Microsoft.Extensions.Configuration": "8.0.0", 140 | "Microsoft.Extensions.Diagnostics.Abstractions": "8.0.0", 141 | "Microsoft.Extensions.Options.ConfigurationExtensions": "8.0.0" 142 | } 143 | }, 144 | "Microsoft.Extensions.Diagnostics.Abstractions/8.0.0": { 145 | "dependencies": { 146 | "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", 147 | "Microsoft.Extensions.Options": "8.0.0", 148 | "System.Diagnostics.DiagnosticSource": "8.0.0" 149 | } 150 | }, 151 | "Microsoft.Extensions.FileProviders.Abstractions/8.0.0": { 152 | "dependencies": { 153 | "Microsoft.Extensions.Primitives": "8.0.0" 154 | } 155 | }, 156 | "Microsoft.Extensions.FileProviders.Physical/8.0.0": { 157 | "dependencies": { 158 | "Microsoft.Extensions.FileProviders.Abstractions": "8.0.0", 159 | "Microsoft.Extensions.FileSystemGlobbing": "8.0.0", 160 | "Microsoft.Extensions.Primitives": "8.0.0" 161 | } 162 | }, 163 | "Microsoft.Extensions.FileSystemGlobbing/8.0.0": {}, 164 | "Microsoft.Extensions.Hosting/8.0.0": { 165 | "dependencies": { 166 | "Microsoft.Extensions.Configuration": "8.0.0", 167 | "Microsoft.Extensions.Configuration.Abstractions": "8.0.0", 168 | "Microsoft.Extensions.Configuration.Binder": "8.0.0", 169 | "Microsoft.Extensions.Configuration.CommandLine": "8.0.0", 170 | "Microsoft.Extensions.Configuration.EnvironmentVariables": "8.0.0", 171 | "Microsoft.Extensions.Configuration.FileExtensions": "8.0.0", 172 | "Microsoft.Extensions.Configuration.Json": "8.0.0", 173 | "Microsoft.Extensions.Configuration.UserSecrets": "8.0.0", 174 | "Microsoft.Extensions.DependencyInjection": "8.0.0", 175 | "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", 176 | "Microsoft.Extensions.Diagnostics": "8.0.0", 177 | "Microsoft.Extensions.FileProviders.Abstractions": "8.0.0", 178 | "Microsoft.Extensions.FileProviders.Physical": "8.0.0", 179 | "Microsoft.Extensions.Hosting.Abstractions": "8.0.0", 180 | "Microsoft.Extensions.Logging": "8.0.0", 181 | "Microsoft.Extensions.Logging.Abstractions": "8.0.0", 182 | "Microsoft.Extensions.Logging.Configuration": "8.0.0", 183 | "Microsoft.Extensions.Logging.Console": "8.0.0", 184 | "Microsoft.Extensions.Logging.Debug": "8.0.0", 185 | "Microsoft.Extensions.Logging.EventLog": "8.0.0", 186 | "Microsoft.Extensions.Logging.EventSource": "8.0.0", 187 | "Microsoft.Extensions.Options": "8.0.0" 188 | } 189 | }, 190 | "Microsoft.Extensions.Hosting.Abstractions/8.0.0": { 191 | "dependencies": { 192 | "Microsoft.Extensions.Configuration.Abstractions": "8.0.0", 193 | "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", 194 | "Microsoft.Extensions.Diagnostics.Abstractions": "8.0.0", 195 | "Microsoft.Extensions.FileProviders.Abstractions": "8.0.0", 196 | "Microsoft.Extensions.Logging.Abstractions": "8.0.0" 197 | } 198 | }, 199 | "Microsoft.Extensions.Localization.Abstractions/8.0.3": { 200 | "runtime": { 201 | "lib/net8.0/Microsoft.Extensions.Localization.Abstractions.dll": { 202 | "assemblyVersion": "8.0.0.0", 203 | "fileVersion": "8.0.324.11615" 204 | } 205 | } 206 | }, 207 | "Microsoft.Extensions.Logging/8.0.0": { 208 | "dependencies": { 209 | "Microsoft.Extensions.DependencyInjection": "8.0.0", 210 | "Microsoft.Extensions.Logging.Abstractions": "8.0.0", 211 | "Microsoft.Extensions.Options": "8.0.0" 212 | } 213 | }, 214 | "Microsoft.Extensions.Logging.Abstractions/8.0.0": { 215 | "dependencies": { 216 | "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0" 217 | } 218 | }, 219 | "Microsoft.Extensions.Logging.Configuration/8.0.0": { 220 | "dependencies": { 221 | "Microsoft.Extensions.Configuration": "8.0.0", 222 | "Microsoft.Extensions.Configuration.Abstractions": "8.0.0", 223 | "Microsoft.Extensions.Configuration.Binder": "8.0.0", 224 | "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", 225 | "Microsoft.Extensions.Logging": "8.0.0", 226 | "Microsoft.Extensions.Logging.Abstractions": "8.0.0", 227 | "Microsoft.Extensions.Options": "8.0.0", 228 | "Microsoft.Extensions.Options.ConfigurationExtensions": "8.0.0" 229 | } 230 | }, 231 | "Microsoft.Extensions.Logging.Console/8.0.0": { 232 | "dependencies": { 233 | "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", 234 | "Microsoft.Extensions.Logging": "8.0.0", 235 | "Microsoft.Extensions.Logging.Abstractions": "8.0.0", 236 | "Microsoft.Extensions.Logging.Configuration": "8.0.0", 237 | "Microsoft.Extensions.Options": "8.0.0", 238 | "System.Text.Json": "8.0.5" 239 | } 240 | }, 241 | "Microsoft.Extensions.Logging.Debug/8.0.0": { 242 | "dependencies": { 243 | "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", 244 | "Microsoft.Extensions.Logging": "8.0.0", 245 | "Microsoft.Extensions.Logging.Abstractions": "8.0.0" 246 | } 247 | }, 248 | "Microsoft.Extensions.Logging.EventLog/8.0.0": { 249 | "dependencies": { 250 | "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", 251 | "Microsoft.Extensions.Logging": "8.0.0", 252 | "Microsoft.Extensions.Logging.Abstractions": "8.0.0", 253 | "Microsoft.Extensions.Options": "8.0.0", 254 | "System.Diagnostics.EventLog": "8.0.0" 255 | } 256 | }, 257 | "Microsoft.Extensions.Logging.EventSource/8.0.0": { 258 | "dependencies": { 259 | "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", 260 | "Microsoft.Extensions.Logging": "8.0.0", 261 | "Microsoft.Extensions.Logging.Abstractions": "8.0.0", 262 | "Microsoft.Extensions.Options": "8.0.0", 263 | "Microsoft.Extensions.Primitives": "8.0.0", 264 | "System.Text.Json": "8.0.5" 265 | } 266 | }, 267 | "Microsoft.Extensions.Options/8.0.0": { 268 | "dependencies": { 269 | "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", 270 | "Microsoft.Extensions.Primitives": "8.0.0" 271 | } 272 | }, 273 | "Microsoft.Extensions.Options.ConfigurationExtensions/8.0.0": { 274 | "dependencies": { 275 | "Microsoft.Extensions.Configuration.Abstractions": "8.0.0", 276 | "Microsoft.Extensions.Configuration.Binder": "8.0.0", 277 | "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", 278 | "Microsoft.Extensions.Options": "8.0.0", 279 | "Microsoft.Extensions.Primitives": "8.0.0" 280 | } 281 | }, 282 | "Microsoft.Extensions.Primitives/8.0.0": {}, 283 | "PRTelegramBot/0.7.6": { 284 | "dependencies": { 285 | "Telegram.Bot": "22.2.0" 286 | }, 287 | "runtime": { 288 | "lib/net6.0/PRTelegramBot.dll": { 289 | "assemblyVersion": "0.7.6.0", 290 | "fileVersion": "0.7.6.0" 291 | } 292 | } 293 | }, 294 | "Scrutor/4.2.2": { 295 | "dependencies": { 296 | "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0", 297 | "Microsoft.Extensions.DependencyModel": "6.0.0" 298 | }, 299 | "runtime": { 300 | "lib/net6.0/Scrutor.dll": { 301 | "assemblyVersion": "4.0.0.0", 302 | "fileVersion": "4.0.0.0" 303 | } 304 | } 305 | }, 306 | "Serilog/3.1.1": { 307 | "runtime": { 308 | "lib/net7.0/Serilog.dll": { 309 | "assemblyVersion": "2.0.0.0", 310 | "fileVersion": "3.1.1.0" 311 | } 312 | } 313 | }, 314 | "Serilog.Extensions.Logging/8.0.0": { 315 | "dependencies": { 316 | "Microsoft.Extensions.Logging": "8.0.0", 317 | "Serilog": "3.1.1" 318 | }, 319 | "runtime": { 320 | "lib/net8.0/Serilog.Extensions.Logging.dll": { 321 | "assemblyVersion": "7.0.0.0", 322 | "fileVersion": "8.0.0.0" 323 | } 324 | } 325 | }, 326 | "Serilog.Sinks.Console/5.0.0": { 327 | "dependencies": { 328 | "Serilog": "3.1.1" 329 | }, 330 | "runtime": { 331 | "lib/net7.0/Serilog.Sinks.Console.dll": { 332 | "assemblyVersion": "5.0.0.0", 333 | "fileVersion": "5.0.0.0" 334 | } 335 | } 336 | }, 337 | "Serilog.Sinks.File/5.0.0": { 338 | "dependencies": { 339 | "Serilog": "3.1.1" 340 | }, 341 | "runtime": { 342 | "lib/net5.0/Serilog.Sinks.File.dll": { 343 | "assemblyVersion": "5.0.0.0", 344 | "fileVersion": "5.0.0.0" 345 | } 346 | } 347 | }, 348 | "System.Buffers/4.5.1": {}, 349 | "System.Data.DataSetExtensions/4.5.0": {}, 350 | "System.Diagnostics.DiagnosticSource/8.0.0": {}, 351 | "System.Diagnostics.EventLog/8.0.0": {}, 352 | "System.Memory/4.5.4": {}, 353 | "System.Runtime.CompilerServices.Unsafe/6.0.0": {}, 354 | "System.Text.Encodings.Web/6.0.0": { 355 | "dependencies": { 356 | "System.Runtime.CompilerServices.Unsafe": "6.0.0" 357 | } 358 | }, 359 | "System.Text.Json/8.0.5": {}, 360 | "Telegram.Bot/22.2.0": { 361 | "dependencies": { 362 | "Microsoft.Extensions.Options.ConfigurationExtensions": "8.0.0", 363 | "System.Text.Json": "8.0.5" 364 | }, 365 | "runtime": { 366 | "lib/net6.0/Telegram.Bot.dll": { 367 | "assemblyVersion": "22.2.0.0", 368 | "fileVersion": "22.2.0.0" 369 | } 370 | } 371 | } 372 | } 373 | }, 374 | "libraries": { 375 | "Cs2Telegram/0.3.1": { 376 | "type": "project", 377 | "serviceable": false, 378 | "sha512": "" 379 | }, 380 | "CounterStrikeSharp.API/1.0.296": { 381 | "type": "package", 382 | "serviceable": true, 383 | "sha512": "sha512-mmf7iRKWa88vvsv1XQCw8hwxzsiPB2O5DPKAdr5zzPSod8hoplBHA80ITCIExGpoi1e3yXdT24JdsqW6pTGh8w==", 384 | "path": "counterstrikesharp.api/1.0.296", 385 | "hashPath": "counterstrikesharp.api.1.0.296.nupkg.sha512" 386 | }, 387 | "McMaster.NETCore.Plugins/1.4.0": { 388 | "type": "package", 389 | "serviceable": true, 390 | "sha512": "sha512-UKw5Z2/QHhkR7kiAJmqdCwVDMQV0lwsfj10+FG676r8DsJWIpxtachtEjE0qBs9WoK5GUQIqxgyFeYUSwuPszg==", 391 | "path": "mcmaster.netcore.plugins/1.4.0", 392 | "hashPath": "mcmaster.netcore.plugins.1.4.0.nupkg.sha512" 393 | }, 394 | "Microsoft.CSharp/4.7.0": { 395 | "type": "package", 396 | "serviceable": true, 397 | "sha512": "sha512-pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==", 398 | "path": "microsoft.csharp/4.7.0", 399 | "hashPath": "microsoft.csharp.4.7.0.nupkg.sha512" 400 | }, 401 | "Microsoft.DotNet.ApiCompat.Task/8.0.203": { 402 | "type": "package", 403 | "serviceable": true, 404 | "sha512": "sha512-nPEGMojf1mj1oVixe0aiBimSn6xUoZswSjpMPZFMkZ+znYm2GEM5tWGZEWb6OSNIo5gWKyDi1WcI4IL7YiL1Zw==", 405 | "path": "microsoft.dotnet.apicompat.task/8.0.203", 406 | "hashPath": "microsoft.dotnet.apicompat.task.8.0.203.nupkg.sha512" 407 | }, 408 | "Microsoft.DotNet.PlatformAbstractions/3.1.6": { 409 | "type": "package", 410 | "serviceable": true, 411 | "sha512": "sha512-jek4XYaQ/PGUwDKKhwR8K47Uh1189PFzMeLqO83mXrXQVIpARZCcfuDedH50YDTepBkfijCZN5U/vZi++erxtg==", 412 | "path": "microsoft.dotnet.platformabstractions/3.1.6", 413 | "hashPath": "microsoft.dotnet.platformabstractions.3.1.6.nupkg.sha512" 414 | }, 415 | "Microsoft.Extensions.Configuration/8.0.0": { 416 | "type": "package", 417 | "serviceable": true, 418 | "sha512": "sha512-0J/9YNXTMWSZP2p2+nvl8p71zpSwokZXZuJW+VjdErkegAnFdO1XlqtA62SJtgVYHdKu3uPxJHcMR/r35HwFBA==", 419 | "path": "microsoft.extensions.configuration/8.0.0", 420 | "hashPath": "microsoft.extensions.configuration.8.0.0.nupkg.sha512" 421 | }, 422 | "Microsoft.Extensions.Configuration.Abstractions/8.0.0": { 423 | "type": "package", 424 | "serviceable": true, 425 | "sha512": "sha512-3lE/iLSutpgX1CC0NOW70FJoGARRHbyKmG7dc0klnUZ9Dd9hS6N/POPWhKhMLCEuNN5nXEY5agmlFtH562vqhQ==", 426 | "path": "microsoft.extensions.configuration.abstractions/8.0.0", 427 | "hashPath": "microsoft.extensions.configuration.abstractions.8.0.0.nupkg.sha512" 428 | }, 429 | "Microsoft.Extensions.Configuration.Binder/8.0.0": { 430 | "type": "package", 431 | "serviceable": true, 432 | "sha512": "sha512-mBMoXLsr5s1y2zOHWmKsE9veDcx8h1x/c3rz4baEdQKTeDcmQAPNbB54Pi/lhFO3K431eEq6PFbMgLaa6PHFfA==", 433 | "path": "microsoft.extensions.configuration.binder/8.0.0", 434 | "hashPath": "microsoft.extensions.configuration.binder.8.0.0.nupkg.sha512" 435 | }, 436 | "Microsoft.Extensions.Configuration.CommandLine/8.0.0": { 437 | "type": "package", 438 | "serviceable": true, 439 | "sha512": "sha512-NZuZMz3Q8Z780nKX3ifV1fE7lS+6pynDHK71OfU4OZ1ItgvDOhyOC7E6z+JMZrAj63zRpwbdldYFk499t3+1dQ==", 440 | "path": "microsoft.extensions.configuration.commandline/8.0.0", 441 | "hashPath": "microsoft.extensions.configuration.commandline.8.0.0.nupkg.sha512" 442 | }, 443 | "Microsoft.Extensions.Configuration.EnvironmentVariables/8.0.0": { 444 | "type": "package", 445 | "serviceable": true, 446 | "sha512": "sha512-plvZ0ZIpq+97gdPNNvhwvrEZ92kNml9hd1pe3idMA7svR0PztdzVLkoWLcRFgySYXUJc3kSM3Xw3mNFMo/bxRA==", 447 | "path": "microsoft.extensions.configuration.environmentvariables/8.0.0", 448 | "hashPath": "microsoft.extensions.configuration.environmentvariables.8.0.0.nupkg.sha512" 449 | }, 450 | "Microsoft.Extensions.Configuration.FileExtensions/8.0.0": { 451 | "type": "package", 452 | "serviceable": true, 453 | "sha512": "sha512-McP+Lz/EKwvtCv48z0YImw+L1gi1gy5rHhNaNIY2CrjloV+XY8gydT8DjMR6zWeL13AFK+DioVpppwAuO1Gi1w==", 454 | "path": "microsoft.extensions.configuration.fileextensions/8.0.0", 455 | "hashPath": "microsoft.extensions.configuration.fileextensions.8.0.0.nupkg.sha512" 456 | }, 457 | "Microsoft.Extensions.Configuration.Json/8.0.0": { 458 | "type": "package", 459 | "serviceable": true, 460 | "sha512": "sha512-C2wqUoh9OmRL1akaCcKSTmRU8z0kckfImG7zLNI8uyi47Lp+zd5LWAD17waPQEqCz3ioWOCrFUo+JJuoeZLOBw==", 461 | "path": "microsoft.extensions.configuration.json/8.0.0", 462 | "hashPath": "microsoft.extensions.configuration.json.8.0.0.nupkg.sha512" 463 | }, 464 | "Microsoft.Extensions.Configuration.UserSecrets/8.0.0": { 465 | "type": "package", 466 | "serviceable": true, 467 | "sha512": "sha512-ihDHu2dJYQird9pl2CbdwuNDfvCZdOS0S7SPlNfhPt0B81UTT+yyZKz2pimFZGUp3AfuBRnqUCxB2SjsZKHVUw==", 468 | "path": "microsoft.extensions.configuration.usersecrets/8.0.0", 469 | "hashPath": "microsoft.extensions.configuration.usersecrets.8.0.0.nupkg.sha512" 470 | }, 471 | "Microsoft.Extensions.DependencyInjection/8.0.0": { 472 | "type": "package", 473 | "serviceable": true, 474 | "sha512": "sha512-V8S3bsm50ig6JSyrbcJJ8bW2b9QLGouz+G1miK3UTaOWmMtFwNNNzUf4AleyDWUmTrWMLNnFSLEQtxmxgNQnNQ==", 475 | "path": "microsoft.extensions.dependencyinjection/8.0.0", 476 | "hashPath": "microsoft.extensions.dependencyinjection.8.0.0.nupkg.sha512" 477 | }, 478 | "Microsoft.Extensions.DependencyInjection.Abstractions/8.0.0": { 479 | "type": "package", 480 | "serviceable": true, 481 | "sha512": "sha512-cjWrLkJXK0rs4zofsK4bSdg+jhDLTaxrkXu4gS6Y7MAlCvRyNNgwY/lJi5RDlQOnSZweHqoyvgvbdvQsRIW+hg==", 482 | "path": "microsoft.extensions.dependencyinjection.abstractions/8.0.0", 483 | "hashPath": "microsoft.extensions.dependencyinjection.abstractions.8.0.0.nupkg.sha512" 484 | }, 485 | "Microsoft.Extensions.DependencyModel/6.0.0": { 486 | "type": "package", 487 | "serviceable": true, 488 | "sha512": "sha512-TD5QHg98m3+QhgEV1YVoNMl5KtBw/4rjfxLHO0e/YV9bPUBDKntApP4xdrVtGgCeQZHVfC2EXIGsdpRNrr87Pg==", 489 | "path": "microsoft.extensions.dependencymodel/6.0.0", 490 | "hashPath": "microsoft.extensions.dependencymodel.6.0.0.nupkg.sha512" 491 | }, 492 | "Microsoft.Extensions.Diagnostics/8.0.0": { 493 | "type": "package", 494 | "serviceable": true, 495 | "sha512": "sha512-3PZp/YSkIXrF7QK7PfC1bkyRYwqOHpWFad8Qx+4wkuumAeXo1NHaxpS9LboNA9OvNSAu+QOVlXbMyoY+pHSqcw==", 496 | "path": "microsoft.extensions.diagnostics/8.0.0", 497 | "hashPath": "microsoft.extensions.diagnostics.8.0.0.nupkg.sha512" 498 | }, 499 | "Microsoft.Extensions.Diagnostics.Abstractions/8.0.0": { 500 | "type": "package", 501 | "serviceable": true, 502 | "sha512": "sha512-JHYCQG7HmugNYUhOl368g+NMxYE/N/AiclCYRNlgCY9eVyiBkOHMwK4x60RYMxv9EL3+rmj1mqHvdCiPpC+D4Q==", 503 | "path": "microsoft.extensions.diagnostics.abstractions/8.0.0", 504 | "hashPath": "microsoft.extensions.diagnostics.abstractions.8.0.0.nupkg.sha512" 505 | }, 506 | "Microsoft.Extensions.FileProviders.Abstractions/8.0.0": { 507 | "type": "package", 508 | "serviceable": true, 509 | "sha512": "sha512-ZbaMlhJlpisjuWbvXr4LdAst/1XxH3vZ6A0BsgTphZ2L4PGuxRLz7Jr/S7mkAAnOn78Vu0fKhEgNF5JO3zfjqQ==", 510 | "path": "microsoft.extensions.fileproviders.abstractions/8.0.0", 511 | "hashPath": "microsoft.extensions.fileproviders.abstractions.8.0.0.nupkg.sha512" 512 | }, 513 | "Microsoft.Extensions.FileProviders.Physical/8.0.0": { 514 | "type": "package", 515 | "serviceable": true, 516 | "sha512": "sha512-UboiXxpPUpwulHvIAVE36Knq0VSHaAmfrFkegLyBZeaADuKezJ/AIXYAW8F5GBlGk/VaibN2k/Zn1ca8YAfVdA==", 517 | "path": "microsoft.extensions.fileproviders.physical/8.0.0", 518 | "hashPath": "microsoft.extensions.fileproviders.physical.8.0.0.nupkg.sha512" 519 | }, 520 | "Microsoft.Extensions.FileSystemGlobbing/8.0.0": { 521 | "type": "package", 522 | "serviceable": true, 523 | "sha512": "sha512-OK+670i7esqlQrPjdIKRbsyMCe9g5kSLpRRQGSr4Q58AOYEe/hCnfLZprh7viNisSUUQZmMrbbuDaIrP+V1ebQ==", 524 | "path": "microsoft.extensions.filesystemglobbing/8.0.0", 525 | "hashPath": "microsoft.extensions.filesystemglobbing.8.0.0.nupkg.sha512" 526 | }, 527 | "Microsoft.Extensions.Hosting/8.0.0": { 528 | "type": "package", 529 | "serviceable": true, 530 | "sha512": "sha512-ItYHpdqVp5/oFLT5QqbopnkKlyFG9EW/9nhM6/yfObeKt6Su0wkBio6AizgRHGNwhJuAtlE5VIjow5JOTrip6w==", 531 | "path": "microsoft.extensions.hosting/8.0.0", 532 | "hashPath": "microsoft.extensions.hosting.8.0.0.nupkg.sha512" 533 | }, 534 | "Microsoft.Extensions.Hosting.Abstractions/8.0.0": { 535 | "type": "package", 536 | "serviceable": true, 537 | "sha512": "sha512-AG7HWwVRdCHlaA++1oKDxLsXIBxmDpMPb3VoyOoAghEWnkUvEAdYQUwnV4jJbAaa/nMYNiEh5ByoLauZBEiovg==", 538 | "path": "microsoft.extensions.hosting.abstractions/8.0.0", 539 | "hashPath": "microsoft.extensions.hosting.abstractions.8.0.0.nupkg.sha512" 540 | }, 541 | "Microsoft.Extensions.Localization.Abstractions/8.0.3": { 542 | "type": "package", 543 | "serviceable": true, 544 | "sha512": "sha512-k/kUPm1FQBxcs9/vsM1eF4qIOg2Sovqh/+KUGHur5Mc0Y3OFGuoz9ktBX7LA0gPz53SZhW3W3oaSaMFFcjgM6Q==", 545 | "path": "microsoft.extensions.localization.abstractions/8.0.3", 546 | "hashPath": "microsoft.extensions.localization.abstractions.8.0.3.nupkg.sha512" 547 | }, 548 | "Microsoft.Extensions.Logging/8.0.0": { 549 | "type": "package", 550 | "serviceable": true, 551 | "sha512": "sha512-tvRkov9tAJ3xP51LCv3FJ2zINmv1P8Hi8lhhtcKGqM+ImiTCC84uOPEI4z8Cdq2C3o9e+Aa0Gw0rmrsJD77W+w==", 552 | "path": "microsoft.extensions.logging/8.0.0", 553 | "hashPath": "microsoft.extensions.logging.8.0.0.nupkg.sha512" 554 | }, 555 | "Microsoft.Extensions.Logging.Abstractions/8.0.0": { 556 | "type": "package", 557 | "serviceable": true, 558 | "sha512": "sha512-arDBqTgFCyS0EvRV7O3MZturChstm50OJ0y9bDJvAcmEPJm0FFpFyjU/JLYyStNGGey081DvnQYlncNX5SJJGA==", 559 | "path": "microsoft.extensions.logging.abstractions/8.0.0", 560 | "hashPath": "microsoft.extensions.logging.abstractions.8.0.0.nupkg.sha512" 561 | }, 562 | "Microsoft.Extensions.Logging.Configuration/8.0.0": { 563 | "type": "package", 564 | "serviceable": true, 565 | "sha512": "sha512-ixXXV0G/12g6MXK65TLngYN9V5hQQRuV+fZi882WIoVJT7h5JvoYoxTEwCgdqwLjSneqh1O+66gM8sMr9z/rsQ==", 566 | "path": "microsoft.extensions.logging.configuration/8.0.0", 567 | "hashPath": "microsoft.extensions.logging.configuration.8.0.0.nupkg.sha512" 568 | }, 569 | "Microsoft.Extensions.Logging.Console/8.0.0": { 570 | "type": "package", 571 | "serviceable": true, 572 | "sha512": "sha512-e+48o7DztoYog+PY430lPxrM4mm3PbA6qucvQtUDDwVo4MO+ejMw7YGc/o2rnxbxj4isPxdfKFzTxvXMwAz83A==", 573 | "path": "microsoft.extensions.logging.console/8.0.0", 574 | "hashPath": "microsoft.extensions.logging.console.8.0.0.nupkg.sha512" 575 | }, 576 | "Microsoft.Extensions.Logging.Debug/8.0.0": { 577 | "type": "package", 578 | "serviceable": true, 579 | "sha512": "sha512-dt0x21qBdudHLW/bjMJpkixv858RRr8eSomgVbU8qljOyfrfDGi1JQvpF9w8S7ziRPtRKisuWaOwFxJM82GxeA==", 580 | "path": "microsoft.extensions.logging.debug/8.0.0", 581 | "hashPath": "microsoft.extensions.logging.debug.8.0.0.nupkg.sha512" 582 | }, 583 | "Microsoft.Extensions.Logging.EventLog/8.0.0": { 584 | "type": "package", 585 | "serviceable": true, 586 | "sha512": "sha512-3X9D3sl7EmOu7vQp5MJrmIJBl5XSdOhZPYXUeFfYa6Nnm9+tok8x3t3IVPLhm7UJtPOU61ohFchw8rNm9tIYOQ==", 587 | "path": "microsoft.extensions.logging.eventlog/8.0.0", 588 | "hashPath": "microsoft.extensions.logging.eventlog.8.0.0.nupkg.sha512" 589 | }, 590 | "Microsoft.Extensions.Logging.EventSource/8.0.0": { 591 | "type": "package", 592 | "serviceable": true, 593 | "sha512": "sha512-oKcPMrw+luz2DUAKhwFXrmFikZWnyc8l2RKoQwqU3KIZZjcfoJE0zRHAnqATfhRZhtcbjl/QkiY2Xjxp0xu+6w==", 594 | "path": "microsoft.extensions.logging.eventsource/8.0.0", 595 | "hashPath": "microsoft.extensions.logging.eventsource.8.0.0.nupkg.sha512" 596 | }, 597 | "Microsoft.Extensions.Options/8.0.0": { 598 | "type": "package", 599 | "serviceable": true, 600 | "sha512": "sha512-JOVOfqpnqlVLUzINQ2fox8evY2SKLYJ3BV8QDe/Jyp21u1T7r45x/R/5QdteURMR5r01GxeJSBBUOCOyaNXA3g==", 601 | "path": "microsoft.extensions.options/8.0.0", 602 | "hashPath": "microsoft.extensions.options.8.0.0.nupkg.sha512" 603 | }, 604 | "Microsoft.Extensions.Options.ConfigurationExtensions/8.0.0": { 605 | "type": "package", 606 | "serviceable": true, 607 | "sha512": "sha512-0f4DMRqEd50zQh+UyJc+/HiBsZ3vhAQALgdkcQEalSH1L2isdC7Yj54M3cyo5e+BeO5fcBQ7Dxly8XiBBcvRgw==", 608 | "path": "microsoft.extensions.options.configurationextensions/8.0.0", 609 | "hashPath": "microsoft.extensions.options.configurationextensions.8.0.0.nupkg.sha512" 610 | }, 611 | "Microsoft.Extensions.Primitives/8.0.0": { 612 | "type": "package", 613 | "serviceable": true, 614 | "sha512": "sha512-bXJEZrW9ny8vjMF1JV253WeLhpEVzFo1lyaZu1vQ4ZxWUlVvknZ/+ftFgVheLubb4eZPSwwxBeqS1JkCOjxd8g==", 615 | "path": "microsoft.extensions.primitives/8.0.0", 616 | "hashPath": "microsoft.extensions.primitives.8.0.0.nupkg.sha512" 617 | }, 618 | "PRTelegramBot/0.7.6": { 619 | "type": "package", 620 | "serviceable": true, 621 | "sha512": "sha512-QZxUJadCt2TbaP3hQu1VyTWjJABR/Ts6qpsKu8kkyUZ+WBQ+jIgLJIcZB0F3mhwA2j4PHiO1QPyVLx4xavfe0w==", 622 | "path": "prtelegrambot/0.7.6", 623 | "hashPath": "prtelegrambot.0.7.6.nupkg.sha512" 624 | }, 625 | "Scrutor/4.2.2": { 626 | "type": "package", 627 | "serviceable": true, 628 | "sha512": "sha512-t5VIYA7WJXoJJo7s4DoHakMGwTu+MeEnZumMOhTCH7kz9xWha24G7dJNxWrHPlu0ZdZAS4jDZCxxAnyaBh7uYw==", 629 | "path": "scrutor/4.2.2", 630 | "hashPath": "scrutor.4.2.2.nupkg.sha512" 631 | }, 632 | "Serilog/3.1.1": { 633 | "type": "package", 634 | "serviceable": true, 635 | "sha512": "sha512-P6G4/4Kt9bT635bhuwdXlJ2SCqqn2nhh4gqFqQueCOr9bK/e7W9ll/IoX1Ter948cV2Z/5+5v8pAfJYUISY03A==", 636 | "path": "serilog/3.1.1", 637 | "hashPath": "serilog.3.1.1.nupkg.sha512" 638 | }, 639 | "Serilog.Extensions.Logging/8.0.0": { 640 | "type": "package", 641 | "serviceable": true, 642 | "sha512": "sha512-YEAMWu1UnWgf1c1KP85l1SgXGfiVo0Rz6x08pCiPOIBt2Qe18tcZLvdBUuV5o1QHvrs8FAry9wTIhgBRtjIlEg==", 643 | "path": "serilog.extensions.logging/8.0.0", 644 | "hashPath": "serilog.extensions.logging.8.0.0.nupkg.sha512" 645 | }, 646 | "Serilog.Sinks.Console/5.0.0": { 647 | "type": "package", 648 | "serviceable": true, 649 | "sha512": "sha512-IZ6bn79k+3SRXOBpwSOClUHikSkp2toGPCZ0teUkscv4dpDg9E2R2xVsNkLmwddE4OpNVO3N0xiYsAH556vN8Q==", 650 | "path": "serilog.sinks.console/5.0.0", 651 | "hashPath": "serilog.sinks.console.5.0.0.nupkg.sha512" 652 | }, 653 | "Serilog.Sinks.File/5.0.0": { 654 | "type": "package", 655 | "serviceable": true, 656 | "sha512": "sha512-uwV5hdhWPwUH1szhO8PJpFiahqXmzPzJT/sOijH/kFgUx+cyoDTMM8MHD0adw9+Iem6itoibbUXHYslzXsLEAg==", 657 | "path": "serilog.sinks.file/5.0.0", 658 | "hashPath": "serilog.sinks.file.5.0.0.nupkg.sha512" 659 | }, 660 | "System.Buffers/4.5.1": { 661 | "type": "package", 662 | "serviceable": true, 663 | "sha512": "sha512-Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==", 664 | "path": "system.buffers/4.5.1", 665 | "hashPath": "system.buffers.4.5.1.nupkg.sha512" 666 | }, 667 | "System.Data.DataSetExtensions/4.5.0": { 668 | "type": "package", 669 | "serviceable": true, 670 | "sha512": "sha512-221clPs1445HkTBZPL+K9sDBdJRB8UN8rgjO3ztB0CQ26z//fmJXtlsr6whGatscsKGBrhJl5bwJuKSA8mwFOw==", 671 | "path": "system.data.datasetextensions/4.5.0", 672 | "hashPath": "system.data.datasetextensions.4.5.0.nupkg.sha512" 673 | }, 674 | "System.Diagnostics.DiagnosticSource/8.0.0": { 675 | "type": "package", 676 | "serviceable": true, 677 | "sha512": "sha512-c9xLpVz6PL9lp/djOWtk5KPDZq3cSYpmXoJQY524EOtuFl5z9ZtsotpsyrDW40U1DRnQSYvcPKEUV0X//u6gkQ==", 678 | "path": "system.diagnostics.diagnosticsource/8.0.0", 679 | "hashPath": "system.diagnostics.diagnosticsource.8.0.0.nupkg.sha512" 680 | }, 681 | "System.Diagnostics.EventLog/8.0.0": { 682 | "type": "package", 683 | "serviceable": true, 684 | "sha512": "sha512-fdYxcRjQqTTacKId/2IECojlDSFvp7LP5N78+0z/xH7v/Tuw5ZAxu23Y6PTCRinqyu2ePx+Gn1098NC6jM6d+A==", 685 | "path": "system.diagnostics.eventlog/8.0.0", 686 | "hashPath": "system.diagnostics.eventlog.8.0.0.nupkg.sha512" 687 | }, 688 | "System.Memory/4.5.4": { 689 | "type": "package", 690 | "serviceable": true, 691 | "sha512": "sha512-1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==", 692 | "path": "system.memory/4.5.4", 693 | "hashPath": "system.memory.4.5.4.nupkg.sha512" 694 | }, 695 | "System.Runtime.CompilerServices.Unsafe/6.0.0": { 696 | "type": "package", 697 | "serviceable": true, 698 | "sha512": "sha512-/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==", 699 | "path": "system.runtime.compilerservices.unsafe/6.0.0", 700 | "hashPath": "system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512" 701 | }, 702 | "System.Text.Encodings.Web/6.0.0": { 703 | "type": "package", 704 | "serviceable": true, 705 | "sha512": "sha512-Vg8eB5Tawm1IFqj4TVK1czJX89rhFxJo9ELqc/Eiq0eXy13RK00eubyU6TJE6y+GQXjyV5gSfiewDUZjQgSE0w==", 706 | "path": "system.text.encodings.web/6.0.0", 707 | "hashPath": "system.text.encodings.web.6.0.0.nupkg.sha512" 708 | }, 709 | "System.Text.Json/8.0.5": { 710 | "type": "package", 711 | "serviceable": true, 712 | "sha512": "sha512-0f1B50Ss7rqxXiaBJyzUu9bWFOO2/zSlifZ/UNMdiIpDYe4cY4LQQicP4nirK1OS31I43rn062UIJ1Q9bpmHpg==", 713 | "path": "system.text.json/8.0.5", 714 | "hashPath": "system.text.json.8.0.5.nupkg.sha512" 715 | }, 716 | "Telegram.Bot/22.2.0": { 717 | "type": "package", 718 | "serviceable": true, 719 | "sha512": "sha512-Ff4K8dtREbEGHRN500b/tDPHXouh0d0+X4aZqVyC9So1u66gn7Il6miqBgurDwDASSx10LMN9cJRidwf+fgXoQ==", 720 | "path": "telegram.bot/22.2.0", 721 | "hashPath": "telegram.bot.22.2.0.nupkg.sha512" 722 | } 723 | } 724 | } -------------------------------------------------------------------------------- /Plugin/counterstrikesharp/plugins/Cs2Telegram/Cs2Telegram.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prethink/Cs2Telegram/b1fd6e8b0905236810e0d0cd0ad32654bcb4bedd/Plugin/counterstrikesharp/plugins/Cs2Telegram/Cs2Telegram.dll -------------------------------------------------------------------------------- /Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Authentication.Abstractions.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prethink/Cs2Telegram/b1fd6e8b0905236810e0d0cd0ad32654bcb4bedd/Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Authentication.Abstractions.dll -------------------------------------------------------------------------------- /Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Authentication.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prethink/Cs2Telegram/b1fd6e8b0905236810e0d0cd0ad32654bcb4bedd/Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Authentication.dll -------------------------------------------------------------------------------- /Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Authorization.Policy.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prethink/Cs2Telegram/b1fd6e8b0905236810e0d0cd0ad32654bcb4bedd/Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Authorization.Policy.dll -------------------------------------------------------------------------------- /Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Authorization.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prethink/Cs2Telegram/b1fd6e8b0905236810e0d0cd0ad32654bcb4bedd/Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Authorization.dll -------------------------------------------------------------------------------- /Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Hosting.Abstractions.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prethink/Cs2Telegram/b1fd6e8b0905236810e0d0cd0ad32654bcb4bedd/Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Hosting.Abstractions.dll -------------------------------------------------------------------------------- /Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Http.Abstractions.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prethink/Cs2Telegram/b1fd6e8b0905236810e0d0cd0ad32654bcb4bedd/Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Http.Abstractions.dll -------------------------------------------------------------------------------- /Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Http.Features.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prethink/Cs2Telegram/b1fd6e8b0905236810e0d0cd0ad32654bcb4bedd/Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Http.Features.dll -------------------------------------------------------------------------------- /Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Metadata.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prethink/Cs2Telegram/b1fd6e8b0905236810e0d0cd0ad32654bcb4bedd/Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Metadata.dll -------------------------------------------------------------------------------- /Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Mvc.Abstractions.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prethink/Cs2Telegram/b1fd6e8b0905236810e0d0cd0ad32654bcb4bedd/Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Mvc.Abstractions.dll -------------------------------------------------------------------------------- /Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Mvc.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prethink/Cs2Telegram/b1fd6e8b0905236810e0d0cd0ad32654bcb4bedd/Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Mvc.Core.dll -------------------------------------------------------------------------------- /Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Routing.Abstractions.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prethink/Cs2Telegram/b1fd6e8b0905236810e0d0cd0ad32654bcb4bedd/Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Routing.Abstractions.dll -------------------------------------------------------------------------------- /Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Routing.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prethink/Cs2Telegram/b1fd6e8b0905236810e0d0cd0ad32654bcb4bedd/Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.AspNetCore.Routing.dll -------------------------------------------------------------------------------- /Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.Extensions.ObjectPool.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prethink/Cs2Telegram/b1fd6e8b0905236810e0d0cd0ad32654bcb4bedd/Plugin/counterstrikesharp/plugins/Cs2Telegram/Microsoft.Extensions.ObjectPool.dll -------------------------------------------------------------------------------- /Plugin/counterstrikesharp/plugins/Cs2Telegram/PRTelegramBot.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prethink/Cs2Telegram/b1fd6e8b0905236810e0d0cd0ad32654bcb4bedd/Plugin/counterstrikesharp/plugins/Cs2Telegram/PRTelegramBot.dll -------------------------------------------------------------------------------- /Plugin/counterstrikesharp/plugins/Cs2Telegram/System.IO.Pipelines.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prethink/Cs2Telegram/b1fd6e8b0905236810e0d0cd0ad32654bcb4bedd/Plugin/counterstrikesharp/plugins/Cs2Telegram/System.IO.Pipelines.dll -------------------------------------------------------------------------------- /Plugin/counterstrikesharp/plugins/Cs2Telegram/Telegram.Bot.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prethink/Cs2Telegram/b1fd6e8b0905236810e0d0cd0ad32654bcb4bedd/Plugin/counterstrikesharp/plugins/Cs2Telegram/Telegram.Bot.dll -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Cs2Telegram 2 | 3 | Tested on Windows server 2022 and ubuntu 22. 4 | 5 | # ⚠️ WARNING 6 | *For proper operation, it is required to disable the hibernate mode on the server. To do this, specify __sv_hibernate_when_empty 0__ in the server config.* 7 | 8 | ## Requirements 9 | - [CounterStrikeSharp v1.0.296](https://github.com/roflmuffin/CounterStrikeSharp/tree/main) 10 | - [PRTelegramBot v0.7.6](https://github.com/prethink/PRTelegramBot) 11 | - [Telegram.Bot](https://github.com/TelegramBots/Telegram.Bot) 12 | 13 | 14 | ### Bot Functionality 15 | - WhiteList 16 | - Administrators 17 | - View server status 18 | - View players on the server 19 | - View players info and actions *(Only for admins) 20 | - Send server command *(Only for admins) 21 | - Send server message *(Only for admins) 22 | - Notify admin if player connected to server (setting NotifyAdminOnConnectUser in Cs2Telegram.json) 23 | - Create custom menu with message and web links 24 | - Player can send a message to the administrators of the server on Telegram. 25 | 26 | 27 | ### Bot Commands: 28 | - Status 29 | - Players 30 | - Menu 31 | - Admin menu *(Only for admins) 32 | - Server command *(Only for admins) 33 | * Generate inline menu favorite commands from config Cs2Telegram.json - ServerCommandsMenuItems 34 | - Server message *(Only for admins) 35 | - Players info *(Only for admins) 36 | * Actions with players 37 | 38 | ### Commands in server 39 | !tgreport [message] - Send a message to the administrators of the server on Telegram. 40 | 41 | ### Startup Instructions 42 | 1. Create a new bot on BotFather and obtain the token. [Create Telegram Chatbot](https://sendpulse.com/knowledge-base/chatbot/telegram/create-telegram-chatbot) 43 | 2. Move the "Cs2Telegram" folder into the "plugins" folder. 44 | 3. Open file telegramconfig.json 45 | 4. In the "Token" field, enter the token obtained through BotFather. 46 | 5. Restart server 47 | 48 | If you want the bot to be used only by you, add your Telegram user ID to the "WhiteListUsers" field. [Get my id](https://t.me/getmyid_bot) To add an administrator, use the "Admins" field. 49 | 50 | #### Configuration 51 | path - ..\csgo\addons\counterstrikesharp\configs\plugins\Cs2Telegram\Cs2Telegram.json 52 | 53 | ```json 54 | { 55 | "Token": "", - Key for interacting with the bot. 56 | "Admins": [], - List of administrators. 57 | "WhiteListUsers": [], - List of users who can use the bot. If the value is empty, all users can use the bot. 58 | "ClearUpdatesOnStart": true, - Clears commands that were invoked when the bot was not running. 59 | "BotId": 0, - Unique identifier of the bot. May be required if multiple bots are used in the same application. 60 | "ServerCommandsMenuItems": ["bot_add", "bot_kick"], - List command for inline buttons 61 | "NotifyAdminOnConnectUser": true, - If true notify admins on connect new player on server 62 | "ColumnMainMenu": 2, - Count column in main menu 63 | "CustomCommandsEnabled": true, - enable or no custom commands 64 | "ShowCustomMenu": false, - If true show custom menu 65 | "CustomCommands": { - 66 | "Commands": [ 67 | { 68 | "ButtonName": "Custom Menu", 69 | "Message": "Custom Message", 70 | "AddInMainMenu": true, 71 | "Column": 1, 72 | "WebMenuItems": [ 73 | { 74 | "Name": "Google", 75 | "Url": "Https://google.com" 76 | } 77 | ] 78 | } 79 | ] 80 | }, 81 | "ConfigVersion": 4 82 | } 83 | ``` 84 | 85 | 86 | # The result of the bot's work 87 | 88 | ![BotResult](/doc/BotResult.png) 89 | -------------------------------------------------------------------------------- /Source/Commands/AdminCommands.cs: -------------------------------------------------------------------------------- 1 | using CounterStrikeSharp.API; 2 | using Cs2Telegram.TelegramEvents; 3 | using PRTelegramBot.Attributes; 4 | using PRTelegramBot.Extensions; 5 | using PRTelegramBot.Models; 6 | using Telegram.Bot; 7 | using Telegram.Bot.Types; 8 | 9 | namespace Cs2Telegram.Commands 10 | { 11 | public static class AdminCommands 12 | { 13 | [ReplyMenuHandler(Constants.ADMIN_MENU_BUTTON)] 14 | public static async Task AdminMenu(ITelegramBotClient botClient, Update update) 15 | { 16 | if (!(await botClient.IsAdmin(update.GetChatId()))) 17 | { 18 | await CommonEvents.AccessDenied(botClient, update); 19 | return; 20 | } 21 | 22 | Server.NextFrame(async () => 23 | { 24 | var options = new OptionMessage(); 25 | options.MenuReplyKeyboardMarkup = await botClient.GenerateAdminMenu(update.GetChatId()); 26 | await PRTelegramBot.Helpers.Message.Send(botClient, update, "Admin menu", options); 27 | }); 28 | 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Source/Commands/CommonCommands.cs: -------------------------------------------------------------------------------- 1 | using CounterStrikeSharp.API; 2 | using CounterStrikeSharp.API.Modules.Cvars; 3 | using PRTelegramBot.Attributes; 4 | using PRTelegramBot.Extensions; 5 | using PRTelegramBot.Models; 6 | using System.Net; 7 | using Telegram.Bot; 8 | using Telegram.Bot.Types; 9 | 10 | namespace Cs2Telegram.Commands 11 | { 12 | public static class CommonCommands 13 | { 14 | [ReplyMenuHandler("start")] 15 | [SlashHandler("/start")] 16 | public static async Task Start(ITelegramBotClient botClient, Update update) 17 | { 18 | await Menu(botClient, update); 19 | } 20 | 21 | [ReplyMenuHandler(Constants.MAIN_MENU_BUTTON)] 22 | [SlashHandler(Constants.SLASH_MENU_BUTTON)] 23 | public static async Task Menu(ITelegramBotClient botClient, Update update) 24 | { 25 | 26 | Server.NextFrame(async () => 27 | { 28 | var options = new OptionMessage(); 29 | options.MenuReplyKeyboardMarkup = await botClient.GenerateCommonMenu(update.GetChatId()); 30 | await PRTelegramBot.Helpers.Message.Send(botClient, update, "Main menu", options); 31 | }); 32 | } 33 | 34 | [ReplyMenuHandler(Constants.STATUS_BUTTON)] 35 | public static async Task Status(ITelegramBotClient botClient, Update update) 36 | { 37 | Server.NextFrame(async () => 38 | { 39 | try 40 | { 41 | var botCount = Utilities.GetPlayers().Count(x => x.IsBot); 42 | var userCount = Utilities.GetPlayers().Count(x => !x.IsBot); 43 | var allCount = botCount + userCount; 44 | var maxPlayers = Server.MaxPlayers; 45 | string mapName = Server.MapName; 46 | 47 | var serverTime = Server.EngineTime; 48 | 49 | string hostname = ""; 50 | 51 | var hostnameCvar = ConVar.Find("hostname"); 52 | var gameTypeCvar = ConVar.Find("game_type"); 53 | var gameModeCvar = ConVar.Find("game_mode"); 54 | string gametype = Helper.GetGameModeWithGameType(gameTypeCvar.GetPrimitiveValue(), gameModeCvar.GetPrimitiveValue()); 55 | if (hostnameCvar != null) 56 | { 57 | hostname = hostnameCvar.StringValue; 58 | } 59 | 60 | var msg = $"🌐 Server '{hostname}':\n" + 61 | $"🕹️ Game mode: {gametype}\n" + 62 | $"👨‍👩‍👧‍👦 Players: {allCount}/{maxPlayers}\n" + 63 | $"👦 Humans: {userCount}\n" + 64 | $"🤖 Bots: {botCount}\n" + 65 | $"🗺️ Map: {mapName}\n" + 66 | $"🕛 Server Uptime: {TimeSpan.FromSeconds(serverTime).ToReadableString()} "; 67 | 68 | var options = new OptionMessage(); 69 | options.MenuReplyKeyboardMarkup = await botClient.GenerateCommonMenu(update.GetChatId()); 70 | 71 | await PRTelegramBot.Helpers.Message.Send(botClient, update, msg, options); 72 | } 73 | catch (Exception ex) 74 | { 75 | Console.WriteLine(ex); 76 | } 77 | }); 78 | } 79 | 80 | [ReplyMenuHandler(Constants.PLAYERS_BUTTON)] 81 | public static async Task Players(ITelegramBotClient botClient, Update update) 82 | { 83 | Server.NextFrame(async () => 84 | { 85 | try 86 | { 87 | var players = Utilities.GetPlayers(); 88 | string message = "Players on server:"; 89 | var options = new OptionMessage(); 90 | options.MenuReplyKeyboardMarkup = await botClient.GenerateCommonMenu(update.GetChatId()); 91 | if (players.Count == 0) 92 | { 93 | await PRTelegramBot.Helpers.Message.Send(botClient, update, "No players :(", options); 94 | } 95 | else 96 | { 97 | foreach (var player in players) 98 | { 99 | message += $"\n {(player.IsBot ? "🤖" : "👦")} {WebUtility.HtmlEncode(player.PlayerName)}"; 100 | } 101 | 102 | await PRTelegramBot.Helpers.Message.Send(botClient, update, message, options); 103 | } 104 | } 105 | catch (Exception ex) 106 | { 107 | Console.WriteLine(ex); 108 | } 109 | }); 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /Source/Commands/PlayerCommands.cs: -------------------------------------------------------------------------------- 1 | using CounterStrikeSharp.API; 2 | using Cs2Telegram.Enums; 3 | using Cs2Telegram.TelegramEvents; 4 | using Microsoft.Extensions.Logging; 5 | using PRTelegramBot.Attributes; 6 | using PRTelegramBot.Extensions; 7 | using PRTelegramBot.Interfaces; 8 | using PRTelegramBot.Models; 9 | using PRTelegramBot.Models.CallbackCommands; 10 | using PRTelegramBot.Models.InlineButtons; 11 | using PRTelegramBot.Utils; 12 | using System.Net; 13 | using Telegram.Bot; 14 | using Telegram.Bot.Types; 15 | 16 | namespace Cs2Telegram.Commands 17 | { 18 | public static class PlayerCommands 19 | { 20 | const string PLAYER_NOT_VALID = "Player not found or player is no valid"; 21 | 22 | [ReplyMenuHandler(Constants.SERVER_PLAYERS_INFO_BUTTON)] 23 | [InlineCallbackHandler(HeaderCommand.PlayerInfoList)] 24 | public static async Task PlayersInfo(ITelegramBotClient botClient, Update update) 25 | { 26 | if (!(await botClient.IsAdmin(update.GetChatId()))) 27 | { 28 | await CommonEvents.AccessDenied(botClient, update); 29 | return; 30 | } 31 | 32 | var inlineMenuItems = new List(); 33 | Server.NextFrame(async () => 34 | { 35 | var players = Utilities.GetPlayers(); 36 | foreach (var player in players) 37 | { 38 | var commandItem = new InlineCallback>($"{player.PlayerName}{(player.IsBot ? " [Bot]" : "")}", HeaderCommand.PlayerInfo, new EntityTCommand(player.UserId != null ? player.UserId.Value : -1)); 39 | inlineMenuItems.Add(commandItem); 40 | } 41 | 42 | var options = new OptionMessage(); 43 | string msg = "Players not found"; 44 | if (inlineMenuItems.Count > 0) 45 | { 46 | msg = "Players on server:"; 47 | options.MenuInlineKeyboardMarkup = MenuGenerator.InlineKeyboard(MenuGenerator.InlineButtons(1, inlineMenuItems)); 48 | } 49 | else 50 | { 51 | options.MenuReplyKeyboardMarkup = await botClient.GenerateOnlyMenu(update.GetChatId()); 52 | } 53 | var command = InlineCallback>.GetCommandByCallbackOrNull(update.CallbackQuery?.Data ?? ""); 54 | if (command != null) 55 | { 56 | Helper.EditMessage(botClient, update, msg, options); 57 | } 58 | else 59 | { 60 | Helper.SendMessage(botClient, update, msg, options); 61 | } 62 | 63 | }); 64 | } 65 | 66 | [InlineCallbackHandler(HeaderCommand.PlayerInfo)] 67 | public static async Task PlayerInfoHandler(ITelegramBotClient botClient, Update update) 68 | { 69 | if (!(await botClient.IsAdmin(update.GetChatId()))) 70 | { 71 | await CommonEvents.AccessDenied(botClient, update); 72 | return; 73 | } 74 | 75 | var command = InlineCallback>.GetCommandByCallbackOrNull(update.CallbackQuery.Data); 76 | if (command != null && command.Data.EntityId != -1) 77 | { 78 | Server.NextFrame(() => 79 | { 80 | int userId = command.Data.EntityId; 81 | string msg = PLAYER_NOT_VALID; 82 | var options = new OptionMessage(); 83 | var player = Utilities.GetPlayerFromUserid(userId); 84 | if (player != null && player.IsValid) 85 | { 86 | msg = 87 | $"Player name:{WebUtility.HtmlEncode(player.PlayerName)}\n" + 88 | $"Clan name: {player.ClanName}\n" + 89 | $"Score: {player.Score}\n" + 90 | $"IP: {player.IpAddress ?? ""}\n" + 91 | //$"Time: {TimeSpan.FromSeconds(player.).ToReadableString()}\n" + 92 | $"Ping: {player.Ping}\n" + 93 | $"SteamId: {player.AuthorizedSteamID?.ToString()}\n"; 94 | 95 | //var changeTeamTButton = new InlineCallback($"Team T", HeaderCommand.PlayerChangeTeam, new ChangeTeamPlayerCommand(player.UserId != null ? player.UserId.Value : -1, CsTeam.Terrorist)); 96 | //var changeTeamCTButton = new InlineCallback($"Team CT", HeaderCommand.PlayerChangeTeam, new ChangeTeamPlayerCommand(player.UserId != null ? player.UserId.Value : -1, CsTeam.CounterTerrorist)); 97 | //var changeTeamSpectatorButton = new InlineCallback($"Team Spectator", HeaderCommand.PlayerChangeTeam, new ChangeTeamPlayerCommand(player.UserId != null ? player.UserId.Value : -1, CsTeam.Spectator)); 98 | var kickCommandItem = new InlineCallback>($"Kick", HeaderCommand.PlayerKick, new EntityTCommand(player.UserId != null ? player.UserId.Value : -1)); 99 | var BackCommandItem = new InlineCallback>($"Back", HeaderCommand.PlayerInfoList, new EntityTCommand(-1)); 100 | //var killCommandItem = new InlineCallback>($"Kill", HeaderCommand.PlayerKill, new EntityTCommand(player.UserId != null ? player.UserId.Value : -1)); 101 | var menuTeamButtons = MenuGenerator.InlineButtons(2, new List { kickCommandItem, BackCommandItem }); 102 | var menu = MenuGenerator.InlineKeyboard(menuTeamButtons); 103 | options.MenuInlineKeyboardMarkup = menu; 104 | 105 | } 106 | 107 | Helper.EditMessage(botClient, update, msg, options); 108 | }); 109 | } 110 | } 111 | 112 | [InlineCallbackHandler(HeaderCommand.PlayerKick)] 113 | public static async Task PlayerKickHandler(ITelegramBotClient botClient, Update update) 114 | { 115 | if (!(await botClient.IsAdmin(update.GetChatId()))) 116 | { 117 | await CommonEvents.AccessDenied(botClient, update); 118 | return; 119 | } 120 | 121 | var command = InlineCallback>.GetCommandByCallbackOrNull(update.CallbackQuery.Data); 122 | if (command != null && command.Data.EntityId != -1) 123 | { 124 | Server.NextFrame(() => 125 | { 126 | int userId = command.Data.EntityId; 127 | string msg = PLAYER_NOT_VALID; 128 | var options = new OptionMessage(); 129 | var player = Utilities.GetPlayerFromUserid(userId); 130 | if (player != null && player.IsValid) 131 | { 132 | msg = $"Server kicked {WebUtility.HtmlEncode(player.PlayerName)}"; 133 | Server.ExecuteCommand($"kickid {player.UserId}"); 134 | Cs2TelegramPlugin.Instance.Logger.LogInformation($"TelegramUser [{update.GetInfoUser()}] kicked player '{player.PlayerName}'"); 135 | } 136 | 137 | Helper.EditMessage(botClient, update, msg, options); 138 | }); 139 | } 140 | } 141 | 142 | //[InlineCallbackHandler(HeaderCommand.PlayerKill)] 143 | //public static async Task PlayerKillHandler(ITelegramBotClient botClient, Update update) 144 | //{ 145 | // if (!botClient.IsAdmin(update.GetChatId())) 146 | // { 147 | // await CommonEvents.AccessDenied(botClient, update); 148 | // return; 149 | // } 150 | 151 | // var command = InlineCallback>.GetCommandByCallbackOrNull(update.CallbackQuery.Data); 152 | // if (command != null && command.Data.EntityId != -1) 153 | // { 154 | // Server.NextFrame(() => 155 | // { 156 | // int userId = command.Data.EntityId; 157 | // string msg = PLAYER_NOT_VALID; 158 | // var options = new OptionMessage(); 159 | // var player = Utilities.GetPlayerFromUserid(userId); 160 | // if (player != null && player.IsValid) 161 | // { 162 | // if(player.PawnIsAlive) 163 | // { 164 | // msg = $"Player {player.PlayerName} kill"; 165 | // player.CommitSuicide(false, true); 166 | // } 167 | // else 168 | // { 169 | // msg = $"Player {player.PlayerName} already dead"; 170 | // } 171 | // } 172 | 173 | // Helper.EditMessage(botClient, update, msg, options); 174 | // }); 175 | // } 176 | //} 177 | 178 | 179 | //[InlineCallbackHandler(HeaderCommand.PlayerChangeTeam)] 180 | //public static async Task PlayerChangeTeamHandler(ITelegramBotClient botClient, Update update) 181 | //{ 182 | // if (!botClient.IsAdmin(update.GetChatId())) 183 | // { 184 | // await CommonEvents.AccessDenied(botClient, update); 185 | // return; 186 | // } 187 | 188 | // var command = InlineCallback.GetCommandByCallbackOrNull(update.CallbackQuery.Data); 189 | // if (command != null && command.Data.UserId != -1) 190 | // { 191 | // Server.NextFrame(() => 192 | // { 193 | // int userId = command.Data.UserId; 194 | // string msg = PLAYER_NOT_VALID; 195 | // var options = new OptionMessage(); 196 | // var player = Utilities.GetPlayerFromUserid(userId); 197 | // if (player != null && player.IsValid) 198 | // { 199 | // msg = "ChangeTeam"; 200 | // player.ChangeTeam(CsTeam.CounterTerrorist); 201 | // } 202 | 203 | // Helper.SendMessage(botClient, update, msg, options); 204 | // }); 205 | // } 206 | //} 207 | } 208 | } 209 | -------------------------------------------------------------------------------- /Source/Commands/ServerCommands.cs: -------------------------------------------------------------------------------- 1 | using CounterStrikeSharp.API; 2 | using Cs2Telegram.Enums; 3 | using Cs2Telegram.Models; 4 | using Cs2Telegram.TelegramEvents; 5 | using Microsoft.Extensions.Logging; 6 | using PRTelegramBot.Attributes; 7 | using PRTelegramBot.Extensions; 8 | using PRTelegramBot.Models; 9 | using PRTelegramBot.Models.InlineButtons; 10 | using PRTelegramBot.Utils; 11 | using Telegram.Bot; 12 | using Telegram.Bot.Types; 13 | 14 | namespace Cs2Telegram.Commands 15 | { 16 | public static class ServerCommands 17 | { 18 | const string SERVER_BACK_TO_MENU = $"\n\nIf you want to access the menu, use the command {Constants.SLASH_MENU_BUTTON}"; 19 | const string SERVER_SEND_MSG = $"ℹ️ Write the message you want to send to the server. The message will be displayed to all players in the in-game chat.{SERVER_BACK_TO_MENU}"; 20 | const string SERVER_COMMAND_MSG = $"ℹ️ Write the command you want to execute on the server side.{SERVER_BACK_TO_MENU}"; 21 | 22 | [ReplyMenuHandler(Constants.SERVER_COMMAND_BUTTON)] 23 | public static async Task ExecuteCommandInServer(ITelegramBotClient botClient, Update update) 24 | { 25 | if (!(await botClient.IsAdmin(update.GetChatId()))) 26 | { 27 | await CommonEvents.AccessDenied(botClient, update); 28 | return; 29 | } 30 | 31 | var inlineMenuItems = Helper.GetServerCommandsItems(); 32 | var options = new OptionMessage(); 33 | if (inlineMenuItems.Count > 0) 34 | { 35 | options.MenuInlineKeyboardMarkup = MenuGenerator.InlineKeyboard(MenuGenerator.InlineButtons(1, inlineMenuItems)); 36 | } 37 | else 38 | { 39 | options.MenuReplyKeyboardMarkup = await botClient.GenerateOnlyMenu(update.GetChatId()); 40 | } 41 | 42 | 43 | string msg = SERVER_COMMAND_MSG; 44 | update.RegisterStepHandler(new StepTelegram(ExecuteCommandInServerHandler)); 45 | Helper.SendMessage(botClient, update, msg, options); 46 | } 47 | 48 | [RequiredTypeChat(Telegram.Bot.Types.Enums.ChatType.Private)] 49 | [RequireTypeMessage(Telegram.Bot.Types.Enums.MessageType.Text)] 50 | public static async Task ExecuteCommandInServerHandler(ITelegramBotClient botClient, Update update) 51 | { 52 | string msg = update?.Message?.Text; 53 | if (!string.IsNullOrWhiteSpace(msg)) 54 | { 55 | Server.NextFrame(() => 56 | { 57 | Server.ExecuteCommand(msg); 58 | }); 59 | Cs2TelegramPlugin.Instance.Logger.LogInformation($"TelegramUser [{update.GetInfoUser()}] executed command on server '{msg}'"); 60 | Helper.SendMessage(botClient, update, $"🗯️ Server try execute command: {msg}\n\n{SERVER_BACK_TO_MENU}"); 61 | } 62 | else 63 | { 64 | Helper.SendMessage(botClient, update, $"Error empty message, try again"); 65 | } 66 | } 67 | 68 | [InlineCallbackHandler(HeaderCommand.ExecuteServerCommand)] 69 | public static async Task ExecuteInlineCommandInServerHandler(ITelegramBotClient botClient, Update update) 70 | { 71 | if (!(await botClient.IsAdmin(update.GetChatId()))) 72 | { 73 | await CommonEvents.AccessDenied(botClient, update); 74 | return; 75 | } 76 | 77 | var command = InlineCallback.GetCommandByCallbackOrNull(update.CallbackQuery.Data); 78 | if (command != null) 79 | { 80 | if (!string.IsNullOrWhiteSpace(command.Data.Command)) 81 | { 82 | string serverCommand = command.Data.Command; 83 | Server.NextFrame(() => 84 | { 85 | Server.ExecuteCommand(serverCommand); 86 | }); 87 | Cs2TelegramPlugin.Instance.Logger.LogInformation($"TelegramUser [{update.GetInfoUser()}] executed command on server '{serverCommand}'"); 88 | var inlineMenuItems = Helper.GetServerCommandsItems(); 89 | var options = new OptionMessage(); 90 | if (inlineMenuItems.Count > 0) 91 | { 92 | options.MenuInlineKeyboardMarkup = MenuGenerator.InlineKeyboard(MenuGenerator.InlineButtons(1, inlineMenuItems)); 93 | } 94 | Helper.EditMessage(botClient, update, $"🗯️ Server try execute command: {serverCommand}\n\n{SERVER_COMMAND_MSG}\nGuid:{Guid.NewGuid()}", options); 95 | } 96 | else 97 | { 98 | Helper.EditMessage(botClient, update, $"Error empty message, try again"); 99 | } 100 | } 101 | } 102 | 103 | [ReplyMenuHandler(Constants.SERVER_SEND_MESSAGE_BUTTON)] 104 | public static async Task SendMessageToServer(ITelegramBotClient botClient, Update update) 105 | { 106 | if (!(await botClient.IsAdmin(update.GetChatId()))) 107 | { 108 | await CommonEvents.AccessDenied(botClient, update); 109 | return; 110 | } 111 | 112 | string msg = SERVER_SEND_MSG; 113 | update.RegisterStepHandler(new StepTelegram(SendMessageToServerHandler, null)); 114 | var options = new OptionMessage(); 115 | options.MenuReplyKeyboardMarkup = await botClient.GenerateOnlyMenu(update.GetChatId()); 116 | Helper.SendMessage(botClient, update, msg, options); 117 | } 118 | 119 | [RequiredTypeChat(Telegram.Bot.Types.Enums.ChatType.Private)] 120 | [RequireTypeMessage(Telegram.Bot.Types.Enums.MessageType.Text)] 121 | public static async Task SendMessageToServerHandler(ITelegramBotClient botClient, Update update) 122 | { 123 | string msg = update?.Message?.Text; 124 | if (!string.IsNullOrWhiteSpace(msg)) 125 | { 126 | Server.NextFrame(() => 127 | { 128 | Server.PrintToChatAll(msg); 129 | }); 130 | Cs2TelegramPlugin.Instance.Logger.LogInformation($"TelegramUser [{update.GetInfoUser()}] sended message on server '{msg}'"); 131 | Helper.SendMessage(botClient, update, $"💬 Server send message: {msg}\n\n{SERVER_SEND_MSG}"); 132 | } 133 | else 134 | { 135 | Helper.SendMessage(botClient, update, $"Error empty message, try again"); 136 | } 137 | } 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /Source/Constants.cs: -------------------------------------------------------------------------------- 1 | namespace Cs2Telegram 2 | { 3 | public static class Constants 4 | { 5 | public const string MAIN_MENU_BUTTON = "Menu"; 6 | public const string SLASH_MENU_BUTTON = "/menu"; 7 | 8 | public const string ADMIN_MENU_BUTTON = "Admin menu"; 9 | public const string STATUS_BUTTON = "Status"; 10 | public const string PLAYERS_BUTTON = "Players"; 11 | public const string ACCESS_DENIED_BUTTON = "Access denied"; 12 | 13 | #region AdminMenu 14 | public const string SERVER_COMMAND_BUTTON = "Server command"; 15 | public const string SERVER_SEND_MESSAGE_BUTTON = "Server message"; 16 | public const string SERVER_PLAYERS_INFO_BUTTON = "Players info"; 17 | #endregion 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Source/Cs2Telegram.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | true 8 | true 9 | 0.3.1 10 | 82ddc7a3-6bc5-4bfd-b228-2b410ac8cdf6 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | true 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Source/Cs2TelegramPlugin.cs: -------------------------------------------------------------------------------- 1 | using CounterStrikeSharp.API.Core; 2 | using Cs2Telegram.Enums; 3 | using Cs2Telegram.InlineInstance; 4 | using Cs2Telegram.TelegramEvents; 5 | using Microsoft.Extensions.Logging; 6 | using PRTelegramBot.Core; 7 | 8 | namespace Cs2Telegram; 9 | 10 | public partial class Cs2TelegramPlugin : BasePlugin, IPluginConfig 11 | { 12 | public override string ModuleName => "Cs2Telegram"; 13 | public override string ModuleVersion => "0.3.2"; 14 | public override string ModuleAuthor => "PreThink"; 15 | 16 | private PRBotBase _bot; 17 | 18 | public TelegramCfg Config { get; set; } = new TelegramCfg(); 19 | public static Cs2TelegramPlugin Instance { get; private set; } 20 | 21 | public void OnConfigParsed(TelegramCfg config) 22 | { 23 | if (config.Version < Config.Version) 24 | { 25 | Logger.LogWarning($"" + 26 | $"\nThe version of the configuration file differs from the required configuration!" + 27 | $"\nFile version:{config.Version}" + 28 | $"\nRequired:{Config.Version}"); 29 | } 30 | Config = config; 31 | } 32 | 33 | public Cs2TelegramPlugin() 34 | { 35 | Instance = this; 36 | } 37 | 38 | public override void Load(bool hotReload) 39 | { 40 | _bot = new PRBotBuilder(Config.Token) 41 | .AddUsersWhiteList(Config.WhiteListUsers) 42 | .AddAdmins(Config.Admins) 43 | .SetBotId(Config.BotId) 44 | .SetClearUpdatesOnStart(Config.ClearUpdatesOnStart) 45 | .AddInlineClassHandler(HeaderCommand.ChangeLevel, typeof(ChangeLevel)) 46 | .AddInlineClassHandler(HeaderCommand.WorkshopChangeLevel, typeof(WorkshopChangeLevel)) 47 | .Build(); 48 | 49 | // Subscribe to basic logs 50 | _bot.Events.OnCommonLog += Events_OnCommonLog; ; 51 | // Subscribe to error logs 52 | _bot.Events.OnErrorLog += Events_OnErrorLog; ; 53 | // Start the bot 54 | _bot.Start(); 55 | HandlerInit(_bot); 56 | Helper.RegisterCustomCommands(_bot); 57 | } 58 | 59 | private async Task Events_OnErrorLog(PRTelegramBot.Models.EventsArgs.ErrorLogEventArgs e) 60 | { 61 | Logger.LogError(e.Exception.ToString()); 62 | } 63 | 64 | private async Task Events_OnCommonLog(PRTelegramBot.Models.EventsArgs.CommonLogEventArgs arg) 65 | { 66 | Logger.LogInformation(arg.Message); 67 | } 68 | 69 | void HandlerInit(PRBotBase bot) 70 | { 71 | if (bot.Handler != null) 72 | { 73 | //Обработка не правильный тип сообщений 74 | bot.Events.OnWrongTypeMessage += CommonEvents.WrongMessage; 75 | 76 | //Обработка пропущенной команды 77 | bot.Events.OnMissingCommand += CommonEvents.OnMissingCommand; 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Source/CssCommands.cs: -------------------------------------------------------------------------------- 1 | using CounterStrikeSharp.API; 2 | using CounterStrikeSharp.API.Core; 3 | using CounterStrikeSharp.API.Core.Attributes.Registration; 4 | using CounterStrikeSharp.API.Modules.Commands; 5 | using System.Net; 6 | 7 | namespace Cs2Telegram 8 | { 9 | public partial class Cs2TelegramPlugin : BasePlugin 10 | { 11 | [ConsoleCommand("css_tgreport", "Sends a message to the administrators of the server on Telegram")] 12 | [CommandHelper(minArgs: 1, usage: "[message]", whoCanExecute: CommandUsage.CLIENT_ONLY)] 13 | public void OnReportPlayer(CCSPlayerController? player, CommandInfo commandInfo) 14 | { 15 | var message = commandInfo.GetFullMessage(); 16 | Server.NextFrame(() => 17 | { 18 | message = $"Player: {WebUtility.HtmlEncode(player.PlayerName)}\n" + 19 | $"IP:{player?.IpAddress}\n" + 20 | $"Message: {message}"; 21 | Helper.SendAdminsMessage(_bot.botClient, message); 22 | }); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Source/Enums/HeaderCommand.cs: -------------------------------------------------------------------------------- 1 | using PRTelegramBot.Attributes; 2 | 3 | namespace Cs2Telegram.Enums 4 | { 5 | [InlineCommand] 6 | public enum HeaderCommand 7 | { 8 | SelectMap = 100, 9 | ExecuteServerCommand, 10 | PlayerKick, 11 | PlayerChangeTeam, 12 | PlayerGiveItem, 13 | PlayerSuicide, 14 | PlayerRespawn, 15 | PlayerInfo, 16 | PlayerKill, 17 | PlayerInfoList, 18 | ChangeLevel, 19 | WorkshopChangeLevel 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Source/GameEvents.cs: -------------------------------------------------------------------------------- 1 | using CounterStrikeSharp.API.Core; 2 | using CounterStrikeSharp.API.Core.Attributes.Registration; 3 | using System.Net; 4 | 5 | namespace Cs2Telegram 6 | { 7 | public partial class Cs2TelegramPlugin : BasePlugin 8 | { 9 | [GameEventHandler] 10 | public HookResult OnConnectUser(EventPlayerConnect @event, GameEventInfo info) 11 | { 12 | if(!Config.NotifyAdminOnConnectUser) 13 | return HookResult.Continue; 14 | 15 | if (@event.Bot) 16 | return HookResult.Continue; 17 | 18 | string playerName = @event.Name; 19 | Helper.SendAdminsMessage(_bot.botClient, $"Player {WebUtility.HtmlEncode(playerName)} connected to server"); 20 | 21 | return HookResult.Continue; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Source/Helpers.cs: -------------------------------------------------------------------------------- 1 | using CounterStrikeSharp.API; 2 | using CounterStrikeSharp.API.Modules.Commands; 3 | using Cs2Telegram.Enums; 4 | using Cs2Telegram.Models; 5 | using Microsoft.Extensions.Logging; 6 | using PRTelegramBot.Core; 7 | using PRTelegramBot.Extensions; 8 | using PRTelegramBot.InlineButtons; 9 | using PRTelegramBot.Interfaces; 10 | using PRTelegramBot.Models; 11 | using PRTelegramBot.Models.InlineButtons; 12 | using PRTelegramBot.Models.TCommands; 13 | using PRTelegramBot.Utils; 14 | using Telegram.Bot; 15 | using Telegram.Bot.Types; 16 | using Telegram.Bot.Types.ReplyMarkups; 17 | 18 | namespace Cs2Telegram 19 | { 20 | public static class Helper 21 | { 22 | public static void SendAdminsMessage(ITelegramBotClient botClient, string message, OptionMessage options = null) 23 | { 24 | var admins = Cs2TelegramPlugin.Instance.Config.Admins; 25 | Task task = Task.Run(async () => 26 | { 27 | try 28 | { 29 | foreach (var item in admins) 30 | { 31 | await PRTelegramBot.Helpers.Message.Send(botClient, item, message, options); 32 | } 33 | } 34 | catch (Exception ex) 35 | { 36 | Cs2TelegramPlugin.Instance.Logger.LogError(ex.ToString()); 37 | } 38 | }); 39 | } 40 | 41 | public static void SendMessage(ITelegramBotClient botClient, Update update, string msg, OptionMessage options = null) 42 | { 43 | SendMessage(botClient, update.GetChatId(), msg, options); 44 | } 45 | 46 | public static void SendMessage(ITelegramBotClient botClient, long userId, string msg, OptionMessage options = null) 47 | { 48 | Task task = Task.Run(async () => 49 | { 50 | try 51 | { 52 | var sendMessage = await PRTelegramBot.Helpers.Message.Send(botClient, userId, msg, options); 53 | } 54 | catch (Exception ex) 55 | { 56 | Cs2TelegramPlugin.Instance.Logger.LogError(ex.ToString()); 57 | } 58 | }); 59 | } 60 | 61 | public static void EditMessage(ITelegramBotClient botClient, Update update, string msg, OptionMessage options = null) 62 | { 63 | Task task = Task.Run(async () => 64 | { 65 | try 66 | { 67 | var editMessage = await PRTelegramBot.Helpers.Message.Edit(botClient, update, msg, options); 68 | } 69 | catch (Exception ex) 70 | { 71 | Cs2TelegramPlugin.Instance.Logger.LogError(ex.ToString()); 72 | } 73 | }); 74 | } 75 | 76 | public static string ToReadableString(this TimeSpan span) 77 | { 78 | string formatted = string.Format("{0}{1}{2}{3}", 79 | span.Duration().Days > 0 ? string.Format("{0:0} day{1}, ", span.Days, span.Days == 1 ? string.Empty : "s") : string.Empty, 80 | span.Duration().Hours > 0 ? string.Format("{0:0} hour{1}, ", span.Hours, span.Hours == 1 ? string.Empty : "s") : string.Empty, 81 | span.Duration().Minutes > 0 ? string.Format("{0:0} minute{1}, ", span.Minutes, span.Minutes == 1 ? string.Empty : "s") : string.Empty, 82 | span.Duration().Seconds > 0 ? string.Format("{0:0} second{1}", span.Seconds, span.Seconds == 1 ? string.Empty : "s") : string.Empty); 83 | 84 | if (formatted.EndsWith(", ")) formatted = formatted.Substring(0, formatted.Length - 2); 85 | 86 | if (string.IsNullOrEmpty(formatted)) formatted = "0 seconds"; 87 | 88 | return formatted; 89 | } 90 | 91 | public static async Task GenerateOnlyMenu(this ITelegramBotClient botClient, long userId) 92 | { 93 | var config = Cs2TelegramPlugin.Instance.Config; 94 | var menu = new List(); 95 | if (await botClient.IsAdmin(userId)) 96 | { 97 | menu.Add(Constants.ADMIN_MENU_BUTTON); 98 | } 99 | return MenuGenerator.ReplyKeyboard(config.ColumnMainMenu > 0 ? config.ColumnMainMenu : 1, menu, true, Constants.MAIN_MENU_BUTTON); 100 | } 101 | 102 | public static async Task GenerateCommonMenu(this ITelegramBotClient botClient, long userId) 103 | { 104 | var config = Cs2TelegramPlugin.Instance.Config; 105 | int playersCount = Utilities.GetPlayers().Count; 106 | var menu = new List(); 107 | menu.Add(Constants.STATUS_BUTTON); 108 | menu.Add($"{Constants.PLAYERS_BUTTON} ({playersCount})"); 109 | if (await botClient.IsAdmin(userId)) 110 | { 111 | menu.Add(Constants.ADMIN_MENU_BUTTON); 112 | } 113 | 114 | if (config.CustomCommandsEnabled) 115 | { 116 | if (config.CustomCommands?.Commands?.Count > 0) 117 | { 118 | foreach (var command in config?.CustomCommands?.Commands) 119 | { 120 | if (command.IsValid() && command.AddInMainMenu) 121 | { 122 | menu.Add(command.ButtonName); 123 | } 124 | } 125 | } 126 | } 127 | 128 | return MenuGenerator.ReplyKeyboard(config.ColumnMainMenu > 0 ? config.ColumnMainMenu : 1, menu, true, Constants.MAIN_MENU_BUTTON); 129 | } 130 | 131 | public static List GetServerCommandsItems() 132 | { 133 | var inlineMenuItems = new List(); 134 | var config = Cs2TelegramPlugin.Instance.Config; 135 | if (config.ServerCommandsMenuItems.Count > 0) 136 | { 137 | foreach (var command in config.ServerCommandsMenuItems.Where(command => !string.IsNullOrWhiteSpace(command))) 138 | { 139 | if (IsWorkshopChangeLevelCommand(command, out var level)) 140 | { 141 | RegisterWorkShopChangeLevel(level, ref inlineMenuItems); 142 | continue; 143 | } 144 | 145 | if (IsChangeLevelCommand(command, out level)) 146 | { 147 | RegisterChangeLevel(level, ref inlineMenuItems); 148 | continue; 149 | } 150 | 151 | var commandItem = new InlineCallback(command, HeaderCommand.ExecuteServerCommand, new ServerExecuteTCommand(command)); 152 | inlineMenuItems.Add(commandItem); 153 | } 154 | } 155 | return inlineMenuItems; 156 | } 157 | 158 | public static async Task GenerateAdminMenu(this ITelegramBotClient botClient, long userId) 159 | { 160 | var menu = new List(); 161 | 162 | if (await botClient.IsAdmin(userId)) 163 | { 164 | menu.Add(Constants.SERVER_COMMAND_BUTTON); 165 | menu.Add(Constants.SERVER_SEND_MESSAGE_BUTTON); 166 | menu.Add(Constants.SERVER_PLAYERS_INFO_BUTTON); 167 | } 168 | else 169 | { 170 | menu.Add(Constants.ACCESS_DENIED_BUTTON); 171 | } 172 | 173 | return MenuGenerator.ReplyKeyboard(1, menu, true, Constants.MAIN_MENU_BUTTON); 174 | } 175 | public static string GetGameModeWithGameType(int gametype, int gamemode) 176 | { 177 | // https://developer.valvesoftware.com/wiki/Counter-Strike:_Global_Offensive/Game_Modes 178 | 179 | string[][] games = new string[7][]; 180 | 181 | games[0] = new string[] { "Casual", "Competitive", "Wingman", "Weapons Expert", "Training Day" }; 182 | games[1] = new string[] { "Arms Race", "Demolition", "Deathmatch", }; 183 | games[2] = new string[] { "Training", }; 184 | games[3] = new string[] { "Custom", }; 185 | games[4] = new string[] { "Guardian", "Co-op Strike" }; 186 | games[5] = new string[] { "War Games" }; 187 | games[6] = new string[] { "Danger Zone" }; 188 | 189 | try 190 | { 191 | return games[gametype][gamemode]; 192 | } 193 | catch (Exception ex) 194 | { 195 | return "Unknown game type with game mode"; 196 | } 197 | } 198 | 199 | public static string GetFullMessage(this CommandInfo info) 200 | { 201 | return string.Join(" ", Enumerable.Range(1, info.ArgCount) 202 | .Select(i => info.GetArg(i)) 203 | .Where(arg => !string.IsNullOrWhiteSpace(arg))) ?? "No reason given."; 204 | } 205 | 206 | public static async Task RegisterCustomCommands(PRBotBase bot) 207 | { 208 | var config = Cs2TelegramPlugin.Instance.Config; 209 | var commands = config?.CustomCommands?.Commands; 210 | if (!config.CustomCommandsEnabled) 211 | return; 212 | 213 | if (commands?.Count > 0) 214 | { 215 | foreach (var command in commands) 216 | { 217 | if (command.IsValid()) 218 | { 219 | var method = async (ITelegramBotClient botClient, Update update) => 220 | { 221 | string message = command.Message; 222 | var option = new OptionMessage(); 223 | if (command.WebMenuItems.Count > 0) 224 | { 225 | var inlineMenu = new List(); 226 | foreach (var item in command.WebMenuItems) 227 | { 228 | inlineMenu.Add(new InlineURL(item.Name, item.Url)); 229 | } 230 | 231 | var menuItems = MenuGenerator.InlineButtons(command.Column > 0 ? command.Column : 1, inlineMenu); 232 | var menu = MenuGenerator.InlineKeyboard(menuItems); 233 | option.MenuInlineKeyboardMarkup = menu; 234 | } 235 | SendMessage(botClient, update, message, option); 236 | }; 237 | 238 | 239 | if (command.ButtonName.StartsWith("/")) 240 | { 241 | bot.Register.AddReplyCommand(command.ButtonName, method); 242 | Cs2TelegramPlugin.Instance.Logger.LogInformation($"Register new slash command {command.ButtonName}"); 243 | } 244 | else 245 | { 246 | bot.Register.AddReplyCommand(command.ButtonName, method); 247 | Cs2TelegramPlugin.Instance.Logger.LogInformation($"Register new reply command {command.ButtonName}"); 248 | } 249 | if (command.AddInMainMenu) 250 | { 251 | Cs2TelegramPlugin.Instance.Logger.LogInformation($"Add menu item {command.ButtonName} in main menu"); 252 | } 253 | 254 | 255 | } 256 | } 257 | } 258 | } 259 | 260 | public static void RegisterChangeLevel(string level, ref List list) 261 | { 262 | list.Add(new InlineCallback($"Change {level}", HeaderCommand.ChangeLevel, new StringTCommand(level))); 263 | } 264 | 265 | public static void RegisterWorkShopChangeLevel(string level, ref List list) 266 | { 267 | list.Add(new InlineCallback($"Change {level}", HeaderCommand.WorkshopChangeLevel, new StringTCommand(level))); 268 | } 269 | 270 | public static bool IsChangeLevelCommand(string command, out string level) 271 | { 272 | level = ""; 273 | var isChangeLevel = command.Contains("changelevel", StringComparison.OrdinalIgnoreCase); 274 | if(isChangeLevel) 275 | level = command.Split(' ')[1]; 276 | 277 | return isChangeLevel; 278 | } 279 | 280 | public static bool IsWorkshopChangeLevelCommand(string command, out string level) 281 | { 282 | level = ""; 283 | var isChangeLevel = command.Contains("ds_workshop_changelevel", StringComparison.OrdinalIgnoreCase); 284 | if (isChangeLevel) 285 | level = command.Split(' ')[1]; 286 | 287 | return isChangeLevel; 288 | } 289 | } 290 | } 291 | -------------------------------------------------------------------------------- /Source/InlineInstance/ChangeLevel.cs: -------------------------------------------------------------------------------- 1 | using CounterStrikeSharp.API; 2 | using Microsoft.Extensions.Logging; 3 | using PRTelegramBot.Core; 4 | using PRTelegramBot.Extensions; 5 | using PRTelegramBot.Interfaces; 6 | using PRTelegramBot.Models; 7 | using PRTelegramBot.Models.Enums; 8 | using PRTelegramBot.Models.InlineButtons; 9 | using PRTelegramBot.Models.TCommands; 10 | using PRTelegramBot.Utils; 11 | using Telegram.Bot.Types; 12 | 13 | namespace Cs2Telegram.InlineInstance 14 | { 15 | internal class ChangeLevel : ICallbackQueryCommandHandler 16 | { 17 | public async Task Handle(PRBotBase bot, Update update, CallbackQuery updateType) 18 | { 19 | var levelCommand = InlineCallback.GetCommandByCallbackOrNull(update.CallbackQuery.Data); 20 | if(levelCommand != null) 21 | { 22 | string serverCommand = $"changelevel {levelCommand.Data.StrData}"; 23 | Server.NextFrame(() => 24 | { 25 | Server.ExecuteCommand(serverCommand); 26 | }); 27 | 28 | Cs2TelegramPlugin.Instance.Logger.LogInformation($"TelegramUser [{update.GetInfoUser()}] executed command on server '{serverCommand}'"); 29 | var inlineMenuItems = Helper.GetServerCommandsItems(); 30 | var options = new OptionMessage(); 31 | if (inlineMenuItems.Count > 0) 32 | { 33 | options.MenuInlineKeyboardMarkup = MenuGenerator.InlineKeyboard(MenuGenerator.InlineButtons(1, inlineMenuItems)); 34 | } 35 | Helper.EditMessage(bot.botClient, update, $"🗯️ Server try execute command: {serverCommand}\n\n{serverCommand}\nGuid:{Guid.NewGuid()}", options); 36 | return UpdateResult.Handled; 37 | } 38 | return UpdateResult.Continue; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Source/InlineInstance/WorkshopChangeLevel.cs: -------------------------------------------------------------------------------- 1 | using CounterStrikeSharp.API; 2 | using Microsoft.Extensions.Logging; 3 | using PRTelegramBot.Core; 4 | using PRTelegramBot.Extensions; 5 | using PRTelegramBot.Interfaces; 6 | using PRTelegramBot.Models; 7 | using PRTelegramBot.Models.Enums; 8 | using PRTelegramBot.Models.InlineButtons; 9 | using PRTelegramBot.Models.TCommands; 10 | using PRTelegramBot.Utils; 11 | using Telegram.Bot.Types; 12 | 13 | namespace Cs2Telegram.InlineInstance 14 | { 15 | internal class WorkshopChangeLevel : ICallbackQueryCommandHandler 16 | { 17 | public async Task Handle(PRBotBase bot, Update update, CallbackQuery updateType) 18 | { 19 | var levelCommand = InlineCallback.GetCommandByCallbackOrNull(update.CallbackQuery.Data); 20 | if (levelCommand != null) 21 | { 22 | string serverCommand = $"ds_workshop_changelevel {levelCommand.Data.StrData}"; 23 | Server.NextFrame(() => 24 | { 25 | Server.ExecuteCommand(serverCommand); 26 | }); 27 | 28 | Cs2TelegramPlugin.Instance.Logger.LogInformation($"TelegramUser [{update.GetInfoUser()}] executed command on server '{serverCommand}'"); 29 | var inlineMenuItems = Helper.GetServerCommandsItems(); 30 | var options = new OptionMessage(); 31 | if (inlineMenuItems.Count > 0) 32 | { 33 | options.MenuInlineKeyboardMarkup = MenuGenerator.InlineKeyboard(MenuGenerator.InlineButtons(1, inlineMenuItems)); 34 | } 35 | Helper.EditMessage(bot.botClient, update, $"🗯️ Server try execute command: {serverCommand}\n\n{serverCommand}\nGuid:{Guid.NewGuid()}", options); 36 | return UpdateResult.Handled; 37 | } 38 | return UpdateResult.Continue; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Source/Models/ChangeTeamPlayerCommand.cs: -------------------------------------------------------------------------------- 1 | using CounterStrikeSharp.API.Modules.Utils; 2 | using PRTelegramBot.Models.CallbackCommands; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace Cs2Telegram.Models 6 | { 7 | public class ChangeTeamPlayerCommand : TCommandBase 8 | { 9 | [JsonPropertyName("1")] 10 | public CsTeam Team { get; set; } 11 | 12 | [JsonPropertyName("2")] 13 | public int UserId { get; set; } 14 | 15 | public ChangeTeamPlayerCommand(int userId, CsTeam team) 16 | { 17 | Team = team; 18 | UserId = userId; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Source/Models/CustomCommand.cs: -------------------------------------------------------------------------------- 1 | namespace Cs2Telegram.Models 2 | { 3 | public class CustomCommands 4 | { 5 | public List Commands { get; set; } = new() { new CustomCommand() }; 6 | } 7 | 8 | public class CustomCommand 9 | { 10 | public string ButtonName { get; set; } = "Custom Menu"; 11 | public string Message { get; set; } = "Custom Message"; 12 | public bool AddInMainMenu { get; set; } = false; 13 | public int Column { get; set; } = 1; 14 | public List WebMenuItems { get; set; } = new() { new WebMenuItem {Name = "Google" , Url = "Https://google.com" } }; 15 | public bool IsValid() 16 | { 17 | return !string.IsNullOrWhiteSpace(ButtonName) && !string.IsNullOrWhiteSpace(Message); 18 | } 19 | } 20 | 21 | public class WebMenuItem 22 | { 23 | public string Name { get; set; } 24 | public string Url { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Source/Models/MapTCommand.cs: -------------------------------------------------------------------------------- 1 | using PRTelegramBot.Models.CallbackCommands; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Cs2Telegram.Models 5 | { 6 | public class MapTCommand : TCommandBase 7 | { 8 | [JsonPropertyName("1")] 9 | public string MapName { get; set; } 10 | 11 | public MapTCommand(string mapName) 12 | { 13 | MapName = mapName; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Source/Models/ServerExecuteTCommand.cs: -------------------------------------------------------------------------------- 1 | using PRTelegramBot.Models.CallbackCommands; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace Cs2Telegram.Models 5 | { 6 | internal class ServerExecuteTCommand : TCommandBase 7 | { 8 | [JsonPropertyName("1")] 9 | public string Command { get; set; } 10 | 11 | public ServerExecuteTCommand(string command) 12 | { 13 | Command = command; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Source/TelegramCfg.cs: -------------------------------------------------------------------------------- 1 | using CounterStrikeSharp.API.Core; 2 | using Cs2Telegram.Models; 3 | using System.Text.Json.Serialization; 4 | 5 | namespace Cs2Telegram 6 | { 7 | public class TelegramCfg : BasePluginConfig 8 | { 9 | /// 10 | /// 11 | /// 12 | [JsonPropertyName("Token")] public string Token { get; set; } = ""; 13 | 14 | /// 15 | /// 16 | /// 17 | [JsonPropertyName("Admins")] public List Admins { get; set; } = new List(); 18 | 19 | /// 20 | /// 21 | /// 22 | [JsonPropertyName("WhiteListUsers")] public List WhiteListUsers { get; set; } = new List(); 23 | /// 24 | /// 25 | /// 26 | [JsonPropertyName("ClearUpdatesOnStart")] public bool ClearUpdatesOnStart { get; set; } = true; 27 | /// 28 | /// 29 | /// 30 | [JsonPropertyName("BotId")] public int BotId { get; set; } = 0; 31 | /// 32 | /// 33 | /// 34 | [JsonPropertyName("ServerCommandsMenuItems")] public List ServerCommandsMenuItems { get; set; } = new List() { "bot_add", "bot_kick" }; 35 | 36 | /// 37 | /// 38 | /// 39 | [JsonPropertyName("NotifyAdminOnConnectUser")] public bool NotifyAdminOnConnectUser { get; set; } = true; 40 | 41 | /// 42 | /// 43 | /// 44 | [JsonPropertyName("ColumnMainMenu")] public int ColumnMainMenu { get; set; } = 1; 45 | 46 | /// 47 | /// 48 | /// 49 | [JsonPropertyName("CustomCommandsEnabled")] public bool CustomCommandsEnabled { get; set; } = false; 50 | 51 | /// 52 | /// 53 | /// 54 | [JsonPropertyName("CustomCommands")] public CustomCommands CustomCommands { get; set; } = new CustomCommands(); 55 | 56 | /// 57 | /// 58 | /// 59 | [JsonPropertyName("ConfigVersion")] public override int Version { get; set; } = 4; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Source/TelegramEvents/CommonEvents.cs: -------------------------------------------------------------------------------- 1 | using CounterStrikeSharp.API; 2 | using PRTelegramBot.Extensions; 3 | using PRTelegramBot.Models; 4 | using Telegram.Bot; 5 | using Telegram.Bot.Types; 6 | 7 | namespace Cs2Telegram.TelegramEvents 8 | { 9 | public static class CommonEvents 10 | { 11 | public static async Task AccessDenied(ITelegramBotClient botClient, Update update) 12 | { 13 | string msg = "Access denied"; 14 | Helper.SendMessage(botClient, update.GetChatId(), msg); 15 | } 16 | 17 | public static async Task WrongMessage(PRTelegramBot.Models.EventsArgs.BotEventArgs arg) 18 | { 19 | string msg = "Wrong Message"; 20 | Helper.SendMessage(arg.BotClient, arg.Update.GetChatId(), msg); 21 | } 22 | 23 | public static async Task OnMissingCommand(PRTelegramBot.Models.EventsArgs.BotEventArgs arg) 24 | { 25 | Server.NextFrame(async () => 26 | { 27 | string msg = "Missing Command"; 28 | var options = new OptionMessage(); 29 | options.MenuReplyKeyboardMarkup = await arg.BotClient.GenerateCommonMenu(arg.Update.GetChatId()); 30 | Helper.SendMessage(arg.BotClient, arg.Update.GetChatId(), msg, options); 31 | }); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /doc/BotResult.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prethink/Cs2Telegram/b1fd6e8b0905236810e0d0cd0ad32654bcb4bedd/doc/BotResult.png --------------------------------------------------------------------------------