diff --git a/src/createNote.mjs b/src/createNote.mjs index 1c93e1e..4b98b88 100644 --- a/src/createNote.mjs +++ b/src/createNote.mjs @@ -30,7 +30,7 @@ export default async function createNote(text) { return res.json() }) .then(data => { - return + return data }) } diff --git a/src/daily.mjs b/src/daily.mjs index d4130b7..0a944c7 100644 --- a/src/daily.mjs +++ b/src/daily.mjs @@ -10,7 +10,11 @@ const prompt = await getNewPrompt({minCount,maxCount,rarityBias:0.7}) const text = makeText(prompt) -createNote(text) +console.dir(await createNote(text)) + + + + //CHECK BUFFER - //IF EXISTS, POST NEXT BUFFERED PROMPT TO SOCIAL MEDIA diff --git a/src/data/database b/src/data/database index 09b855b..a219756 100644 Binary files a/src/data/database and b/src/data/database differ diff --git a/src/getNewPrompt.mjs b/src/getNewPrompt.mjs index cf97d08..e1e4028 100644 --- a/src/getNewPrompt.mjs +++ b/src/getNewPrompt.mjs @@ -44,7 +44,7 @@ export default async function getNewPrompt({ minCount = 200000, maxCount = 30000 -//console.dir(await getNewPrompt({})) +console.dir(await getNewPrompt({})) //console.log(await blocklist) diff --git a/src/insertPublished.mjs b/src/insertPublished.mjs new file mode 100644 index 0000000..b8ecea6 --- /dev/null +++ b/src/insertPublished.mjs @@ -0,0 +1,62 @@ +import { db } from "./db.mjs" + +const sampleRes = { + createdNote: { + id: '9i8urek4jtzhmtuh', + createdAt: '2023-08-10T15:02:35.380Z', + userId: '9i5z5o9zy11l3skl', + user: { + id: '9i5z5o9zy11l3skl', + name: null, + username: 'micro365', + host: null, + avatarUrl: 'https://localhost:3000/files/thumbnail-4e0e8b82-df72-48f7-8100-b7515173da9d', + avatarBlurhash: 'ySPjGct7xu%M-;xu-;%MRjWBoffQofWB~qRjRjayRjfQM{M{t7ofWBt7ayfQ~qj[WBj[M{WBof?bofayfQM{WBfQt7xuofWBofofM{', + avatarColor: null, + isLocked: false, + speakAsCat: true, + emojis: [], + onlineStatus: 'active', + driveCapacityOverrideMb: null + }, + text: "Today's #micro365 prompt is:\n" + + '# $[x2 $[font.serif **marmalade**]]\n' + + '/mˈɑːmɐlˌe‍ɪd/\n' + + '**noun**:\n' + + '- A kind of jam made with citrus fruit, distinguished by being made slightly bitter by the addition of the peel and by partial caramelisation during manufacture. Most commonly made with Seville oranges, and usually qualified by the name of the fruit when made with other types of fruit.\n' + + '- A kind of jam made with citrus fruit, distinguished by being made slightly bitter by the addition of the peel and by partial caramelisation during manufacture. Most commonly made with Seville oranges, and usually qualified by the name of the fruit when made with other types of fruit. Ellipsis of orange marmalade.\n' + + '- quince jam\n' + + '**verb**:\n' + + '- To spread marmalade on.\n' + + '#writing #microfiction #vss #marmalade', + cw: null, + visibility: 'public', + renoteCount: 0, + repliesCount: 0, + reactions: {}, + reactionEmojis: [], + emojis: [], + tags: [ 'micro365', 'writing', 'microfiction', 'vss', 'marmalade' ], + fileIds: [], + files: [], + replyId: null, + renoteId: null + } + } + +export default async function insertPublished(res, word){ + return db('published') + .insert({ + id: res.createdNote.id, + word, + date: new Date(sampleRes.createdNote.createdAt).toISOString().split('T')[0] + }) + .then(res => { + return res + }) + .catch(error => { + return error.message + }) +} + +//console.log(await insertPublished(sampleRes,'marmalade')) \ No newline at end of file