Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions device/device_detection.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ type Device struct {
}

type deviceInfo struct {
UserAgent struct {
Name string `json:"name"`
Major string `json:"major"`
Minor string `json:"minor"`
Patch string `json:"patch"`
BotName string `json:"bot_name"`
IsBot bool `json:"is_bot"`
IsDownloader bool `json:"is_downloader"`
IsFeedreader bool `json:"is_feedreader"`
Identified bool `json:"identified"`
} `json:"user_agent"`

Device struct {
Name string `json:"name"`
Brand string `json:"brand"`
Expand Down Expand Up @@ -140,3 +152,8 @@ func (d *Device) IsDesktop() bool {
func (d *Device) IsTouchscreen() bool {
return d.info.Device.IsTouchscreen
}

// IsBot returns true if the client device is a bot
func (d *Device) IsBot() bool {
return d.info.UserAgent.IsBot
}