DragonDice

Check-in [e9bc359947]
Login

Check-in [e9bc359947]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Corrected command recognition pattern
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e9bc359947c21b4529b6461d22106ac25da9ab41518106434683434a4b1f743d
User & Date: murphy 2020-04-29 11:51:44.000
Context
2020-05-01
18:06
Additional race (and language) options from Ixalan and Arkadia check-in: 350b0e4e3f user: murphy tags: trunk
2020-04-29
11:51
Corrected command recognition pattern check-in: e9bc359947 user: murphy tags: trunk
09:34
Frontend tweaks, split help text into multiple topics rather than bombarding the user with messages check-in: 76166a5ce7 user: murphy tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to DragonDice.Bot/Worker.fs.
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
open Telegram.Bot.Types.Enums
open Telegram.Bot.Types.ReplyMarkups

/// Service worker implementing the interface between Telegram and the backend sessions.
type Worker(environment:IHostEnvironment, config:IConfiguration, logger:ILogger<Worker>) =
  inherit BackgroundService()
  
  static let CommandPattern = Regex(@"^\s*((/\S+)(?:@(\w+))?)(?:\s+(.+))?\s*$", RegexOptions.CultureInvariant)
  static let SeparatorPattern = Regex(@"\s*,\s*", RegexOptions.CultureInvariant)
  static let splitCommand (me:User) (cmd:string) =
    let cmd, args =
      let it = CommandPattern.Match(cmd)
      if it.Success then
        if it.Groups.[3].Success && it.Groups.[3].Value = me.Username then
          it.Groups.[2].Value, it.Groups.[4].Value







|







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
open Telegram.Bot.Types.Enums
open Telegram.Bot.Types.ReplyMarkups

/// Service worker implementing the interface between Telegram and the backend sessions.
type Worker(environment:IHostEnvironment, config:IConfiguration, logger:ILogger<Worker>) =
  inherit BackgroundService()
  
  static let CommandPattern = Regex(@"^\s*((/[^@\s]+)(?:@(\S+))?)(?:\s+(.+))?\s*$", RegexOptions.CultureInvariant)
  static let SeparatorPattern = Regex(@"\s*,\s*", RegexOptions.CultureInvariant)
  static let splitCommand (me:User) (cmd:string) =
    let cmd, args =
      let it = CommandPattern.Match(cmd)
      if it.Success then
        if it.Groups.[3].Success && it.Groups.[3].Value = me.Username then
          it.Groups.[2].Value, it.Groups.[4].Value