Skip to content

Twotter

The Twotter namespace provides access to the in-game Twitter-like social media platform. Create NPC accounts, post tweets, and manage interactions.

No permission required.

Import

typescript
import { Twotter } from "@hotbunny/hackhub-content-sdk";

Methods

Twotter.createUser(options?)

Create a new Twotter user object with sensible defaults for missing fields.

ParameterTypeDescription
options.idstring?Custom ID (auto-generated if omitted)
options.usernamestring?Username/handle
options.firstNamestring?Display first name
options.lastNamestring?Display last name
options.avatarstring?Avatar image URL
options.bannerstring?Profile banner image URL
options.biostring?Profile bio text
options.gender"male" | "female"?Used for avatar generation
options.verifiedboolean?Show verified badge
options.passwordstring?Account password (for hacking quests)

Returns: TwotterUser

typescript
const hacker = Twotter.createUser({
    username: "darknet_hacker",
    bio: "I hack things for fun.",
    verified: true,
});

Twotter.addUser(user)

Add a user to the Twotter platform so they appear in the app.

typescript
Twotter.addUser(hacker);

Twotter.postTweet(tweet)

Post a tweet from a user.

ParameterTypeDescription
tweet.idstringUnique tweet ID
tweet.userIdstringAuthor's user ID
tweet.contentstringTweet text
tweet.sendedAtstring?Timestamp (auto-set if omitted)
tweet.interactionTwotterTweetInteractionEngagement numbers
tweet.showInTimelineboolean?Show in the player's timeline
typescript
Twotter.postTweet({
    id: "tweet-001",
    userId: hacker.id,
    content: "Just hacked the mainframe! 💀",
    interaction: { comments: 12, share: 5, likes: 142, views: 3400 },
    showInTimeline: true,
});

Twotter.removeTweet(id)

Remove a tweet by its ID.

Twotter.getUserByUsername(username)

Find a user by their username.

Returns: TwotterUser | undefined

Twotter.getUserById(id)

Find a user by their ID.

Returns: TwotterUser | undefined

Twotter.toggleLike(postId, userId)

Toggle like on a tweet from a specific user.

Types

TwotterUser

typescript
interface TwotterUser {
    id: string;
    username: string;
    name: string;
    surname: string;
    avatar: string;
    banner: string;
    bio?: string;
    joinedAt: string;
    followers: number;
    following: number;
    verified?: boolean;
    password?: string;
}

TwotterTweet

typescript
interface TwotterTweet {
    id: string;
    userId: string;
    content: string;
    sendedAt?: string;
    interaction: TwotterTweetInteraction;
    showInTimeline?: boolean;
}

TwotterTweetInteraction

typescript
interface TwotterTweetInteraction {
    comments: number;
    share: number;
    likes: number;
    views: number;
}

HotBunny Interactive Entertainment Inc.