public void ProcessGroupMessage(GroupMessageReceivedContext context) { const string joinGameCmd = "/gj"; PlayGround game; if (context.Message == joinGameCmd) { game = GomokuFactory.GetOrCreatePlayGround(context.FromGroup); PlayerJoinGame(game, context); } else if (GomokuFactory.TryGetPlayGround(context.FromGroup, out game)) { CommandFactory.Process(new CommandContext(context.FromQq, context.FromGroup, context.Message, CommandFactory.GomokuCommandsNs), game); } }
public void Handle(CommandContext context, ForceEndGomokuCommand command, params object[] handleObjects) { var mahuaApi = CommandFactory.GetMahuaApi(); if (long.TryParse(command.Transform(context.Message).ToList()[0], out var group)) { GomokuFactory.TryGetPlayGround(group.ToString(), out var game); if (game != null) { mahuaApi.SendGroupMessage(context.FromGroup, $"成功结束游戏: {game.GameId}"); game.Dispose(); return; } mahuaApi.SendGroupMessage(context.FromGroup, "参数错误或者该群暂时没有游戏实例正在进行"); } }