 Hi everyone. I'm Dan. I used to JavaScript, but today I'm making a statement to present in Goal. So it's like my first, actually more than one month with the Play with Goal lang. And I tried to choose to build a chatbot. So I mean it's easier for me that I want to learn about the user experience. Also I want to learn about different aspects. I mean how to implement this task in Goal lang. The platform, I pick actually is quite similar to last minute we have presentation by Valentin about the bot. So if you ever use a chatbot named Telegram, actually it's like similar to WhatsApp or Viber. But it has API and it's actually like very easy to use. You can actually program your, you can call the API and you can retrieve the information. Just recently around two months ago, they published an API for the bot. So even beauty on bot is like the bot in the Slack chat. But I mean it's really directly in the Telegram chat application. So you can go to this website. The Telegram store is quite similar to Apple store. They have at least all the most popular, actually my mod is around the other bottom. I'll show you guys later. So how to start to build this one, I mean it's actually quite easy. You just try to get some idea. Then you try to connect with the bot father which actually is a Telegram server. You get an API, then you try to run service from your computer or any server. Maybe Amazon or anything. You just define a programming logic. For example, the chat app is actually, the chat board is like a user will send you a comment. You just need to respond it. So it's just like HTTP handle function. That's all one, I think like most popular comment is, I mean when the user starts, then you say we send you the start slash start command. Or if they are looking for help, then you need to define the response message. So user can get start. So here's my bot. I just pick a very simple, I mean user application, dictionary. I mean people like to look up for words. So the logic is like, it's just like I let user type any word. Just as we respond with the definitions. That's all one special case like if the word in the comment is from a group chat, then I had the filter, I mean if the chat message contains my bot name, then I will do the processing. Otherwise, I mean like, because possibly there's a lot of people, I mean a lot of conversions in the chat. I mean the chatbot is not supposed to respond to every message in the chat. So how is the telegram chatbot working? You can imagine it's like actually the chatbot in my computer communicate with the user via the telegram server. What I do is I just try the polling. I will get the message request. In the case of telegram, it will be less than 100. The most recent one. The polling API is like the last bit of something. I just put like some, the value of the offset and the limit. So it's very easy to, I mean you can use your terminal to see what's going on with the message. The implement in Goliath, I use the telebot library. This bot, actually we get a token if we create a channel. And then we accumulate every two seconds. So every time two seconds, I will have a new message coming. And I will put it in the message. I just do the processing inside the loop before loop. So it seems easy, but actually when I launch it, then a lot of things happen. Here's another flowchart for how I send the response to the telegram server. The response we send to the users. So telegram is quite fun because it actually provides developers. You can actually create a customized reply keyboard. You can put all the mld cons. The layout, you can divide it like a few rows. Under each row you can put a few columns. So it's actually very, I think it's better than WhatsApp or other chat applications in this respect. Okay, so here's my missionaries. So I put all the words over there. Every time the user sends a word, then I look up in the... In my case, actually it's a map. So if it exists, then I return the value. Otherwise, that's returned on. I can't find it. So the mode we send the message to the relations and the markdown layout. Which means that I can actually display different mld cons in the chat response. Okay, I think at first launch there is quite positive feelings. I got a number of reviews on telegram store. That means a number of reviews increasing at my start again. Increasing every day. So a bit encouraging. And even the telegram store will send me a chat. I'm the best. Sorry, I'm the second one. This one is like a test sound. I named it TestSolutionary. Yeah, so I'll get it for start. 85 people rating it after 5 days. If you want to have a... Take a look at my... If you have telegram on your phone, you can text it out. So I named it like a show. It tastes always more than this one. So yeah, you can look for the TestSolutionary dictionary. You can try it out. When you send the message, then you just type anything. For example, you want to type... You want to look for TestSolutionary on a bit. Each of you show a list of all the... What actually is it that I put from static dictionary. It's an open source. Yeah, back to presentation. But I mean, after that, I also have another... The chat application as well. I mean, since I'm Vietnamese, so I think about... Why not I'm doing Vietnamese dictionary? So it's more interesting than English. So this one is English. I mean, I just type a word on that. Especially this one, I make it more richer feature. I can change it from English to Vietnamese. And also from Vietnamese to English. The logo. I notice actually, I mean, to make it more catchy on... The word store. I think since all the word has is our logo. So I mean, if I make... Pay more attention about the logo, then maybe the users will be more interested. So... Oh yeah, this one. So I think let's try to make it like... The coin head is like a symbol of a Vietnamese costume. So let's try to make it like a simple... Get some impression. So that means initially, I just have a... Hello, since I'm Vietnamese, I try to make it like flat design. They make it more separate lines. Maybe just one word on the top and one word on the bottom. After that, I think too many words. Maybe that's the icon is now. But hopefully, I'll phrase that or maybe... The thing about this one is it's like a face and air or a face and something related. So maybe I just put some... Some text where I mean, these are final versions. And it looks like... More readable in the... If I look at the applications. So for example... Yeah, I mean, I still able to see the... Notice the coin head way here. So it's the logo on... To know how much users actually use these chat applications. Think about why not use some... Some web list to know the frequency. What is the most frequently used... Users when to look at. What is the time in... I don't want to know which is the most active user's birthday or something. So it's actually quite good in... Recording those numbers. Over here, I use... Specific feature has... Short set. So every time when user send a message, I just put it in the short set. And every time I increase, increment may want. So eventually I have... I can short the set with free... You can see the score. Yeah, I will show you guys later. Apart from that, I also use GoLang to... Since the user may put the... Applications, sometimes actually it died. Long ago, I was just starting. So if there are some errors in my chat apps, I have to shut down the whole applications. The next morning I wake up and... When I'm chatting, there's no response. Because the applications died on the server. So I set up a message, a login, an email. Every hour, so I can check in my email. So it's better than going to look up the server every time. What do you try to supervise the... Supervise the... Yes, but I mean, other time, I want to know... What is the behavior, user behavior? I want to observe it, how... With the kind of message they are sending. So I believe observing the log is... I try to use GoLang routine, but... There's a lot of errors along the way. So I decided to... Maybe I'll try later after the app is... The board is more stable. Will this be the hardest thing to do? Yeah. Okay, so... Yeah, so I set up this... The most one is like... I mean... These users, they don't know what the board is about. They are just like... Okay, so for the analytics... Then... Okay, here's my server. I'm running the board on the neural server. The good thing about GoL is... The memory footprint is quite small. It's only a good pile, maybe 2% or 3% of the CPU. So now, if I try to show the analytics, I need to log in to read this. Okay, so I just need to check the shortlist. The shortlist, what is the most frequently... I can see the scores, which actually is the frequency. So... Yeah, I mean the more number, I mean the more high frequency all of the users. So if I change this one to users, or they can see that somebody like... They access a lot, they try to... To access like 100... For 100 words, but I mean... Sometimes I need to think about it like... If they do some spam. And actually I got some cases, actually... You can add a lot of telegram boards in one group chat. I mean you can use one of your boards actually just try to send random messages. And all the other boards, you get spam. So I think my board actually... I encountered some... Several cases. So I mean from the number of frequency, I know that it's a group or a user group, you will have a negative ID. Users... From the frequency, I can see how come this user access my... I mean, query my board too many times per day. So yeah, I need to... To care about the spam. So I use the regular expressions to try to validate the board input. I mean, I don't respond to long messages. So it should be reduced a lot for my server. The group message, actually... The group message, we only have... I mean, I only answer... I mean, I respond to which message has my board name inside. Because it's small. It's a correct way to make my board small. It's about correct behavior. And also, Blacklist is a spammer. So spammers, we have the ID. I put the ID in the... So if I get the message from the spammer, then I just skip it. So yes, it's something you can actually try to play with. I mean, to create your own board. I mean, think about some idea. Use some libraries. I use this library. Oh yeah, it's not my name. Sorry, I need to change the link later. But it's a... There is a... My fork... My fork reports the original report. So it's actually create a channel of all the messages incoming and process it sequentially. But I mean... Actually, the other library is quite good. I think maybe this one... Valentine used last time. Is it the one you're using? No. Okay. Actually, the board API is just a mess API. So you can just call... Yes. It's the other API that's not very likely to play. Was it a play with encryption or something? Okay, so actually I can show you a bit of code. I use this... Yeah, this library took that to the board. I also create my own... package too. So I mean, try to learn how to go in... package and go working. I can define it on some predefined message. I mean, try to send it over the board. So the board will respond. And we go to several functions to get the message like, what do you see over here? So... So Vera is what I learned during the... my first time with GoLang. I learned how to connect with the API using RedFools because the library is in the RedFools. I actually studied the code. And it takes us really... to stop code after it gets improved better. Actually, I tried to... to make a... pull request to the original. I feel quite happy that he accepted it. Using a lot of email notifications. So I use a local rules library on email notifications. Yeah, it's just a control. How do you say you do it? I use an American API. Yeah, so it's a GoLang stuff. So building analytics, using various... I can write a package. Most importantly, it's a user experience I learned at work. Sometimes it's a bug. Then I mean, how to... to diagnose the problem and understand the user's better. For example, in my chat application, I think if I put... definition of the word, it's too... It's a bit simple. Everyone can do that. So maybe I do some translations from sentence to sentence. So for example, I type a long, long sentence. Yeah, so actually, the more we respond with the whole sentence. This one, actually, I connect to... I use a YAM deck translation. To let me together... Of course, if the user send me too many requests, I will hit the limit. It's the limit of the API, but I think that's fine. Yeah, just try to make... add features to my applications time by time, so we get more... user friendly, so we get more upvoted in telegram stuff. So my mode now is like... Yeah, when I fix style already, sorry, when I fix reviews already. Yeah, so, yeah, someone would be happy. I have to consider, looking at analytics, right? More than 60-70% of your words are similar. Have you considered caching these words to look up words inside a whole video? Yeah, correct. I also... Yeah, someone is one of the... improvement I did at the beginning. Means I use red list also for caching as well. So all the words... Over here, if I check, it actually exists in the variable. Yeah, great difference from the database. If I can get it from the red list, then actually I will return it immediately. Yeah, I check all the words over here. That's why I just query in the map... the map variable. So it's actually... speed up my... application. You can now process more messages per second. Yeah, that's already... Here it is. This method, when you asked for code routine, you said mention that you face some problems with it. Can you explain what exactly the problems you face? Because this looks like a really code routine for you. Yes, I think the point may not come from your side. The problem is still like hang or something. Just to help you, was it a connection issue that you face when you have multiple code routines? Because let's say 100 people query at the same time and... Instead of going synchronous... In this... I didn't use... I just used channel. So the message will pass the channel and the channel will come accused and I just process it like sequentially. Yeah, that's why I'm asking... Can you consider using code routine and then change back because of problems or... I do. Because I also use... I mean, I try to use another library but I feel that the speed is not fast as I expect. The code routine, is it? Because it sometimes... we process later. But it doesn't mean it process immediately. So... I still need to do testing and actually I wait for my... my chat more stable than PPI we try to... to run on just one. Oh yeah, so... Yeah, like I said... Some of the problems we suffer from you, from the developer is from the Telegram server. Because Telegram server is actually only... only give you like 100 messages per second and sometimes if you boring too... too many messages... the frequency is too small. It's too large per... per period of time it will block your PPI code. Because it exceeds the number of messages querying. So actually I need to take... sometimes I need to take three days to realize that. Send like every two seconds of it and now I reduce only 10 seconds to send a boring message. If the boring is not the issue it's going to go looking straight. You can of course fix the number of maximum number of go-go-go-things that go is allowed to run so quickly. If your maximum limit is 100 and Telegram shops you after that instead of stopping using go-go-things you can still use it but restrict the maximum number of go-go-things possible so that it doesn't reach the limit. Because of the Telegrams... Yeah, it's out of my control so... So it's still like... because of the lock we send to my email so... at least I know it's still healthy and somebody still like... look at it. So yeah, you can... if you have Telegram you can try to... Yeah, at least you can try to... you can try to... you can try to... you can quit your... I think it's work very easy try to find some medium try to... to learn your language. In your issue where you said on how you mitigated the spam rate you said you blacklisted people Can you explain how... is it like blacklisted Telegrams the Telegram ID or blacklisted IP or... I just blacklisted the user ID user ID Yes, wait. Even the user ID changes they can change it or is it... Oh, really? Yeah, that's why I need to look at the analytics to see if they... Some people don't even have user ID so you know how it goes like this Do you? They think the user ID they can change, right? The user name can change or the name can change but the ID is like... then probably like... you will get another four What's your problem? How do you blacklisted? Is it in the code? Oh, yes. So for blacklisted I just keep the message actually I don't do anything I mean I have to... to reduce from this I put in the... notice I mean I have ID I checked about the key actually this guy Yeah, then he will come like... I love it and actually like... I skip the message What's the threshold for blacklisted? Are there messages in the code? Is that a threshold? No, no, I think it's... from the list if they spot me, I mean the all messages in one hour will become like... but actually it becomes the case like when I... how come there's a lot? A few megabytes in just like a few hours and I see it forms the pattern and I can... rest or actually somebody try to spot me so... I might not still do it manually but I hope I can find a more automatic way to do it Do you have any questions? Yeah, exactly. I hope you can build your own board at home so... you can run on your computer and you go to work or go study and after come back, turn on the board and start processing because the message always stay in the telegram server