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.
| Parameter | Type | Description |
|---|---|---|
options.id | string? | Custom ID (auto-generated if omitted) |
options.username | string? | Username/handle |
options.firstName | string? | Display first name |
options.lastName | string? | Display last name |
options.avatar | string? | Avatar image URL |
options.banner | string? | Profile banner image URL |
options.bio | string? | Profile bio text |
options.gender | "male" | "female"? | Used for avatar generation |
options.verified | boolean? | Show verified badge |
options.password | string? | 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.
| Parameter | Type | Description |
|---|---|---|
tweet.id | string | Unique tweet ID |
tweet.userId | string | Author's user ID |
tweet.content | string | Tweet text |
tweet.sendedAt | string? | Timestamp (auto-set if omitted) |
tweet.interaction | TwotterTweetInteraction | Engagement numbers |
tweet.showInTimeline | boolean? | 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;
}