{"id":21075295,"url":"https://github.com/maxking/cs583-project","last_synced_at":"2025-08-07T05:05:23.738Z","repository":{"id":88048618,"uuid":"56478169","full_name":"maxking/cs583-project","owner":"maxking","description":"Project for CS583 class in Spring 2016.","archived":false,"fork":false,"pushed_at":"2016-06-08T03:58:24.000Z","size":69,"stargazers_count":0,"open_issues_count":4,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-14T03:44:37.247Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maxking.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-18T04:59:10.000Z","updated_at":"2019-01-22T01:44:06.000Z","dependencies_parsed_at":"2023-05-06T18:28:25.019Z","dependency_job_id":null,"html_url":"https://github.com/maxking/cs583-project","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/maxking/cs583-project","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxking%2Fcs583-project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxking%2Fcs583-project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxking%2Fcs583-project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxking%2Fcs583-project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxking","download_url":"https://codeload.github.com/maxking/cs583-project/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxking%2Fcs583-project/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269201296,"owners_count":24377460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-07T02:00:09.698Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T19:21:18.699Z","updated_at":"2025-08-07T05:05:23.688Z","avatar_url":"https://github.com/maxking.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"hasbot (CS583 Project)\n=============\n[![Build Status](https://travis-ci.org/maxking/cs583-project.svg?branch=master)](https://travis-ci.org/maxking/cs583-project)\n\nThis is an IRC bot that exposes haskell functions over a chat interface.\nMore details can be found in Proposal.doc\n\nLink to the project: https://github.com/maxking/cs583-project\n\nProject Members:\n- Abhilash Raj\n- Deepthi S Kumar\n\nDependencies\n------------\n\n- [simpleirc][1] : A small IRC networking library in haskell.\n- [parsec][5]\n- [warp-3.2.6][6]\n\nHow to Run\n----------\n\nTo run this project, you can build this project by:\n\n```bash\n$ git clone https://github.com/maxking/cs583-project\n$ cd cs583-project\n$ cabal build\n```\n\nThen you can run the program like:\n\n```bash\n$ ./dist/build/hasbot/hasbot\n```\n\nThis will run the bot and connect it to IRC (Internet Relay Chat) network. To\ninteract with the bot, open an irc client or a [web client][2] and join the\nchannel `##maxking` and you will find the bot there with nick `hasbot`.\n\nFor now, the bot just responds to simple IRC commands like\n```\n\u003e!hi\nHello!\n\n\u003e !add 3 4\n7\n\n\u003e !neg -9\n9\n```\n\nAnything else that you type is echo'd back from the bot.\n\nFeatures\n--------\n\n- hasbot connects to `Frenode` network by default and joins `##maxking` channel\n- It logs all the conversation on the channel internally\n- Logs are accesible through web at `http://localhost:3000`\n- The webserver and irc bot run in two seperate threads that are created using\n  [forkIO][3].\n- hasbot responds to the commands on the channel `##maxking` and also over\n  private message.\n- `!help` command presents a list of all the availabe commands along with usage\n  for each of the commands.\n- `!search` commands accepts one or more words to search in the history of the\n  channel. The searching algorithm itself is naive and slows down as the length\n  of the channel history increases.\n\n\nTODO\n----\n\n- Make it easy to add more commands (right now only !add and !neg\n  commands are available)\n\n\nInternal Design\n---------------\n\nAll messages are of type `IrcMessage` and have following important attributes:\n\n- `mNick` : Nickname of the sender\n- `mUser` : Realname of the sender\n- `mHost` : Hostname of the sender\n- `mServer`: Server address of the sender\n- `mCode` : IRC code for the message, almost always defaults to `PRIVMSG`\n- `mChan` : Sent to, either a channel or to the channel or nick\n- `mOrigin` : Sent by, if private message then sender else channel\n- `mRaw` : Raw message.\n\nWhen a message is received, it can be of three types:\n\n1. Sent to the channel\n2. Sent to the channel but starting with `hasbot:` to highlight\n3. Sent as private message to the bot\n\nIn each of the three cases above we perform the following actions:\n\n- 1: Just log the message to a file\n- 2: Parse the command in the message and respond to the sender with a response\n    on the channel that the command was recieved on\n- 3: Do the same processing as (2) but send the response as private message to\n  sender\n\nThe raw message extracted from the IrcMessage is then parsed to get a value of \nChatMsg type. The parser is written using the parsec parser combinator library.\n\nA ChatMsg can be a command or some text. A command is prefixed by \"!\" symbol\nand followed by arguments\nNew commands can be easily added without any changes required at the command\nprocessing level. This is facilitated by the higher order abstract syntax of the\nCommand data type. The user who wants to add new commands can do so by defining \ntwo functions, one to convert the arguments from String to the required types\n(*transform*) and the other which performs the operation (*execute*).\n\nThe example commands hi, neg and add that takes zero, one and two arguments\nrepectively can be used as reference to add new commands.\n\nThe type of *transform* function is \u003ccode\u003e[String] -\u003e a \u003c/code\u003e and that of \n*execute* function is \u003ccode\u003ea -\u003e String\u003c/code\u003e. The type parameter \u003ccode\u003ea\u003c/code\u003e\nhere needs to same only for the command that is being defined and not all the\ncommands. This is achieved by using [existential types][4].\n\n\nDesign Questions\n----------------\n\n- Handling messages that are not commands. There is no framework for dealing with \n  such messages. They are simply echo'd back to the channel.\n\n- How to make the design modular so that commands can be added over the chat\n  interface itself.\n\n\n\n[1]: https://hackage.haskell.org/package/simpleirc-0.3.1/docs/\n[2]: https://webchat.freenode.net/\n[3]: https://hackage.haskell.org/package/base-4.9.0.0/docs/Control-Concurrent.html#v:forkIO \n[4]: https://wiki.haskell.org/Existential_type\n[5]: http://hackage.haskell.org/package/parsec\n[6]: https://hackage.haskell.org/package/warp-3.2.6/docs/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxking%2Fcs583-project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxking%2Fcs583-project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxking%2Fcs583-project/lists"}