Replit's API is constantly changing, which means this will as well. I will try to keep it easy to use but be aware that your project may stop working at any point.
npm install replapi-it
const Client = require('replapi-it');
//A Replit connect.sid cookie
const client = new Client('SID');
client.on('ready', () => {
})
If you don't know how to find your connect.sid cookie, look here
Logs the number of followers a user has
const Client = require('replapi-it');
const client = new Client('SID');
client.on('ready', async () => {
let user = await client.users.fetch('PikachuB2005');
console.log(user.followerCount);
})
<Client>.user
: aCurrentUser
object of the logged in user<Client>.repl
: aRepl
object of the current repl, if any<Client>.users
: aUserManager
object<Client>.repls
: aReplManager
object<Client>.posts
: aPostManager
object<Client>.comments
: aCommentManager
object<Client>.on('notification', callback)
: notifications event listener *callback
: a callback function
<User>.repls
: aReplManager
object<User>.followers
: aFollowerManager
object<User>.follows
: aFollowingManager
object<User>.posts
: aPostManager
object<User>.id
: the user's id<User>.username
: the user's username<User>.firstName
: the user's first name<User>.lastName
: the user's last name<User>.locale
: the user's language<User>.isVerified
: if the user is verified or not<User>.displayName
: the user's display name<User>.fullName
: the user's full name<User>.url
: the url to the user's profile<User>.bio
: the user's bio<User>.socials
: the user's social media urls<User>.roles
: the user's roles<User>.isFollowedByCurrentUser
: if you are following the user<User>.isFollowingCurrentUser
: if you're following the user<User>.isBlockedByCurrentUser
: if you've blocked the user<User>.isBlockingCurrentUser
: if the user blocked you<User>.isLoggedIn
: if the user is logged in (<User>.isOnline
is recommended)<User>.isSubscribed
:<User>.followerCount
: how many followers the user has<User>.followCount
: how many people the user is following<User>.isHacker
: if the user has Hacker plan<User>.image
: the url to the user's profile picture<User>.coverImage
: the url and offset to the user's profile banner image<User>.timeCreated
: when the user's account was created<User>.lastSeen
: when the user was last online<User>.isOnline
: if the user is online<User>.setFollowing(boolean)
: follow or unfollow the user<User>.setBlocking(boolean)
: block or unblock the user
Also contains most User
properties and methods, excluding follow / block values
<CurrentUser>.notifications
: aNotificationManager
object<CurrentUser>.email
: the user's email<CurrentUser>.emailNotifications
: if the user should be emailed notifications<CurrentUser>.hasRepl
: if the user has any repls<CurrentUser>.hasPrivacyRole
:<CurrentUser>.warnings
: any warnings the user has recieved<CurrentUser>.isBannedFromBoards
: if the user is banned from boards<CurrentUser>.canUpdateEmail
: if the user can change their email<CurrentUser>.canUpdateUsername
: if the user can change their username<CurrentUser>.device
: if the user is using a mobile or mac device<CurrentUser>.sidebarClosed
: if the user's sidebar is closed<CurrentUser>.hasProfileImage
: if the user has a profile image<CurrentUser>.socialSignup
:<CurrentUser>.githubInfo
: the user's github info<CurrentUser>.usernameRepl
: the user's repl whose title matches their username<CurrentUser>.daysSinceSignup
: how many days since the user signed up<CurrentUser>.storage
: the user's storage limit and usage<CurrentUser>.editorPreferences
: the user's editor preferences<CurrentUser>.countryCode
: the user's country code<CurrentUser>.auth
: google / github / facebook auth<CurrentUser>.change(options)
: updates the current user's settingsoptions
:image
: a path to an image file to set your profile picturefirstName
: changes your first namelastName
: changes your last namebio
: changes your bioemailNotifications
: if you should recieve email notifications
<Repl>.threads
: a list ofThread
objects<Repl>.multiplayers
: aMultiplayerManager
object<Repl>.comments
: aCommentManager
object<Repl>.id
: the repl's id<Repl>.isProject
:<Repl>.isPrivate
: if the repl is private<Repl>.isStarred
: if the repl is starred<Repl>.title
: the repl's title<Repl>.slug
: the repl's title slug<Repl>.imageUrl
: the url to the repl's image<Repl>.folderId
: the folder the repl is in<Repl>.isRenamed
: if the repl is renamed<Repl>.commentCount
: how many comments the user has<Repl>.likeCount
: how many likes the repl has<Repl>.currentUserDidLike
: if you liked the repl<Repl>.templateCategory
: the category of the template used to create the repl<Repl>.wasPosted
: if the repl was posted<Repl>.wasPublished
: if the repl was published<Repl>.language
: the id of the repl's language (you're probably looking for<Repl>.templateInfo.label
)<Repl>.lang
: the repls language (you're probably looking for<Repl>.templateInfo.label
)<Repl>.iconUrl
: the url of the repl's icon<Repl>.templateLabel
: label of the repl's template repl<Repl>.url
: the repl's url<Repl>.inviteUrl
: the url to invite users to the repl<Repl>.multiplayerInvites
: invites to the repl<Repl>.historyUrl
: the repl's history url<Repl>.analyticsUrl
: the repl's analytics url<Repl>.rootOriginReplUrl
: the url to the repl's origin repl<Repl>.isOwner
: if you are the owner of the repl<Repl>.config
: the repl's config data<Repl>.pinnedToProfile
: if the repl is pinned to your profile<Repl>.size
: the repl's size, in bytes.<Repl>.hostedUrl
: the repl's hosted url, used for iframes<Repl>.terminalUrl
: the repl's terminal url<Repl>.database
: data about the repl's database<Repl>.template
: the repl's template<Repl>.isProjectFork
: if the repl is a fork<Repl>.publicForkCount
: how many public forks the repl has<Repl>.runCount
: how many times the repl has been run<Repl>.isAlwaysOn
: if the repl is always on<Repl>.isBoosted
: if the repl is boosted<Repl>.tags
: the repl's tags<Repl>.lastPublishedAt
: when the repl was last published<Repl>.multiplayers
: a<Collection>
ofUser
objects of people invited to the repl<Repl>.nixedLanguage
: if the repl was nixed<Repl>.publishedAs
: returns undefined, 'RegularRepl', or 'Template'<Repl>.attachments
:<Repl>.description
: the repl's description<Repl>.markdownDescription
: the repl's description, with markdown<Repl>.hasExplainCode
: if the repl has explain code<Repl>.hasGenerateCode
: if the repl has generate code<Repl>.templateInfo
: info about the repl's template<Repl>.domains
:<Repl>.apexProxy
: the ip of the repl's apex proxy<Repl>.replViewSettings
: the repl's view settings<Repl>.powerUpCosts
: the repl's power up costs<Repl>.isTutorial
:if the repl is a tutorial<Repl>.owner
: aUser
object of the repl's owner<Repl>.timeCreated
: when the repl was created<Repl>.timeUpdated
: when the repl was updated<Repl>.currentUserPermissions
: your permissions for the repl<Repl>.fetchThreads(options)
: returns the repls'd threads<Repl>.database
: ARepl Database
object<Repl>.fork(options)
: forks the reploptions
:cache
: cache the result(s). default: truetitle
: the repl's titledescription
: the repl's descriptionisPrivate
: if the repl should be private
<Repl>.delete()
: deletes the repl<Repl>.change(options)
: updates the reploptions
:title
: the repl's titledescription
: the repl's descriptionisPrivate
: if the repl should be private
<Repl>.comment(body)
: comments on the repl<Repl>.connect()
: Connect to the repl The following require you to be connected to the repl:<Repl>.env
: the repl's environmental variables (secrets)<Repl>.files
: aFileManager
object<Repl>.console
: aConsole
object<Repl>.disconnect()
: disconnects from the repl
<Usermanager>.cache
: aCollection
ofUser
objects<Usermanager>.fetch(userResolvable, options)
: a Promise of aUser
objectuserResolvable
: A username, id, orUser
options
:force
: doesn't check the cache. default: falsecache
: cache the result(s). default: true
<Usermanager>.search(query, options)
: aCollection
ofUser
objectsquery
: what to searchoptions
:cache
: cache the result(s). default: true
limit
: the maximum number of results. default: 10
<Replmanager>.cache
: aCollection
ofRepl
objects<Client>.<Replmanager>.fetch(replResolvable, options)
: aUser
objectreplResolvable
: A url, id, orRepl
options
:force
: doesn't check the cache. default: falsecache
: cache the result(s). default: true
<Replmanager>.generateTitle()
: a randomly generated repl title<Client>.<ReplManager>.create(options)
: creates a new reploptions
:title
: the repl's title
description
: the repl's descriptionlanguage
: the repl's languageisPrivate
: if the repl is private
A Map object with extra methods. Meant to be like discord.js's Collection
<PostManager>.cache
aCollection
<PostManager>.trending(options)
: aCollection
of trending postsoptions
:force
: doesn't check the cache. default: falsecache
: cache the result(s). default: truelimit
: the maximum number of resultstags
: tags included in the results
<Client>.<CommentManager>.fetch(commentResolvable, options)
: returns aComment
objectcommentResolvable
: a comment idoptions
:cache
: cache the result(s). default: true
<Repl>.<CommentManager>.fetch(options)
: returns aCollection
ofComment
objectsoptions
:cache
: cache the result(s). default: truelimit
: the maximum number of results
<User>.<CommentManager>.fetch(options)
: returns aCollection
ofComment
objectsoptions
:cache
: cache the result(s). default: truelimit
: the maximum number of results
<Post>.id
: the post's id<Post>.title
: the post's title<Post>.commentCount
: how many replies the post has<Post>.body
: the body of the post<Post>.user
: aUser
object<Post>.repl
: aRepl
object<Post>.comment
: aComment
object<Post>.timeCreated
: when the post was created<Post>.timeUpdated
: when the post was last updated
<Comment>.comments
: an array ofComment
objects<Comment>.id
: the comment's id<Comment>.body
: the comment's body<Comment>.bodyNoMarkdown
: the comment's body without markdown<Comment>.curretUserPermissions
: your current permissions for the comment<Comment>.timeCreated
: when the comment was created<Comment>.timeUpdated
: when the comment was last updated<Comment>.user
: aUser
object<Comment>.repl
: aRepl
object<Comment>.reply(body)
: reply to the comment
<FollowerManager>.fetch(options)
: aCollection
ofUser
objectsoptions
:cache
: cache the result(s). default: truelimit
: the maximum number of results
<FollowingManager>.fetch(options)
: aCollection
ofUser
objectsoptions
:cache
: cache the result(s). default: truelimit
: the maximum number of results
<FollowingManager>.events
: aUserEventManager
<MultiplayerManager>.cache
: aCollection
ofUser
objects<MultiplayerManager>.invite(userResolvable)
: invite a user to the repl<MultiplayerManager>.remove(userResolvable)
: remove a user from the repl
<FileManager>.persisting
: if the manager is currently persisting<FileManager>.read(path)
: returns the contents of a file<FileManager>.write(path, content)
: writes to a file<FileManager>.mkdir(path)
: makes a directory<FileManager>.remove(path)
: removes a file / directory<FileManager>.move(oldPath, newPath)
: moves a file/directory<FileManager>.readdir(path)
: get an array of files in a directory<FileManager>.recursedir(path)
: get an array of recursed files in a directory<FileManager>.presist()
: makes the files update when edited<FileManager>.snapshot()
: updates the files to what they are currently
<Console>.send(input)
: sends something to the console<Console>.run()
: runs the repl<Console>.stop()
: stops the repl
<UserEventManager>.cache
: aCollection
ofUserEvent
objects<UserEventManager>.fetch(options)
: aCollection
ofUserEvent
objectsoptions
:cache
: cache the result(s). default: truelimit
: the maximum number of results
<UserEvent>.id
: the id of the event<UserEvent>.eventType
: the type of the event<UserEvent>.post
: aPost
object<UserEvent>.timeUpdated
: when the event was last updated<UserEvent>.user
: aUser
object<UserEvent>.repl
: aRepl
object<UserEvent>.comment
: aComment
object
<NotificationManager>.cache
: aCollection
ofNotification
objects<NotificationManager>.fetch(options)
: aCollection
ofNotification
objectsoptions
:cache
: cache the result(s). default: truelimit
: the maximum number of resultsseen
: if the notifications have been seen or not. default: false
<NotificationManager>.markAsRead()
: marks your notifications as read<NotificationManager>.startEvents()
: starts sending notification events for new notifications<NotificationManager>.stopEvents()
: stops the sending of notification events