| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
function gh_handle_game_userjoin(game, account) |
| 10 |
|
| 11 |
if not gh_is_bot(game.owner) then return end |
| 12 |
|
| 13 |
|
| 14 |
gh_set_silentflag(account.name) |
| 15 |
|
| 16 |
local botaccount = api.account_get_by_name(game.owner) |
| 17 |
|
| 18 |
command_ping(botaccount, "/ping") |
| 19 |
|
| 20 |
if (config.ghost_dota_server) then |
| 21 |
|
| 22 |
local owner = gh_find_userbot_by_game(game.name) |
| 23 |
|
| 24 |
if string:empty(gh_get_userbot_gametype(owner)) then return end |
| 25 |
|
| 26 |
|
| 27 |
for u in string.split(game.players, ",") do |
| 28 |
|
| 29 |
local useracc = api.account_get_by_name(u) |
| 30 |
command_stats(useracc, "/stats " .. account.name) |
| 31 |
|
| 32 |
|
| 33 |
command_stats(account, "/stats " .. u) |
| 34 |
end |
| 35 |
api.message_send_text(account.name, message_type_info, nil, localize(account.name, "Joined ladder game. Game owner: {}", owner)) |
| 36 |
end |
| 37 |
end |
| 38 |
|
| 39 |
function gh_handle_user_login(account) |
| 40 |
if gh_is_bot(account.name) then |
| 41 |
|
| 42 |
gh_message_send(account.name, "/pvpgn init"); |
| 43 |
DEBUG("init bot " .. account.name) |
| 44 |
end |
| 45 |
end |