File size: 741 Bytes
b68dc3f
 
 
225fe85
b68dc3f
 
 
225fe85
 
 
 
 
b68dc3f
 
 
 
225fe85
 
 
 
 
 
 
 
 
 
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
import json

def load_skills():
    with open('skills.json', 'r', encoding='utf-8') as file:
        skills = json.load(file)
    return skills

def save_skills(skills_data):
    with open('skills.json', 'w', encoding='utf-8') as file:
        json.dump(skills_data, file, ensure_ascii=False, indent=4)

def get_skill(user_input, scene, skills):
    for skill in skills:
        if any(trigger in user_input for trigger in skill['triggers']):
            return skill
    return None

def add_skill(new_skill):
    skills = load_skills()
    skills.append(new_skill)
    save_skills(skills)

def delete_skill(action):
    skills = load_skills()
    skills = [skill for skill in skills if skill['triggers'] != action]
    save_skills(skills)