您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

51 行
826 B

  1. module.exports = async ({ serverId, name }, { recipe: { profession, teaches } }) => {
  2. const recipes = await io.getAsync({
  3. key: name,
  4. table: 'recipes',
  5. isArray: true
  6. });
  7. const known = recipes.some(r => r.profession === profession && r.teaches === teaches);
  8. if (known) {
  9. process.send({
  10. method: 'events',
  11. data: {
  12. onGetAnnouncement: [{
  13. obj: {
  14. msg: 'You already know that recipe'
  15. },
  16. to: [serverId]
  17. }]
  18. }
  19. });
  20. return false;
  21. }
  22. recipes.push({
  23. profession,
  24. teaches
  25. });
  26. await io.setAsync({
  27. key: name,
  28. table: 'recipes',
  29. value: recipes,
  30. serialize: true
  31. });
  32. process.send({
  33. method: 'events',
  34. data: {
  35. onGetAnnouncement: [{
  36. obj: {
  37. msg: 'The recipe imprints itself in your mind, then vanishes'
  38. },
  39. to: [serverId]
  40. }]
  41. }
  42. });
  43. return true;
  44. };