Skip to content

Commit

Permalink
feat: add floor ticker price arrows
Browse files Browse the repository at this point in the history
This commit adds the arrows option to the floor ticker. This option can
e used to display price diretion arrows with the price.
  • Loading branch information
rickstaa committed Dec 5, 2022
1 parent ab70568 commit e7c9731
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ Track the floor price of an NFT collection on OpenSea, Solanart, Solsea or Magic
"marketplace": "opensea", # string: one of: opensea, solanart, solsea or magiceden
"name": "ethereum", # string: collection name/id from source
"color": true, # bool/OPTIONAL: requires nickname
"arrows": true, # bool/OPTIONAL: add price arrows
"activity": "Hello;Its;Me", # string/OPTIONAL: list of strings to show in activity section
"nickname": true, # bool/OPTIONAL: display information in nickname vs activity
"activity": "Hello;Its;Me", # string/OPTIONAL: list of strings to show in activity section
Expand Down
12 changes: 11 additions & 1 deletion floor.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type Floor struct {
Activity string `json:"activity"`
Frequency int `json:"frequency"`
Color bool `json:"color"`
Arrows bool `json:"arrows"`
Activity string `json:"activity"`
ClientID string `json:"client_id"`
Token string `json:"discord_bot_token"`
Expand Down Expand Up @@ -122,12 +123,21 @@ func (f *Floor) watchFloorPrice() {
increase = false
}

// Add arrows to price if requested
var decorator string
if f.Arrows {
decorator = "⬊"
if increase {
decorator = "⬈"
}
}

// change nickname
if f.Nickname {

for _, gu := range guilds {

err = dg.GuildMemberNickname(gu.ID, "@me", price)
err = dg.GuildMemberNickname(gu.ID, "@me", fmt.Sprintf("%s %s", decorator, price))
if err != nil {
logger.Errorf("Error updating nickname: %s\n", err)
continue
Expand Down

0 comments on commit e7c9731

Please sign in to comment.