This is what claude (free version lol) things the code for the wordle bot should be ¯⁠\⁠_⁠(⁠ツ⁠)⁠_⁠/⁠¯

import React, { useState, useEffect } from 'react';

import { Trophy, Star, Grid3x3 } from 'lucide-react';

const WordleBot = () => {

const [results, setResults] = useState([]);

const [dailyRanking, setDailyRanking] = useState([]);

const [notableMentions, setNotableMentions] = useState([]);

const [connected, setConnected] = useState(false);

const [relays] = useState([

'wss://relay.damus.io',

'wss://nos.lol',

'wss://relay.nostr.band'

]);

// Parse Wordle result from text

const parseWordleResult = (content, pubkey) => {

const wordleRegex = /Wordle (\d+) ([X1-6])\/6\*?\s*([\n\r\s]*(?:[🟨🟩⬛⬜🟦]+[\n\r\s]*)+)/i;

const match = content.match(wordleRegex);

if (!match) return null;

const puzzleNumber = parseInt(match[1]);

const score = match[2] === 'X' ? 7 : parseInt(match[2]);

const gridText = match[3];

// Extract grid rows

const rows = gridText.split(/[\n\r]+/)

.map(row => row.trim())

.filter(row => /[🟨🟩⬛⬜🟦]/.test(row));

return {

pubkey,

puzzleNumber,

score,

grid: rows,

content,

timestamp: Date.now()

};

};

// Check if result is all green (perfect first try or perfect pattern)

const isAllGreen = (grid) => {

return grid.some(row => /^🟩+$/.test(row) && row.length === 5);

};

// Check for symmetrical patterns

const isSymmetrical = (grid) => {

if (grid.length < 2) return false;

for (let row of grid) {

const cleaned = row.replace(/[^🟨🟩⬛⬜🟦]/g, '');

if (cleaned.length < 3) continue;

const reversed = cleaned.split('').reverse().join('');

if (cleaned === reversed) return true;

}

// Check vertical symmetry

if (grid.length >= 2) {

const cleaned = grid.map(row => row.replace(/[^🟨🟩⬛⬜🟦]/g, ''));

for (let i = 0; i < Math.floor(cleaned.length / 2); i++) {

if (cleaned[i] === cleaned[cleaned.length - 1 - i]) {

return true;

}

}

}

return false;

};

// Connect to Nostr relays

const connectToNostr = async () => {

try {

const ws = new WebSocket(relays[0]);

ws.onopen = () => {

setConnected(true);

// Subscribe to notes with wordle content

const subscription = [

"REQ",

"wordle-sub",

{

kinds: [1],

"#t": ["wordle"],

since: Math.floor(Date.now() / 1000) - 86400 // Last 24 hours

}

];

ws.send(JSON.stringify(subscription));

};

ws.onmessage = (event) => {

const data = JSON.parse(event.data);

if (data[0] === "EVENT") {

const note = data[2];

const parsed = parseWordleResult(note.content, note.pubkey);

if (parsed) {

setResults(prev => {

const exists = prev.some(r => r.pubkey === parsed.pubkey && r.puzzleNumber === parsed.puzzleNumber);

if (exists) return prev;

return [...prev, parsed];

});

}

}

};

ws.onerror = () => setConnected(false);

ws.onclose = () => setConnected(false);

} catch (error) {

console.error('Connection error:', error);

setConnected(false);

}

};

// Generate demo data

const generateDemoData = () => {

const demoResults = [

{

pubkey: 'alice123',

puzzleNumber: 1234,

score: 3,

grid: ['⬛🟨⬛⬛⬛', '🟩⬛🟩⬛🟩', '🟩🟩🟩🟩🟩'],

timestamp: Date.now() - 3600000

},

{

pubkey: 'bob456',

puzzleNumber: 1234,

score: 4,

grid: ['⬛⬛🟨⬛⬛', '🟨🟨⬛⬛⬛', '🟩🟩🟩⬛🟩', '🟩🟩🟩🟩🟩'],

timestamp: Date.now() - 7200000

},

{

pubkey: 'charlie789',

puzzleNumber: 1234,

score: 2,

grid: ['🟩⬛🟩⬛🟩', '🟩🟩🟩🟩🟩'],

timestamp: Date.now() - 1800000

},

{

pubkey: 'diana101',

puzzleNumber: 1234,

score: 5,

grid: ['⬛🟨⬛🟨⬛', '⬛🟨⬛🟨⬛', '🟨⬛🟨⬛🟨', '🟩🟩⬛🟩🟩', '🟩🟩🟩🟩🟩'],

timestamp: Date.now() - 5400000

},

{

pubkey: 'eve202',

puzzleNumber: 1234,

score: 1,

grid: ['🟩🟩🟩🟩🟩'],

timestamp: Date.now() - 9000000

}

];

setResults(demoResults);

};

// Update rankings and notable mentions

useEffect(() => {

if (results.length === 0) return;

// Sort by score (lower is better)

const ranked = [...results].sort((a, b) => {

if (a.score !== b.score) return a.score - b.score;

return a.timestamp - b.timestamp; // Earlier wins ties

});

setDailyRanking(ranked);

// Find notable mentions

const notable = [];

results.forEach(result => {

if (isAllGreen(result.grid)) {

notable.push({

...result,

reason: result.score === 1 ? '🎯 Perfect First Try!' : '💚 All Green Result!'

});

} else if (isSymmetrical(result.grid)) {

notable.push({

...result,

reason: '✨ Beautiful Symmetrical Pattern!'

});

}

});

setNotableMentions(notable);

}, [results]);

useEffect(() => {

generateDemoData();

}, []);

const formatPubkey = (pubkey) => {

return pubkey.slice(0, 8) + '...' + pubkey.slice(-4);

};

return (

Nostr Wordle Tracker

Daily rankings and notable Wordle results from Nostr

onClick={connectToNostr}

disabled={connected}

className={`px-4 py-2 rounded-lg font-medium ${

connected

? 'bg-green-100 text-green-700 cursor-not-allowed'

: 'bg-green-600 text-white hover:bg-green-700'

}`}

>

{connected ? '🟢 Connected to Nostr' : 'Connect to Nostr'}

onClick={generateDemoData}

className="px-4 py-2 bg-blue-600 text-white rounded-lg font-medium hover:bg-blue-700"

>

Load Demo Data

Tracking {results.length} Wordle result{results.length !== 1 ? 's' : ''}

{notableMentions.length > 0 && (

Notable Mentions

{notableMentions.map((result, idx) => (

{formatPubkey(result.pubkey)}

Wordle {result.puzzleNumber} - {result.score}/6

{result.reason}

{result.grid.map((row, i) => (

{row}

))}

))}

)}

Daily Ranking

{dailyRanking.length === 0 ? (

No results yet. Connect to Nostr or load demo data to see rankings.

) : (

{dailyRanking.map((result, idx) => (

idx === 0 ? 'bg-yellow-50 border-yellow-400' :

idx === 1 ? 'bg-gray-50 border-gray-300' :

idx === 2 ? 'bg-orange-50 border-orange-300' :

'bg-white border-gray-200'

}`}>

idx === 0 ? 'text-yellow-600' :

idx === 1 ? 'text-gray-600' :

idx === 2 ? 'text-orange-600' :

'text-gray-400'

}`}>

{idx === 0 ? '🥇' : idx === 1 ? '🥈' : idx === 2 ? '🥉' : `#${idx + 1}`}

{formatPubkey(result.pubkey)}

Wordle {result.puzzleNumber} - Score: {result.score}/6

{new Date(result.timestamp).toLocaleTimeString()}

{result.grid.map((row, i) => (

{row}

))}

))}

)}

);

};

export default WordleBot;

Reply to this note

Please Login to reply.

Discussion

Tf is this AI diarrhea. I'm on mobile ffs

It's the cause to make the wordle bot.

I wouldn't even know where to put the code.

It probably doesn't even work tbh, AI is such bullshit

Looool. Right there with you. Much power, no clue how to wield it

quality of inputs often determines quality of outputs. git gud.

You talking to me, mf?

No, you're right. But the real hurdle for amateurs right now is things like git, general understanding of ap flow/stack, and the like. I can mingle some data like no other, but that's where my skills end