diff --git a/docs/chatbot/commands/default/addpoints.md b/docs/chatbot/commands/default/addpoints.md index 6ef1762..9753b1e 100644 --- a/docs/chatbot/commands/default/addpoints.md +++ b/docs/chatbot/commands/default/addpoints.md @@ -21,7 +21,7 @@ keywords: # !addpoints Command import PlatformBadges from '@site/src/components/PlatformBadges'; -import ExampleChatInteraction from '@site/src/components/ExampleChatInteraction'; // Import the new component +import ExampleChatInteraction from '@site/src/components/ExampleChatInteraction'; @@ -33,7 +33,7 @@ The `!addpoints` command empowers streamers and moderators to manually add point To add points to a viewer, use the following syntax in your chat: -``` +```streamelements !addpoints ``` diff --git a/docs/chatbot/variables/args.md b/docs/chatbot/variables/args.md index debf7f4..052407e 100644 --- a/docs/chatbot/variables/args.md +++ b/docs/chatbot/variables/args.md @@ -23,13 +23,13 @@ The `$(args)` variable is a powerful feature in StreamElements chatbot commands The basic syntax for using the `$(args)` variable is: -``` +```streamelements $(args) ``` You can access specific arguments using numeric indices, starting from 1: -``` +```streamelements $(1), $(2), $(3), etc. ``` diff --git a/docs/chatbot/variables/leagueoflegends.md b/docs/chatbot/variables/leagueoflegends.md index 05e74c8..6f4efdb 100644 --- a/docs/chatbot/variables/leagueoflegends.md +++ b/docs/chatbot/variables/leagueoflegends.md @@ -23,7 +23,7 @@ The `$(leagueoflegends)` variable allows you to retrieve and display the current To use this variable, you need to provide two parameters: the region and the player's Riot ID or Summoner Name. -``` +```streamelements $(leagueoflegends ) ``` diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 5f7bc7a..af30cbd 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -140,7 +140,7 @@ const config: Config = { prism: { theme: prismThemes.github, darkTheme: prismThemes.dracula, - additionalLanguages: ['json'], + additionalLanguages: ['json', 'streamelements'], }, } satisfies Preset.ThemeConfig, }; diff --git a/src/components/MultiChatInteraction.jsx b/src/components/MultiChatInteraction.jsx new file mode 100644 index 0000000..e693691 --- /dev/null +++ b/src/components/MultiChatInteraction.jsx @@ -0,0 +1,42 @@ +import React from 'react'; +import TwitchChatMessage from './TwitchChatMessage'; +import styles from './ExampleChatInteraction.module.css'; // Reuse styles for now + +/** + * Component to display a sequence of chat messages. + * Takes an array of message objects, each defining the properties for a single message. + */ +export default function MultiChatInteraction({ + messages = [], // Array of message objects +}) { + if (!messages || messages.length === 0) { + return null; // Don't render anything if no messages are provided + } + + return ( +
+ example chat + {messages.map((msg, index) => ( + + ))} +
+ ); +} + +// Example Usage (can be removed or kept for reference): +/* + +*/ diff --git a/src/components/PlatformBadges.js b/src/components/PlatformBadges.js index d7fa633..a0d8790 100644 --- a/src/components/PlatformBadges.js +++ b/src/components/PlatformBadges.js @@ -6,6 +6,7 @@ const platformClasses = { twitch: 'twitch', kick: 'kick', youtube: 'youtube', + trovo: 'trovo', }; export default function PlatformBadges({ supported }) { diff --git a/src/components/TwitchChatMessage.jsx b/src/components/TwitchChatMessage.jsx index 025c440..d69445b 100644 --- a/src/components/TwitchChatMessage.jsx +++ b/src/components/TwitchChatMessage.jsx @@ -61,9 +61,12 @@ export default function TwitchChatMessage({ return (
- - {renderBadges()} - + {/* Conditionally render the badges container */} + {badges && badges.length > 0 && ( + + {renderBadges()} + + )} {username}: diff --git a/src/css/custom.css b/src/css/custom.css index ebe5e92..674a8a7 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -45,6 +45,10 @@ code { background-color: #53FC18; color: black; } +.platform-badge.trovo { + background-color: #64d376; + color: black; +} .platform-badge.youtube { background-color: #FF0000; color: white; @@ -54,3 +58,86 @@ code { margin-top: -0.5em; /* Adjust this value to fine-tune vertical spacing */ margin-bottom: 1em; /* Ensure some space before the Overview section */ } + +/* Custom styles for StreamElements command syntax highlighting */ +.token.command { + color: #ff8c00; /* Command color - orange */ + font-weight: bold; +} + +[data-theme='dark'] .token.command { + color: #ffa500; /* Slightly brighter for dark mode */ +} + +.token.subcommand { + color: #e67e22; /* Subcommand color - lighter orange */ + font-weight: 600; +} + +[data-theme='dark'] .token.subcommand { + color: #ffb347; /* Slightly brighter for dark mode */ +} + +.token.parameter { + color: #1e90ff; /* Parameter color - blue */ + font-style: italic; +} + +[data-theme='dark'] .token.parameter { + color: #00bfff; /* Slightly brighter for dark mode */ +} + +.token.option { + color: #9370db; /* Option color - purple */ +} + +[data-theme='dark'] .token.option { + color: #b39ddb; /* Slightly brighter for dark mode */ +} + +.token.flag { + color: #20b2aa; /* Flag color - teal */ +} + +[data-theme='dark'] .token.flag { + color: #40e0d0; /* Slightly brighter for dark mode */ +} + +.token.number { + color: #ff6b6b; /* Numbers - red */ + font-weight: 600; +} + +[data-theme='dark'] .token.number { + color: #ff7f7f; /* Slightly brighter for dark mode */ +} + +.token.variable { + color: #3cb371; /* Variables - green */ +} + +[data-theme='dark'] .token.variable { + color: #7fff00; /* Slightly brighter for dark mode */ +} + +.token.keyword { + color: #daa520; /* Keywords - gold */ + font-weight: 600; +} + +[data-theme='dark'] .token.keyword { + color: #ffd700; /* Slightly brighter for dark mode */ +} + +/* Style for code blocks using the streamelements language */ +pre[class*="language-streamelements"] { + background-color: #f5f5f5; + border-left: 3px solid #ff8c00; + border-radius: 0 4px 4px 0; + margin-bottom: 1.5em; +} + +[data-theme='dark'] pre[class*="language-streamelements"] { + background-color: #2d333b; + border-left: 3px solid #ffa500; +} diff --git a/src/theme/prism-include-languages.js b/src/theme/prism-include-languages.js new file mode 100644 index 0000000..54c8c68 --- /dev/null +++ b/src/theme/prism-include-languages.js @@ -0,0 +1,57 @@ +/** + * This file is a workaround for the fact that Docusaurus doesn't support + * custom Prism syntax highlighting languages out of the box. + */ + +export default function prismIncludeLanguages(PrismObject) { + PrismObject.languages.streamelements = { + // Main command (e.g., !points, !addpoints) + 'command': { + pattern: /^![\w-]+/m, + greedy: true, + alias: 'function' + }, + // Subcommands (e.g., add, remove in !points add) + 'subcommand': { + pattern: /(?<=^![\w-]+ )(add|remove|set|enable|disable|list|help|info|start|stop|create|delete|edit|show|hide)/m, + greedy: true, + alias: 'keyword' + }, + // Required parameters (e.g., ) + 'parameter': { + pattern: /<[\w\s._-]+>/g, + greedy: true, + alias: 'variable' + }, + // Optional parameters (e.g., [amount]) + 'option': { + pattern: /\[[\w\s._-]+\]/g, + greedy: true, + alias: 'property' + }, + // Flag arguments (e.g., --silent or -s) + 'flag': { + pattern: /--?[\w-]+/g, + greedy: true, + alias: 'selector' + }, + // Numbers + 'number': { + pattern: /\b\d+\b/g, + greedy: true + }, + // Variable references (e.g., ${user} or $(user)) + 'variable': { + pattern: /\$(?:\{[^}]+\}|\([^)]+\))/g, + greedy: true, + alias: 'attr-value' + }, + // Special keywords like true/false/all + 'keyword': { + pattern: /\b(true|false|all|none|random|first|last)\b/gi, + greedy: true + }, + // Punctuation + 'punctuation': /[<>[\]{}()=|,]/ + }; +}