blob: 29eac68bb7adc7dd93dd790a2159c700687fba2b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import defaultBotCode from "../assets/bot_template.txt?raw";
const BOT_CODE_KEY = "bot_code";
const BOT_NAME_KEY = "bot_name";
export function getBotCode(): string {
let botCode = localStorage.getItem(BOT_CODE_KEY);
if (!botCode) {
botCode = defaultBotCode;
}
return botCode;
}
export function hasBotCode(): boolean {
return !!localStorage.getItem(BOT_CODE_KEY);
}
export function saveBotCode(botCode: string) {
localStorage.setItem(BOT_CODE_KEY, botCode);
}
export function getBotName(): string | null {
return localStorage.getItem(BOT_NAME_KEY);
}
export function saveBotName(name: string) {
localStorage.setItem(BOT_NAME_KEY, name);
}
|