Skip to content

Unable to comment richtext only #182

@tip2663

Description

@tip2663

Hey, I am trying to comment like so:

const reply = await context.reddit.submitComment({
        id: targetId,
        richtext: new RichTextBuilder().animatedImage({mediaId:response.mediaId}),
        runAs:"USER"
      })

But this gives me the following error:

Error: 2 UNKNOWN: Errors:
NO_TEXT: we need something here: text
    at callErrorFromStatus (/srv/index.cjs:5299:21)
    at Object.onReceiveStatus (/srv/index.cjs:5980:70)
    at Object.onReceiveStatus (/srv/index.cjs:5782:140)
    at Object.onReceiveStatus (/srv/index.cjs:5748:178)
    at /srv/index.cjs:15443:77
    at process.processTicksAndRejections (node:internal/process/task_queues:85:11)
for call at
    at Client2.makeUnaryRequest (/srv/index.cjs:5950:32)
    at /srv/index.cjs:139738:62
    at /srv/index.cjs:139797:5
    at new Promise (<anonymous>)
    at GrpcWrapper._GrpcWrapper_promiseWithGrpcCallback2 (/srv/index.cjs:139795:10)
    at GrpcWrapper.request (/srv/index.cjs:139737:110)
    at GenericPluginClient.Comment (/srv/index.cjs:124879:93)
    at wrapped.<computed> [as Comment] (main.js:36536:141)
    at Comment.submit (main.js:39713:35)
    at RedditAPIClient.submitComment (main.js:29735:20) {
  code: 2,
  details: 'Errors:\nNO_TEXT: we need something here: text',
  metadata: _Metadata { internalRepr: Map(0) {}, options: {} }

The docs say either text or richtext should be there:

(method) RedditAPIClient.submitComment(options: CommentSubmissionOptions & {
    id: string;
}): Promise<Comment>
Submit a new comment to a post or comment.

@param options — You must provide either options.text or options.richtext but not both.

@param options.id — The ID of the post or comment to comment on. e.g. 't3_1qjpg' for post and 't1_1qgif' for comment

@param options.text — The text of the comment

@param options.richtext — The rich text of the comment

@param options.runAs — The user type to submit the comment as, eg 'APP' or 'USER'

@returns — A Promise that resolves to a Comment object.

@example

import { RunAs } from '@devvit/public-api';

So I believe this to be a bug!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions