3 642
i even added shoutbox to starkow.dev! any of your guys messages could pop up here. once it gets approved by me, of course :P all you have to do is to send a message through previously created letterbox!
06 серп 2024, 15:34
.ton.run or .ton.website like this:
winterfall.ton → winterfall.ton.run
winterfall.ton → winterfall.ton.website@sottovoxbot henlo my dear fren @starkow in the group chat and click the button that appeared. that simple!
messages have a ttl (time-to-live) of 3 hours, so after 3 hours your message will be deleted. i might update on that area later, but as for now it is what it is ¯\_(ツ)_/¯addDocuments into your index instance of the meilisearch (and update it every time any document is created/edited/deleted on the main database so both dbs are in sync), probably updateTypoTolerance so you can search and accept a few typos and then simply index.search('hello')!
const index = meilisearch.index('messages')
const messages = [
{ global_id: 1, chat_id: 10, message_id: 1, from: { user_id: 1, first_name: 'John', last_name: 'Doe' }, text: 'Hello world!' },
{ global_id: 2, chat_id: 10, message_id: 2, from: { user_id: 2, first_name: 'Jane', last_name: 'Doe' }, text: 'Hi!' },
{ global_id: 3, chat_id: 10, message_id: 3, from: { user_id: 1, first_name: 'John', last_name: 'Doe' }, text: 'How are you?' },
...
]
const response = await index.addDocuments(messages, {
primaryKey: 'global_id'
})
const response = await index.search('hello', {
attributesToSearchOn: ['text'],
filter: 'from.user_id = 1 AND chat_id = 10'
})
i've been thinking about creating at least my own API for my own messenger (tm), but i've never thought about the search system. like, how the search bar in the telegram even work? i could not understand it until i tried out meilisearch. it's definitely a good experience overall, would recommend, ign, blah-blah-blah. wanna experiment with some other stuff more, probably will and probably will post it on here. stay tuned!log.Fatal (or even log.Panic? is it called this way? i dont actually remember) multiple lines? e.g. your log line is so long it's better to split it up into two lines. so you would normally do something like this: log.Fatal('... this is the first line');
log.Fatal('... this is the second line');
... expected (!) handling further ... but you would quickly see that your second line of logs would never be executed because of this non-explicit exiting behavior
secondly, "there will be a hint when you will be writing log.Fatal indicating that os.Exit is called under the hood". and what about those half of programmers that don't use IDEs and code editors that splash with a hint every now and then? this logic must be as simple as possible and as obvious as possible: log.Fatal means log`ging on a `Fatal error, nothing else. period. why the fuck does an os.Exit call even happen? for what reason?
thirdly, "just use Error" — why should i use not what i wanted to use? why are there some assumptions what and whatnot to use? i want to use fatal logging level (of course you know about logging levels, right? right???) and that's all, i dont want a logger to unexpectedly exit my program because golang developers went nuts when creating this language
damn this went into a brag really quick, kinda sorry for thatlog.Fatal(...)?! that's absurd to say the least!
imagine writing your own piece of code in which you log at a fatal level (e.g. something very-very-very bad happened), and then, all of a sudden, your program just crashes...? without saying anything? and you spend an hour or two just debugging and finding out that a logger has been exiting your process??
i wont quote everything that has been said on the site i linked to, but that's totally fucked up. this should not ever happen in any library unless the user has manually opted that in (e.g. passed a parameter like exitOnFatal: true or something)winterfall.ton, btw)
and then i remembered that i haven't coded anything for a while now, and that i want to work with graphics more (in context of typescript, image generation). this is when i thought it was a good idea to practice image generation to look alike Telegram's nft usernames. and this is why @nftygrambot was born.
its idea is simple — generate simple and deterministic images that look very much like Telegram's nft username images, but also support much more variety of inputs. as for now, it supports phone numbers (even +888 ones!), usernames (or, as the bot recognizes them, domains) and ips (like 1.1.1.1 or basically any other ip). all you have to do is /start the bot and write down the input (one of the described earlier types) and the bot will generate the image. if the bot does not answer — then input is bad.
this bot does not serve anything purposeful at all, instead, it's a reminder for me that image generation is fun or starts to get fun when you start involving all of yourself in it
also, recently i got interested in TON blockchain and its inner parts... we may release an nft collection based on these generated images... who knows?..
if you're interested as a developer, i made an api for this stuff, it's located at https://nft.starkow.dev/img and takes a input query parameter and returns either a image/png if input is valid or a json describing what went wrong