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 {
|
||||
cell, err := j.cell(chatID)
|
||||
if err != nil {
|
||||
// cell does not exist
|
||||
// cell does not exist, so create and init it
|
||||
cell, err = j.createAndInitCell(chatID, code)
|
||||
} else {
|
||||
// cell already exist, so just execute the code
|
||||
_, err = cell.Run(code)
|
||||
// cell already exists, so just reinit it
|
||||
err = j.initCell(cell)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return newJailErrorResponse(err)
|
||||
}
|
||||
|
||||
if _, err = cell.Run(code); err != nil {
|
||||
return newJailErrorResponse(err)
|
||||
}
|
||||
|
||||
return j.makeCatalogVariable(cell)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue