ShahriyarGilani/SinusBot-Crypto-Price-Updater
A SinusBot plugin to display real-time cryptocurrency prices in TeamSpeak channels.
Crypto Price Channel Updater for SinusBot
A powerful and customizable SinusBot plugin to display real-time cryptocurrency prices directly in your TeamSpeak channel names and/or descriptions. Keep your community updated with the latest market data, focusing on the top 10 cryptocurrencies by market capitalization.
Table of Contents
- Features
- Compatibility
- Installation
- Configuration
- Usage
- Troubleshooting
- Contributing
- Support
- License
- Acknowledgements
Features
- Real-time Price Updates: Fetches cryptocurrency data from the CoinGecko API.
- Focus on Top 10: Always displays the top 10 cryptocurrencies by market capitalization.
- Customizable Channel Name:
- Option to keep the channel name static (unchanged by the plugin).
- If dynamic, can display custom selected coins or the top 10 from the fetched list.
- Prices in channel names are rounded for conciseness (e.g., "$12.3k" for $12,345).
- Supports custom
[cspacer]tags.
- Detailed Channel Description:
- Optionally updates the channel description with comprehensive data for the top 10 coins.
- Includes price change (24h) with color coding (green for gainers, red for losers).
- Displays 24h high/low, All-Time High (ATH), and ATH change percentage.
- Supports various placeholders for flexible formatting.
- Multiple Currencies: Choose between USD, EUR, JPY, and GBP.
- Configurable Update Interval: Set how often the prices are refreshed.
- Local Time Display: Last update time shown based on your SinusBot server's local time.
Compatibility
This plugin has been tested and confirmed to work flawlessly with SinusBot version 1.0.0-beta.16-ba60e37. While it should generally function on other versions, due to the nature of SinusBot's development, there's a possibility of conflicts or unexpected behavior with different releases. If you encounter any issues on a different version, please let me know by opening an issue on GitHub.
Installation
Follow these steps to install this plugin on your SinusBot instance:
-
Download the plugin file:
- Go to the Releases page of this GitHub repository.
- Download the latest version of the
crypto_price_channel_updater.jsfile.
-
Upload to SinusBot:
- Navigate to your SinusBot web management panel (usually on port
8087). - Log in.
- Go to the "Scripts" section.
- Click the "Upload" button and select the
crypto_price_channel_updater.jsfile you downloaded.
- Navigate to your SinusBot web management panel (usually on port
-
Activate and Configure:
- After successful upload, the "Crypto Price Channel Updater" plugin will appear in your scripts list.
- Make sure the checkbox next to it is ticked to enable it.
- Click on the gear icon (โ๏ธ) next to the plugin name to enter its configuration settings.
Configuration
In the plugin settings section, you can customize how it operates:
Plugin Settings Explained
- Target Channel: The TeamSpeak channel whose name and/or description will be updated. Select the desired channel from the dropdown list.
- Spacer Tag (for Name): (Optional) A
[cspacerX]tag to add spacing to the channel name. E.g., enter[cspacer800]. - Display Currency: The fiat currency in which prices will be displayed (USD, EUR, JPY, GBP).
- Leave Channel Name Static (Do not update name)?:
- If checked, the plugin will NOT change the channel name. It will only update the channel description (if
Update Channel Descriptionis enabled). In this mode, "Custom Coin IDs", "Channel Name Format", and "Name Separator" are ignored for channel naming. - If unchecked, the plugin will update the channel name dynamically based on the top 10 market cap coins (or custom coins if specified) and the
Channel Name Format.
- If checked, the plugin will NOT change the channel name. It will only update the channel description (if
- Custom Coin IDs (Comma-separated, e.g., bitcoin,ethereum,solana):
- A comma-separated list of cryptocurrency IDs (e.g.,
bitcoin,ethereum,solana). You can find coin IDs from the CoinGecko URL (e.g.,coingecko.com/en/coins/bitcoin). - This field is only used if "Leave Channel Name Static?" is unchecked.
- A comma-separated list of cryptocurrency IDs (e.g.,
- Channel Name Format: The template for displaying each cryptocurrency's price in the channel name.
- Default:
{CRYPTO}: ${PRICE} {CRYPTO}: Cryptocurrency symbol (e.g., BTC, ETH).{PRICE}: Formatted price of the cryptocurrency (compacted for channel name).
- Default:
- Name Separator: The character(s) used to separate different cryptocurrency prices in the channel name.
- Default:
|
- Default:
- Update Channel Description?: If checked (default), the channel description will be updated with a more detailed list of prices. If unchecked, the description will not be touched by the plugin.
- Main Description Template: The overall template for the channel description.
- Default:
[center][size=16][color=#6633cc][b]๐ Crypto Market Overview ๐[/b][/color][/size] [size=8][color=gray]Last Update: %datetime%[/color][/size][/center] {CRYPTO_LIST} {CRYPTO_LIST}: This placeholder will be filled with the formatted list of cryptocurrencies generated byFormat for each Crypto in Description.%datetime%: The date and time of the last update (based on your SinusBot server's local time).
- Default:
- Format for each Crypto in Description: The template for displaying each cryptocurrency's information within the channel description.
- Default (Simplified for stability):
[b]{CRYPTO_FULL} ({CRYPTO}):[/b] ${PRICE} {CURRENCY} | 24h: {PRICE_CHANGE_24H_COLORED} - Available Placeholders:
{RANK}: Market Cap Rank{IMAGE}: Thumbnail image URL of the cryptocurrency (Note: Including images might contribute to TeamSpeak description character limits.){CRYPTO_FULL}: Full name of the cryptocurrency (e.g.,Bitcoin){CRYPTO}: Cryptocurrency symbol (e.g.,BTC){PRICE}: Current price{CURRENCY}: Selected fiat currency symbol (e.g.,USD){HIGH_24H}: 24-hour high price{LOW_24H}: 24-hour low price{PRICE_CHANGE_24H_COLORED}: 24-hour price change percentage, color-coded (green for gain, red for loss).{ATH}: All-Time High price{ATH_CHANGE}: Percentage change from ATH
- Customization Note: You can modify this template in the plugin settings to include more details or BBCode. However, be mindful of TeamSpeak's character limit for channel descriptions (usually around 1024 characters). Complex formatting or too many details for 10 cryptocurrencies can exceed this limit and prevent the description from updating correctly.
- Default (Simplified for stability):
- Update Interval (minutes): How often the prices are refreshed.
- Default:
15(15 minutes).
- Default:
Usage
After installing and configuring the plugin:
- Ensure your SinusBot is running and the plugin is enabled.
- Navigate to the TeamSpeak channel you specified as the
Target Channelin the settings. - The channel name and/or description will automatically update at the configured
Update Interval.
Troubleshooting
- Channel not updating:
- Make sure the
channelIdin the plugin settings is correctly set. - Check your SinusBot logs (usually in
/opt/sinusbot/data/bot.logor via the web panel). Look for messages prefixed with[Crypto Price Channel Updater]. - Ensure your SinusBot has internet access and can connect to
api.coingecko.com. - Verify that the
updateIntervalis not set too high.
- Make sure the
- "invalid parameter size" error in logs / description not updating fully:
- This indicates the generated channel description is too long for TeamSpeak's character limit (usually around 1024 characters).
- Solution: Simplify the
Format for each Crypto in Descriptiontemplate. Remove complex BBCode tags like[table],[img], or too many details. You may also consider reducing the number of coins displayed (e.g.,allPriceData.slice(0, 5)) in theprocessPriceDatafunction within the plugin code.
- Channel name not changing:
- If you expect the channel name to update dynamically, ensure that "Leave Channel Name Static (Do not update name)?" is UNCHECKED in the plugin settings.
- If you have "Custom Coin IDs" set, ensure the IDs are correct and that "Leave Channel Name Static?" is UNCHECKED.
- Incorrect or N/A data:
- Ensure the cryptocurrency IDs in
Custom Coin IDs(if used) are correct (exactly as they appear in the CoinGecko URL). - CoinGecko API might occasionally have no data for a specific cryptocurrency.
- Ensure the cryptocurrency IDs in
Contributing
Suggestions and contributions are always welcome! If you have an idea for improvement or encounter a bug, please:
- Open a new Issue and describe your problem or suggestion.
- Submit a Pull Request for code changes.
Support
If you find this plugin useful, please consider giving it a โญ Star on GitHub! Your support helps motivate further development and lets others know this project is valuable.
License
This project is released under the MIT License.
Acknowledgements
- Thanks to CoinGecko API for providing cryptocurrency price data.
- Thanks to the SinusBot team for their excellent platform.