Browse Source

fix bots handle_info send_message

Maxim Sokhatsky 11 years ago
parent
commit
5fcab1ada5

+ 2 - 1
apps/server/src/okey/game_okey_bot.erl

@@ -104,7 +104,8 @@ handle_info({'DOWN', Ref, process, _, Reason},
     ?INFO
     ?INFO
     ("relay goes down with reason ~p so does bot", [Reason]),
     ("relay goes down with reason ~p so does bot", [Reason]),
     {stop, Reason, State};
     {stop, Reason, State};
-handle_info({send_message,M}, State) ->
+handle_info({send_message,M}, #state{uid = UId, bot = BPid} = State) ->
+    BPid ! M,
     {noreply, State};
     {noreply, State};
 handle_info(Info, State) ->
 handle_info(Info, State) ->
     {stop, {unrecognized_info, Info}, State}.
     {stop, {unrecognized_info, Info}, State}.

+ 2 - 0
apps/server/src/tavla/game_tavla_bot.erl

@@ -112,6 +112,8 @@ handle_info({'DOWN', Ref, process, _, Reason}, State = #state{owner_mon = OMon})
     ?INFO("relay goes down with reason ~p so does bot", [Reason]),
     ?INFO("relay goes down with reason ~p so does bot", [Reason]),
     {stop, Reason, State};
     {stop, Reason, State};
 handle_info({send_message,M}, State) ->
 handle_info({send_message,M}, State) ->
+    BPid = State#state.bot,
+    BPid ! M,
     {noreply, State};
     {noreply, State};
 handle_info(Info, State) ->
 handle_info(Info, State) ->
     {stop, {unrecognized_info, Info}, State}.
     {stop, {unrecognized_info, Info}, State}.