a dota2 api for getting dota2 player/match information.(some steam api also implemented.)
Use go get -u github.com/Katsusan/go-dota2
to get or update it.
Here is the example to get dota2 match history by match id.
package main
import (
"fmt"
dota2api "github.com/Katsusan/go-dota2"
)
func main() {
dapi := dota2api.NewApi(nil)
dapi.SetApiKey("AAFB3717E64F8A3C51200A3F7F7988F8") // 这里替换为自己申请的apikey
matchdetail, err := dapi.GetMatchDetails("4080856812") //以TI8决赛第五场为例
if err != nil {
//....
}
fmt.Println("天辉队伍:",matchdetail.RadiantName) //PSG.LGD
fmt.Println("夜魇队伍:",matchdetail.DireName) //OG
fmt.Println("比赛时长(s):",matchdetail.Duration) //2188
fmt.Println("一血时间(s):",matchdetail.FirstBloodTime) //153
}
-
GetMatchHistory(根据指定账号ID获取历史比赛)
- Status (状态码,意义未知)
- ResultNum (本次响应中的比赛数量)
- TotalNum (单次查询的总比赛数)
- RemainNum (后续查询会返回的比赛数)
- Matches (简易比赛信息,参照MatchInfo)
- MatchID (比赛ID)
- StartTime (开始时间)
- LobbyType (比赛类型)
- RadiantTeamID (天辉队伍ID)
- DireTeamID (夜魇队伍ID)
- Player (选手信息)
- AccountID (dota2账号ID)
- PlayerSlot (选手游戏里的位置)
- HeroID (英雄ID)
-
GetMatchDetails(根据指定比赛ID获取比赛详细信息)
- MatchID (比赛ID)
- MatchSeqNum (比赛记录的位置)
- RadiantWin (天辉赢为True,否则为False)
- PreGameDuration
- Duration (比赛时长)
- StartTime (比赛开始时间)
- FirstBloodTime (一血时间)
- HumanPlayers (人类玩家数量)
- LeagueID (联赛ID)
- PostiveVotes (点赞数)
- NegativeVotes (反对数)
- GameMode (比赛模式)
- LobbyType (比赛类型)
- RadiantCaptain (天辉队长账号ID)
- DireCaptain (夜魇队长账号ID)
- TowerStatusRadiant (天辉防御塔状况)
- TowerStatusDire (夜魇防御塔状况)
- BarracksStatusRadiant (天辉兵营状况)
- BarracksStatusDire (夜魇兵营状况)
- Cluster (比赛所在的服务器集群,用于获取录像)
- Engine
- PickBans (BP一览)
- Players (选手一览)
- RadiantTeamID (天辉队伍ID)
- DireTeamID (夜魇队伍ID)
- RadiantTeamComplete
- DireTeamComplete
- DireName (夜魇队伍名)
- RadiantName (天辉队伍名)
- Flags
- RadiantScore (天辉评分)
- DireScore (夜魇评分)
- DireLogo (夜魇队伍logo地址)
- RadiantLogo (天辉队伍logo地址)
-
GetLeagueListing(获取联赛一览)
- Leagues (联赛列表)
- Name (联赛名称)
- LeagueID (联赛ID)
- Description (联赛描述)
- TournamentURL (联赛URL)
- ItemDef (联赛相关的物品ID)
- Leagues (联赛列表)
-
GetPlayerSummaries(获取选手信息一览)
- PlayerSummary (选手概要)
- SteamID (选手steam ID)
- CommunityVisibilityState (社区个人信息是否对他人可见)
- ProfileState (个人档案状态)
- PersonaName (昵称)
- LastLogoff (自从上次下线steam后所经历的时间)
- ProfileURL (个人档案URL)
- Avatar (头像图片URL)
- AvatarMedium (头像(中)图片URL)
- AvatarFull (头像(大)图片URL)
- PersonaState (在线状态,0->Offline, 1->Online, 2->Busy, 3->Away, 4->Snooze, 5->Looking to trade, 6->Looking to play)
- PrimaryClanID ()
- TimeCreated (个人档案创建时间)
- PersonaStateFlags (个人状态flag)
- PlayerSummary (选手概要)
-
GetLiveLeagueGames(获取进行中的比赛信息)
- Status (状态码)
- Leagues (联赛列表)
- Players (选手列表)
- AccountID (选手账号ID)
- Name (选手昵称)
- HeroID (选手操控的英雄ID)
- Team (队伍名)
- RadiantTeam (天辉队伍)
- TeamName (天辉队伍名)
- TeamID (天辉队伍ID)
- TeamLogo (天辉队伍Logo的URL)
- Complete (天辉队伍是否有人断开连接)
- DireTeam (夜魇队伍)
- TeamName (夜魇队伍名)
- TeamID (夜魇队伍ID)
- TeamLogo (夜魇队伍Logo的URL)
- Complete (夜魇队伍是否有人断开连接)
- LobbyID
- MatchID (比赛类别ID)
- Spectators (观战人数)
- LeagueID (联赛ID)
- LeagueNodeID (联赛所在节点的ID)
- StreamDelaySec (直播流延迟秒数)
- RadiantSeriesWins
- DireSeriesWins
- SeriesType (系列赛类别)
- ScoreBoard (得分板)
- Duration (比赛用时)
- RoshanRespawnTimer (肉山重生倒计时)
- Radiant (天辉队伍统计资料, ->和下面的Dire结构一样)
- Dire
- Score (队伍得分)
- TowerState (防御塔状况)
- BarracksState (兵营状况)
- Picks (被BAN英雄列表)
- HeroID (英雄ID)
- Bans (被PICK英雄列表)
- HeroID (英雄ID)
- Players (选手列表)
- PlayerSlot (选手操控的英雄在团队中的位置)
- AccountID (账号ID)
- HeroID (英雄ID)
- Kills (击杀)
- Death (死亡)
- Assists (助攻)
- LastHits (正补)
- Denies (反补)
- Gold (当前金钱)
- Level (当前等级)
- GoldPerMin (当前每分钟金钱)
- XpPerMin (当前每分钟经验)
- UltimateState (终极技能状态)
- UltimateCoolDown (终极技能冷却)
- Item0 (物品栏0)
- Item1 (物品栏1)
- Item2 (物品栏2)
- Item3 (物品栏3)
- Item4 (物品栏4)
- Item5 (物品栏5)
- RespawnTimer (复活倒计时)
- PositionX (选手所操控英雄在地图上的X坐标)
- PositionY (选手所操控英雄在地图上的Y坐标)
- NetWorth (净资产)
- Players (选手列表)
-
GetFriendList (获取steam好友列表)
- Friends (好友列表)
- SteamID (此人的steam ID)
- RelationShip (与此人的关系)
- FriendSince (建立关系的时候的unix时间戳)
- Friends (好友列表)
-
GetServerInfo (获取服务器时间信息)
- ServerTime (服务器时间的Unix时间戳)
- ServerTimeString (服务器时间的字符串形式)