Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    jensen
    @jensechu_twitter
    try { await r.getNewModmailConversation('fsox5').archive() } catch (error) { console.log(error) }
    Anyone know why a thread might be un-archivable?
    (I searched up for 'archive' and didn't see anything)
    Actually I think I know why. I parse it as JSON thus removing the methods. I will report back if that was the case once I know.
    Oh wait no that isn't right because I re-fetch the thread so this should be working. Hmmm
    jensen
    @jensechu_twitter
    fields":[null],"explanation":null,"message":"Unprocessable Entity","reason":"CONVERSATION_NOT_ARCHIVABLE"
    It seems to be hitting path: '/api/mod/conversations/fsox5/archive?raw_json=1', which is correct. I'll see whats up with reddit's API
    jensen
    @jensechu_twitter
    Alright if anyone else runs into this: I was trying to archive a thread that was sent between two moderators. Only threads between a non-mod and moderator can be archived. :)
    Eric Gustavsson
    @SpyTec
    @jensechu_twitter Seems like you already found out. One word of caution for the modmail implementation is that I forgot to implement a reply function for modmails, so as of right now you can't reply to convos unless you implement it on your end with oauth_request()
    jensen
    @jensechu_twitter
    @SpyTec I've been replying just fine to modmails!

    ```const sendModMail = async (threadID, message) => {
    const thread = r.getNewModmailConversation(threadID)

    await thread.reply(message);
    await archiveThread(threadID)
    }```

    Eric Gustavsson
    @SpyTec
    Hm.. let me check then what it is I forgot to implement
    jensen
    @jensechu_twitter
    I can't do private modmail notes
    If that is what you meant
    (Or I can't find how to at least :D )
    Eric Gustavsson
    @SpyTec
    Hm. Seems like reply isn't in the docs, though I did implement it in the code. Anyhow, for private modmail notes there's a second argument you can pass https://github.com/not-an-aardvark/snoowrap/blob/master/src/objects/ModmailConversation.js#L99-L106
    jensen
    @jensechu_twitter
    Oh awesome!!
    This is great thank you!
    This whole library was really easy to use. Thanks for making it.
    I particularly enjoy that the request handler retries on 503s. I didn't expect reddit to 503 so much
    Eric Gustavsson
    @SpyTec
    99% of the work goes to not-an-aardvark :D
    jensen
    @jensechu_twitter
    Oh right! Well thanks to them and all contributors ^0^
    Eric Gustavsson
    @SpyTec
    ­čÄë
    Tom├í┼í Hvozdovi─Ź
    @thvozdovic
    Hello, how can I add permissions to the bot in some subreddits so it can remove, approve etc.?
    Eric Gustavsson
    @SpyTec
    @thvozdovic When you invite the bot you can specify what permissions it needs https://www.reddit.com/r/creesch/wiki/mod101#wiki_permissions
    Tom├í┼í Hvozdovi─Ź
    @thvozdovic
    How can I get the subreddit image?
    r.getSubreddit() only returns the display name
    Got it, I had to fetch it first.
    Tom├í┼í Hvozdovi─Ź
    @thvozdovic
    Is there a way to get post flairs of subreddit?
    Eric Gustavsson
    @SpyTec
    @thvozdovic Seems like we do not support it, you could create a PR to implement it. Would need to include tests as well
    https://www.reddit.com/dev/api#POST_api_flairselector
    And we currently don't support the new flair templates v2 that was introduced a year ago either
    NGTmeaty
    @NGTmeaty
    Hi guys. I think /api/report has changed since it's been implemented and doesn't exactly behave the same? With I believe all reports coming out saying "Other" instead of including whatever reason was included or the custom report reason that was grabbed from the rules list. I think the changes to the reddit API should allow for this? Thanks! :)
    Wren T.
    @cardigan-corgi
    How do I get images with snoowrap
    Andrew Ross
    @DopamineDriven
    hey guys
    export default class Listing<T> extends Array<T> {
      constructor(options: any, _r: Snoowrap);
      isFinished: boolean;
      is_finished: boolean;
      fetchMore(options: FetchMoreOptions): Listing<T>;
      fetchAll(options?: FetchMoreOptions): Listing<T>;
      /* @deprecated */ fetchUntil(options?: FetchMoreOptions): Listing<T>;
      toJSON(): T[];
    }
    
    export interface ListingOptions {
      limit?: number;
      after?: string;
      before?: string;
      show?: string;
      count?: number;
    }
    
    export interface SortedListingOptions extends ListingOptions {
      time?: 'all' | 'hour' | 'day' | 'week' | 'month' | 'year';
    }
    
    interface FetchMoreOptions {
      amount: number;
      skipReplies?: boolean;
      skip_replies?: boolean;
      append?: boolean;
    }

    is there a difference between skipReplies camelCase and skip_replies snake_case?

    Also, for each fetch I want to perform, would I have to extend the initial getNew object each time? so allowing the user to fetch 10 more posts a total of 5 times would be five extensions?

    Andrew Ross
    @DopamineDriven
    like this? I am passing it through getStaticProps in next so it has to be jsonified/noUndefined
        const snooSubs = await r
            .getNew(display_name ?? 'snowboarding', {
                limit: 100,
                count: 10,
                show: 'all',
                after: ''
            })
            .then(fetch => {
                fetch
                    .fetchMore({
                        amount: 10,
                        append: true,
                        skipReplies: true,
                        skip_replies: true
                    })
                    .fetchMore({
                        skipReplies: true,
                        append: true,
                        skip_replies: true,
                        amount: 10
                    })
                    .fetchMore({
                        skipReplies: true,
                        skip_replies: true,
                        append: true,
                        amount: 10
                    });
                return fetch;
            });
    
        const ListingWithFetchSerialized = new Serializer<ListingWithFetch>().serialize(
            JSON.parse(JSON.stringify(snooSubs))
        );
    jensen
    @jensechu_twitter
    Yooo! I am trying to insert newlines into a modmail response.
    So far I have tried \n which doesn't work (expected because it wants markdown) I have also tried making a block and adding that but after the second new line it renders it as a code block because of backticks for string interpolation
    curious how others handle this
    jensen
    @jensechu_twitter
    just using \ works but I can only do one new line not two in
    a message
    jensen
    @jensechu_twitter
    Is there a way to see a user's account age via .getUser? Not seeing in the type definitions so I guess not but wanted to see
    Eric Gustavsson
    @SpyTec
    @jensechu_twitter not sure about the newline part. But for getUser you should be able to print out everything and find the account age variable that way, we don't have type definitions for everything as there's just so much of it and we haven't had time to add it