You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<location>D:/Google Drive/Data Part2/Work/Business/TBpack startup/Conference Program Bot/Promotions/QLIN 9-14 Jan 2024/TelegramBotAPI_2024_01_06.nb</location>
Copy file name to clipboardExpand all lines: TelegramBotAPI/AvailableTypes.m
+23-25Lines changed: 23 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,13 @@
1
1
(* Wolfram Language Package *)
2
2
3
3
BeginPackage["TelegramBotAPI`AvailableTypes`"]
4
+
5
+
Unprotect[Evaluate[$Context<>"*"]];
6
+
7
+
4
8
(* Exported symbols added here with SymbolName::usage *)
5
-
InlineKeyboardMarkup::usage="InlineKeyboardMarkup[\!\(\*RowBox[{StyleBox[\"arrayofojbects\",\"TI\"]}]\)] represents array of button rows, each represented by an array of \!\(\*StyleBox[\"InlineKeyboardButton\",\"TI\"]\) objects.";
9
+
InlineKeyboardMarkup::usage="InlineKeyboardMarkup[\!\(\*RowBox[{StyleBox[\"arrayofojbects\",\"TI\"]}]\)] represents array of button rows, each represented by an array of \!\(\*StyleBox[\"InlineKeyboardButton\",\"TI\"]\) objects.
10
+
\!\(\*TemplateBox[{\"Read on Telegram Bot API webpage\", \"https://core.telegram.org/bots/api#inlinekeyboardmarkup\"}, \"HyperlinkURL\"]\)";
6
11
InlineKeyboardButton::usage="InlineKeyboardButton[\!\(\*RowBox[{StyleBox[\"text\",\"TI\"]}]\)] is an object representing one button of an inline keyboard. It must use exactly one of the optional fields.
7
12
InlineKeyboardButton[\!\(\*RowBox[{StyleBox[\"text\",\"TI\"], \",\" , StyleBox[\"options\",\"TI\"]}]\)] is a button of an inline keyboard with specified \!\(\*StyleBox[\"options\",\"TI\"]\).
8
13
InlineKeyboardButton[\!\(\*RowBox[{StyleBox[\"text\",\"TI\"], \",\" ,\"URL\", \"\[Rule]\", StyleBox[\"url\",\"TI\"]}]\)] is a button with specified HTTP or tg:// \!\(\*StyleBox[\"url\",\"TI\"]\) to be opened when the button is pressed; for instance, tg://user?id=<user_id> if allowed by user's privacy settings.
@@ -13,7 +18,8 @@
13
18
InlineKeyboardButton[\!\(\*RowBox[{StyleBox[\"text\",\"TI\"], \",\" ,\"SwitchInlineQueryCurrentChat\", \"\[Rule]\", StyleBox[\"string\",\"TI\"]}]\)] is a button inserting bot's name together with \!\(\*StyleBox[\"string\",\"TI\"]\) inline query in the input field of the current chat.
14
19
InlineKeyboardButton[\!\(\*RowBox[{StyleBox[\"text\",\"TI\"], \",\" ,\"SwitchInlineQueryChosenChat\", \"\[Rule]\", StyleBox[\"SwitchInlineQueryChosenChat\",\"TI\"]}]\)] is a button prompting the user to select one of their chats of the type specified in \!\(\*StyleBox[\"SwitchInlineQueryChosenChat\",\"TI\"]\) object.
15
20
InlineKeyboardButton[\!\(\*RowBox[{StyleBox[\"text\",\"TI\"], \",\" ,\"CallbackGame\", \"\[Rule]\", StyleBox[\"CallbackGame\",\"TI\"]}]\)] is a button launching the game described in \!\(\*StyleBox[\"CallbackGame\",\"TI\"]\) object.
16
-
InlineKeyboardButton[\!\(\*RowBox[{StyleBox[\"text\",\"TI\"], \",\" ,\"Pay\", \"\[Rule]\", StyleBox[\"True\",\"TI\"]}]\)] is a button representing a Pay button.";
21
+
InlineKeyboardButton[\!\(\*RowBox[{StyleBox[\"text\",\"TI\"], \",\" ,\"Pay\", \"\[Rule]\", StyleBox[\"True\",\"TI\"]}]\)] is a button representing a Pay button.
22
+
\!\(\*TemplateBox[{\"Read on Telegram Bot API webpage\", \"https://core.telegram.org/bots/api#inlinekeyboardbutton\"}, \"HyperlinkURL\"]\)";
17
23
18
24
19
25
(* Options *)
@@ -45,42 +51,34 @@
45
51
Pay->False
46
52
};
47
53
(* warnings *)
48
-
InlineKeyboardButton::bytelim=
54
+
InlineKeyboardButton::warn=
49
55
"The CallbackData string size `1` is too large. It must be limited to 1-64 bytes. In Mathematica the string size determined by ByteCount can be `2` bytes.";
(* Exported symbols added here with SymbolName::usage *)
9
+
(* Usage messages: use here String Representation of Boxes to get formatting similar to built-in functions *)
10
+
(* Functions*)
11
+
textToSpeechXI::usage="textToSpeechXI[\!\(\*RowBox[{StyleBox[\"voiceid\",\"TI\"],\",\", StyleBox[\"text\",\"TI\"]}]\)] converts \!\(\*StyleBox[\"text\",\"TI\"]\) to speech using voice specified by \!\(\*StyleBox[\"voiceid\",\"TI\"]\). Use VoicesXI[] to list all the available voices.
12
+
textToSpeechXI[\!\(\*RowBox[{StyleBox[\"voiceid\",\"TI\"],\",\", StyleBox[\"text\",\"TI\"],\",\" , StyleBox[\"options\",\"TI\"]}]\)] converts \!\(\*StyleBox[\"text\",\"TI\"]\) to speech applying specified \!\(\*StyleBox[\"options\",\"TI\"]\) given as a sequence of rules.
13
+
textToSpeechXI[\!\(\*RowBox[{\"\[Ellipsis]\", \",\" , \"\\\"enable_logging''\", \"\[Rule]\", StyleBox[\"value\",\"TI\"]}]\)] returns the response applying the specified \!\(\*StyleBox[\"value\",\"TI\"]\) to the chosen option. N.B. Option names are given as strings.
14
+
The options to choose from:
15
+
\"enable_logging\": When set to False full privacy mode will be used for the request. May only be used by enterprise customers; defaults to True.
16
+
\"output_format\": The output format of the generated audio.; defaults to \"mp3_44100_128\".
17
+
\"model_id\": Identifier of the model to be used. Use ModelsXI[] to list the models. The model needs to have support for text to speech; defaults to \"eleven_monolingual_v1\".
18
+
\"language_code\": Language code (ISO 639-1) used to enforce a language for the model. (currently only Turbo v2.5); defaults to Null.
19
+
\"voice_settings\": Voice settings overriding stored setttings for the given voice; defaults to {\"stability\"\[Rule] 0.5, \"similarity_boost\"\[Rule] 0.8, \"style\"\[Rule] 0.0, \"use_speaker_boost\"\[Rule] True}.
20
+
\"pronunciation_dictionary_locators\": A list of pronunciation dictionary locators {\"id\", \"version_id\"} to be applied to the text (up to 3 per request); defaults to an empty list {}.
21
+
\"seed\": If specified, the system will try to sample deterministically, though determinism is not guaranteed. Must be integer between 0 and 4294967295; defaults to Null.
22
+
\"previous_text\": The text that came before the current request (useful for concatenating multiple generations); defaults to Null.
23
+
\"next_text\": The text that comes after the current request. (useful for concatenating multiple generations); defaults to Null.
24
+
\"previous_request_ids\": A list of maximum 3 \"request_id\" of the samples that were generated before this generation. If used, \"previous_text\" is ignored; defaults to {}.
25
+
\"next_request_ids\": A list of maximum 3 \"request_id\" of the samples that were generated before this generation. If used, \"next_text\" is ignored; defaults to {}.
26
+
\"apply_text_normalization\": Controls text normalization (e.g., spelling out numbers) with three modes: \"auto\", \"on\", and \"off\". Cannot be turned on for \"eleven_turbo_v2_5\" model.; defaults to \"auto\".
27
+
\"Directory\": The directory to save generated speech; defaults to $TemporaryDirectory.
28
+
\"FileName\": The file name to be given to the saved speech; defaults to \"voice\".
29
+
\"Format\": The format to which the speech is to be exported. It is an extension of \"FileName\"; defaults to \"mp3\".
30
+
\"APIKey\": Your \!\(\*TemplateBox[{\"authentication key\", \"https://elevenlabs.io/docs/api-reference/authentication\"}, \"HyperlinkURL\"]\) to access ElevenLabs API; defaults to $XILabsAPIKey.
31
+
\!\(\*TemplateBox[{\"Read on ElevenLabs API webpage\", \"https://elevenlabs.io/docs/api-reference/text-to-speech/convert\"}, \"HyperlinkURL\"]\)";
32
+
33
+
VoicesXI::usage="VoicesXI[] lists the available by default voices accessing the end point \!\(\*StyleBox[\"https://api.elevenlabs.io/v1/voices\",Rule[Background, RGBColor[1, 0.85`, 0.85`]]]\).
34
+
VoicesXI[\!\(\*RowBox[{\"\\\"APIKey''\", \"\[Rule]\", StyleBox[\"string\",\"TI\"]}]\)] returns the response applying the specified \!\(\*StyleBox[\"string\",\"TI\"]\) to the chosen option. N.B. Option names are given as strings.
35
+
The options to choose from:
36
+
\"APIKey\": Your \!\(\*TemplateBox[{\"authentication key\", \"https://elevenlabs.io/docs/api-reference/authentication\"}, \"HyperlinkURL\"]\) to access ElevenLabs API; defaults to $XILabsAPIKey.
37
+
\!\(\*TemplateBox[{\"Read on ElevenLabs API webpage\", \"https://elevenlabs.io/docs/api-reference/text-to-speech/convert\"}, \"HyperlinkURL\"]\)";
38
+
39
+
ModelsXI::usage="ModelsXI[] lists the available by default models accessing the end point \!\(\*StyleBox[\"https://api.elevenlabs.io/v1/models\",Rule[Background, RGBColor[1, 0.85`, 0.85`]]]\).
40
+
ModelsXI[\!\(\*RowBox[{\"\\\"APIKey''\", \"\[Rule]\", StyleBox[\"string\",\"TI\"]}]\)] returns the response applying the specified \!\(\*StyleBox[\"string\",\"TI\"]\) to the chosen option. N.B. Option names are given as strings.
41
+
The options to choose from:
42
+
\"APIKey\": Your \!\(\*TemplateBox[{\"authentication key\", \"https://elevenlabs.io/docs/api-reference/authentication\"}, \"HyperlinkURL\"]\) to access ElevenLabs API; defaults to $XILabsAPIKey.
43
+
\!\(\*TemplateBox[{\"Read on ElevenLabs API webpage\", \"https://elevenlabs.io/docs/api-reference/text-to-speech/convert\"}, \"HyperlinkURL\"]\)";
44
+
45
+
46
+
(* Options *)
47
+
48
+
(* Constants *)
49
+
$XILabsURL::usage="URL for all queries to the ElevenLabs API.
50
+
\!\(\*TemplateBox[{\"Read on ElevenLabs API webpage\", \"https://elevenlabs.io/docs/api-reference/authentication#making-requests\"}, \"HyperlinkURL\"]\)";
51
+
$XILabsAPIKey::usage="Key used for authentication during API requests to ElevenLabs.
52
+
\!\(\*TemplateBox[{\"Read on ElevenLabs API webpage\", \"https://elevenlabs.io/docs/api-reference/authentication\"}, \"HyperlinkURL\"]\)";
53
+
54
+
55
+
Begin["`Private`"] (* Begin Private Context *)
56
+
57
+
Clear[$XILabsURL,$XILabsAPIKey]
58
+
(*
59
+
$XILabsURL, $XILabsAPIKey and etc. are effectively set to themselves
60
+
so that they can enter all the package functions. Then they can be changed during the session
61
+
and take an effect on all the functions, where they are used.
62
+
*)
63
+
64
+
65
+
(* old name is TTSFromElevenLabs *)
66
+
textToSpeechXI::connect="A message was generated while connecting to `1`: `2`";
67
+
textToSpeechXI::err="Audio was not generated while connecting to `1`: `2`";
0 commit comments