fix Parse
This commit is contained in:
parent
98b3f330af
commit
47d16bffd0
|
@ -167,17 +167,21 @@ func (j *Jail) CreateAndInitCell(chatID string, code ...string) string {
|
||||||
func (j *Jail) Parse(chatID, code string) string {
|
func (j *Jail) Parse(chatID, code string) string {
|
||||||
cell, err := j.cell(chatID)
|
cell, err := j.cell(chatID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// cell does not exist
|
// cell does not exist, so create and init it
|
||||||
cell, err = j.createAndInitCell(chatID, code)
|
cell, err = j.createAndInitCell(chatID, code)
|
||||||
} else {
|
} else {
|
||||||
// cell already exist, so just execute the code
|
// cell already exists, so just reinit it
|
||||||
_, err = cell.Run(code)
|
err = j.initCell(cell)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return newJailErrorResponse(err)
|
return newJailErrorResponse(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, err = cell.Run(code); err != nil {
|
||||||
|
return newJailErrorResponse(err)
|
||||||
|
}
|
||||||
|
|
||||||
return j.makeCatalogVariable(cell)
|
return j.makeCatalogVariable(cell)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue