Documentation ¶
Index ¶
- Constants
- type AddFriendResponse
- type AuthorizeRequest
- type ChatMessageRequest
- type ChatType
- type Client
- func (c *Client) AddFriend(username string) error
- func (c *Client) Close() error
- func (c *Client) Connect(boardId int) error
- func (c *Client) GetUser(username string) (*User, error)
- func (c *Client) JoinGuild(id string) error
- func (c *Client) OnChatMessage(fn func(*Client, *Message))
- func (c *Client) OnPixelPlaced(fn func(*Client, *Placed))
- func (c *Client) OnPlayerJoin(fn func(*Client, *Player))
- func (c *Client) OnPlayerLeave(fn func(*Client, *Player))
- func (c *Client) PlacePixel(x, y, color int) error
- func (c *Client) RemoveFriend(username string) error
- func (c *Client) SendChatMessage(content string, chat ChatType, color int) error
- type FormatData
- type GetPaintingResponse
- type Message
- type Placed
- type Player
- type User
- type UserResponse
Constants ¶
View Source
const ( WebsocketEndpoint = "wss://pixelplace.io/socket.io/?EIO=3&transport=websocket" GetUserEndpoint = "https://pixelplace.io/api/get-user.php?username=" FriendEndpoint = "https://pixelplace.io/api/post-friend.php" GetPaintingEndpoint = "https://pixelplace.io/api/get-painting.php?connected=1&id=" JoinGuildEndpoint = "https://pixelplace.io/api/post-guild-access.php" BaseEndpoint = "https://pixelplace.io" )
View Source
const ( PlacePixelEvent string = "p" PingAliveEvent string = "ping.alive" PongAliveEvent string = "pong.alive" SendChatMessageEvent string = "chat.message" AuthorizeEvent string = "init" ChatMessageLoadedEvent string = "chat.user.message" PlayerJoinEvent string = "j" PlayerLeaveEvent string = "l" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddFriendResponse ¶
type AddFriendResponse struct {
Changed int `json:"changed"`
}
type AuthorizeRequest ¶
type ChatMessageRequest ¶
type Client ¶
type Client struct { Painting struct { Id int Name string Description string Rules string Width int Height int Owner struct { Id int Username string } Moderators []string CreatedAt time.Time DiscordRequired bool Pixels int64 BrushSize int Cooldown int } User struct { Id int Username string AuthId string AuthKey string AuthToken string Premium bool Staff bool ChatMod bool Friends []string Blocked []string HasEmail bool Coins int } PlacingInterval time.Duration // contains filtered or unexported fields }
func (*Client) OnChatMessage ¶
func (*Client) OnPixelPlaced ¶
func (*Client) OnPlayerJoin ¶
func (*Client) OnPlayerLeave ¶
func (*Client) PlacePixel ¶
PlacePixel places a pixel on the current painting.
func (*Client) RemoveFriend ¶
RemoveFriend removes the user to the friend list.
type FormatData ¶
type GetPaintingResponse ¶
type GetPaintingResponse struct { Painting struct { ID int `json:"id"` Name string `json:"name"` Description string `json:"description"` Rules string `json:"rules"` Width int `json:"width"` Height int `json:"height"` Cooldown int `json:"cooldown"` Owner struct { ID int `json:"id"` Username string `json:"name"` } `json:"owner"` Moderators []string `json:"moderators"` CreatedAt string `json:"createdAt"` DiscordRequired bool `json:"discordRequired"` Pixels int64 `json:"pixels"` Brush struct { Size int `json:"size"` } `json:"brush"` } `json:"painting"` User struct { ID int `json:"id"` Name string `json:"name"` Key string `json:"key"` Coins int `json:"ppcoins"` Premium struct { Active bool `json:"active"` } `json:"premium"` IsStaff bool `json:"isStaff"` IsChatMod bool `json:"isChatMod"` Friends []string `json:"friends"` Blocked []string `json:"blocked"` HasEmail bool `json:"hasEmail"` } `json:"user"` }
type Message ¶
type Message struct { Username string `json:"username"` Color int `json:"color"` Guild string `json:"guild"` Message string `json:"message"` Admin bool `json:"admin"` Mod bool `json:"mod"` Chatmod bool `json:"chatmod"` Premium bool `json:"premium"` Rainbow bool `json:"rainbow"` Channel string `json:"channel"` Mention string `json:"mention"` Target string `json:"target"` Type string `json:"type"` CreatedAt time.Time `json:"createdAt"` }
type UserResponse ¶
type UserResponse struct { Username string `json:"username"` Followers int `json:"followers"` Bio string `json:"bio"` CreatedAt string `json:"createdAt"` LastLogin string `json:"lastLogin"` Pixels int `json:"pixels"` Admin int `json:"admin"` Mod int `json:"mod"` Chatmod int `json:"chatmod"` Guild string `json:"guild"` Vip int `json:"vip"` BanReason string `json:"banReason"` Social []string `json:"social"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.