DAMN SDK—DAMN.FUN's NodeJS Server SDK for deploying AI-native games powered Digimon Engine.
node > 18.19
npm install @damn-fun/sdk
Visit damn.fun
const baseUrl = 'https://node.damn.fun';
const apiKey = 'your api key';
const client = new ApiClient({ baseUrl, apiKey });
const fileBuffer = fs.readFileSync('damn-logo.png');
const blob = new Blob([fileBuffer], { type: 'image/png' });
const uploadRes = await getApiClient().upload(blob, 'damn-logo.png');
client.createMap({
storageId: 'storage id from upload',
title: 'string',
description: 'string',
status: 'string',
visibility: 'string',
width: 1000,
height: 1000,
});
client.updateMap({
id: 'map id',
updates: { title: 'new title' },
});
client.getMapList();
client.createMusic({
audioStorageId: 'storage id from upload',
coverStorageId: 'storage id from upload',
description: 'string',
status: 'string',
title: 'string',
visibility: 'string',
});
client.updateMusic({
id: 'music id',
updates: { title: 'new title' },
});
client.getMusicList();
client.createAgent({
avatarStorageId: 'storage id from upload',
spriteStorageId: 'storage id from upload',
prompt: 'string',
name: 'string',
description: 'string',
status: 'string',
visibility: 'string',
});
client.updateAgent({
id: 'agent id',
updates: { name: 'new name' },
});
client.getAgentList();
client.createGame({
mapId: 'map id',
agentIds: ['agent id', 'agent id'],
musicId: 'music id',
logoStorageId: 'storage id from upload',
backgroundStorageId: 'storage id from upload',
twitterHandle: 'string',
title: 'string',
description: 'string',
visibility: 'string',
});
client.updateGame({
id: 'game id',
updates: { title: 'new title' },
});
client.getGameList();
client.gameData.getWorldStatus('game id');
client.gameData.getAgentPlayerList('game id');
client.gameData.getHumanPlayerList('game id', { numItems: 10, cursor: null });
client.gameData.getPlayer('game id', 'player id like p:0');
client.gameData.getConversationList('game id', { numItems: 10, cursor: null });
client.gameData.getMessageList('conversation id like c:0');