fix: publish issues
This commit is contained in:
@@ -66,7 +66,7 @@ func publishCmd(ctx context.Context) error {
|
||||
|
||||
// publish item
|
||||
if err := publish(ctx, msg); err != nil {
|
||||
return errors.Wrap(err, "failed to publish")
|
||||
return errors.Wrapf(err, "failed to publish id: %d", msg.ChannelMessages.ID)
|
||||
}
|
||||
|
||||
_, err := tbl.UPDATE().SET(tbl.Published.SET(Bool(true))).WHERE(tbl.ID.EQ(Int64(msg.ChannelMessages.ID))).ExecContext(ctx, db)
|
||||
@@ -110,6 +110,10 @@ func publish(_ context.Context, msg publishMsg) error {
|
||||
continue
|
||||
}
|
||||
|
||||
if file == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
filepath := filepath.Join(config.C.Output, file)
|
||||
b, err := os.ReadFile(filepath)
|
||||
if err != nil {
|
||||
|
||||
@@ -60,6 +60,10 @@ func Post(pd PostData) error {
|
||||
return errors.New("post memo failed, body: " + resp.String())
|
||||
}
|
||||
|
||||
if len(pd.Resources) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
type Resources struct {
|
||||
Resources []Resource `json:"resources"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user