linelib


Namelinelib JSON
Version 2.2.1 PyPI version JSON
download
home_pagehttps://github.com/AWeirdScratcher/linelib
SummaryThe solution to simplicity.
upload_time2023-02-06 04:39:13
maintainer
docs_urlNone
authorAWeirdScratcher
requires_python
licenseMIT
keywords line bot line bot sdk line notify commands
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
  <img src="https://user-images.githubusercontent.com/90096971/213644783-f525dd20-af78-4181-b665-fd6506410bde.png" alt="LINELIB Banner" />

# LINELIB v2.2
**The All-in-One LINE Bot Integration Solution.**

[![Get Started β†’](https://img.shields.io/badge/Get_Started_β†’-2ea44f?style=for-the-badge&logo=line&logoColor=ffffff)](https://github.com/AWeirdScratcher/linelib/wiki)


### Installation
Use the following, or clone this repository.
  
```ruby
$ pip install -U linelib
```

</div>

# πŸ”‘ Features[.](https://google.com/search?q=dont+click+bro)

<div>
  <img src="https://user-images.githubusercontent.com/90096971/213690282-662ec477-b826-4fa4-9184-abcd8f0230d8.png" alt="Code Example" align="left" width="450" />
  <div>
    
  ## ✨ Optimized Source Code.
  Cleaner source code is beneficial because it is easier to read, understand, and maintain. It's easier for you to add new features, fix bugs, and understand how the code works. Clean code is also more efficient, as it is optimized for performance and is less likely to contain errors or bugs. It is also more reusable, allowing you to use it in other projects without having to rewrite it.
    
  [![  - See Example β†’](https://img.shields.io/badge/_-See_Example_β†’-06c755?style=for-the-badge&logo=python&logoColor=ffffff)](#1-quick-example)
    
  </div>

</div>

<br /><br /><br />

<img src="https://user-images.githubusercontent.com/90096971/213693396-83c0c20a-a30a-4648-b546-05c7019f10a0.png" width="150" alt="LINE Notify Mockup" align="right" />

## 🧩 With Extensions[.](https://i.kym-cdn.com/entries/icons/original/000/021/154/image.jpeg)
**With LINELIB, you can easily and efficiently integrate various LINE services into your projects and applications, all with just a few lines of code.** LINELIB simplifies the process of working with LINE services, making it more accessible and streamlined for developers of all skill levels. Whether you're looking to add messaging functionality, connect with LINE's social media platform, or utilize other LINE services, LINELIB makes it simple to do so with minimal code requirements.

LINELIB currently supports these LINE services:
- LINE Messaging API
- LINE Notify
- LINE Social Plugins

[![  - LINE Notify Example →](https://img.shields.io/badge/_-LINE_Notify_Example→-06c755?style=for-the-badge&logo=python&logoColor=ffffff)](#2-line-notify-example)

## πŸ’ͺ More advanced.
**Create text commands like a pro.** 

Linelib helps you to quickly and efficiently create text commands by organizing them inside cogs!

<img alt="Greeting Command Source Code" src="https://user-images.githubusercontent.com/90096971/216757621-b3b462f9-c744-42f1-bb7c-340c6b6ebf21.png" width="800" />

<div align="center">
  
  # Ready to give it a shot?
  Oh my goodness, you're here! I'm hyped to see that you're willing to give it a go.
  
  Anyways, here are some helpful links that can get you around with LINELIB:
  
   [πŸš€ See More Examples](https://github.com/AWeirdScratcher/linelib)

   [πŸ“– Documentation](https://github.com/AWeirdScratcher/linelib/wiki/documentation)
  
</div>

# πŸŽ‰ Examples.
"Don't just talk. Show me some examples!" I hear you say...

## 1: Quick Example
```py
from linelib import Client

client = Client('channel secret', 'channel access token')

@client.event('ready')
async def ready():
  print('I am ready!')
  
client.run()
```

## 2: LINE Notify Example
```py
from linelib import Client
from linelib.notify import Notify

client = Client('channel secret', 'channel access token')
notify = Notify("access token")

@client.event('ready')
async def ready():
  await notify.notify("Daily News:\nLinelib version 2 has released!!11!")
  
client.run()
```

## 3: Simple Command Cog
This is a simple cog with the command "hello", which requires one argument (times) in order to work.

User: `hello 10`

Bot: `You greeted me 10 times!`

```py
from linelib import Client
from linelib.ext import commands

client = Client('channel secret', 'channel access token')

class MyCog(commands.Cog):
  @commands.cog_command(name="hello")
  async def greet_command(self, ctx, times: int):
    # "self" is required!
    await ctx.reply(f"You greeted me {times} times!")

client.load_cog(MyCog())
client.run()
```

## 4: Advanced Command Cog
This is a more advanced command cog with command rules, and rule rejection handlers.

The command (say) requires one argument "text", but you should add a "*" in the `greet_command` coroutine function to tell linelib to pass the rest of the message content into the argument ("text").

User: `say I love chocolate!`

Bot: `I love chocolate!`

1 second later...

User: `say I still love it.`

Bot: `The cooldown is 10 seconds long! Please wait.`

```py
from linelib import Client
from linelib.ext import commands, rule

client = Client('channel secret', 'channel access token')

class MyCog(commands.Cog):
  @commands.cog_command(
    name="say",
    rule=rule.CommandRule(
      rule="cooldown",
      seconds=10
    )
  )
  async def greet_command(self, ctx, *, text):
    # "self" is required!
    await ctx.reply(text)
    
  @greet_command.rule_reject
  async def rejected(self, ctx):
    await ctx.reply('The cooldown is 10 seconds long! Please wait.')

client.load_cog(MyCog())
client.run()
```

## 5: Custom Rule (Advanced)
Custom rules must have a function named "handler". The handler must return a valid boolean (`True` or `False`).

`True` represents that the user is able to use the command, vice versa.
```py
from linelib.ext import rule

class MyRule(rule.CommandRule):
  def handler(self, ctx):
    # ... your awesome code
    return True # must return True or False
    
MyRule(rule="based.custom") # Now, it's a valid command rule.
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/AWeirdScratcher/linelib",
    "name": "linelib",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "line,bot,line bot,sdk,line notify,commands",
    "author": "AWeirdScratcher",
    "author_email": "aweirdscrather@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/11/c3/3895690dee49c835f8731f274a42e73dad78396203e08c77f71ea8a3d848/linelib-2.2.1.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n  <img src=\"https://user-images.githubusercontent.com/90096971/213644783-f525dd20-af78-4181-b665-fd6506410bde.png\" alt=\"LINELIB Banner\" />\n\n# LINELIB v2.2\n**The All-in-One LINE Bot Integration Solution.**\n\n[![Get Started \u2192](https://img.shields.io/badge/Get_Started_\u2192-2ea44f?style=for-the-badge&logo=line&logoColor=ffffff)](https://github.com/AWeirdScratcher/linelib/wiki)\n\n\n### Installation\nUse the following, or clone this repository.\n  \n```ruby\n$ pip install -U linelib\n```\n\n</div>\n\n# \ud83d\udd11 Features[.](https://google.com/search?q=dont+click+bro)\n\n<div>\n  <img src=\"https://user-images.githubusercontent.com/90096971/213690282-662ec477-b826-4fa4-9184-abcd8f0230d8.png\" alt=\"Code Example\" align=\"left\" width=\"450\" />\n  <div>\n    \n  ## \u2728 Optimized Source Code.\n  Cleaner source code is beneficial because it is easier to read, understand, and maintain. It's easier for you to add new features, fix bugs, and understand how the code works. Clean code is also more efficient, as it is optimized for performance and is less likely to contain errors or bugs. It is also more reusable, allowing you to use it in other projects without having to rewrite it.\n    \n  [![  - See Example \u2192](https://img.shields.io/badge/_-See_Example_\u2192-06c755?style=for-the-badge&logo=python&logoColor=ffffff)](#1-quick-example)\n    \n  </div>\n\n</div>\n\n<br /><br /><br />\n\n<img src=\"https://user-images.githubusercontent.com/90096971/213693396-83c0c20a-a30a-4648-b546-05c7019f10a0.png\" width=\"150\" alt=\"LINE Notify Mockup\" align=\"right\" />\n\n## \ud83e\udde9 With Extensions[.](https://i.kym-cdn.com/entries/icons/original/000/021/154/image.jpeg)\n**With LINELIB, you can easily and efficiently integrate various LINE services into your projects and applications, all with just a few lines of code.** LINELIB simplifies the process of working with LINE services, making it more accessible and streamlined for developers of all skill levels. Whether you're looking to add messaging functionality, connect with LINE's social media platform, or utilize other LINE services, LINELIB makes it simple to do so with minimal code requirements.\n\nLINELIB currently supports these LINE services:\n- LINE Messaging API\n- LINE Notify\n- LINE Social Plugins\n\n[![  - LINE Notify Example \u2192](https://img.shields.io/badge/_-LINE_Notify_Example\u2192-06c755?style=for-the-badge&logo=python&logoColor=ffffff)](#2-line-notify-example)\n\n## \ud83d\udcaa More advanced.\n**Create text commands like a pro.** \n\nLinelib helps you to quickly and efficiently create text commands by organizing them inside cogs!\n\n<img alt=\"Greeting Command Source Code\" src=\"https://user-images.githubusercontent.com/90096971/216757621-b3b462f9-c744-42f1-bb7c-340c6b6ebf21.png\" width=\"800\" />\n\n<div align=\"center\">\n  \n  # Ready to give it a shot?\n  Oh my goodness, you're here! I'm hyped to see that you're willing to give it a go.\n  \n  Anyways, here are some helpful links that can get you around with LINELIB:\n  \n   [\ud83d\ude80 See More Examples](https://github.com/AWeirdScratcher/linelib)\n\n   [\ud83d\udcd6 Documentation](https://github.com/AWeirdScratcher/linelib/wiki/documentation)\n  \n</div>\n\n# \ud83c\udf89 Examples.\n\"Don't just talk. Show me some examples!\" I hear you say...\n\n## 1: Quick Example\n```py\nfrom linelib import Client\n\nclient = Client('channel secret', 'channel access token')\n\n@client.event('ready')\nasync def ready():\n  print('I am ready!')\n  \nclient.run()\n```\n\n## 2: LINE Notify Example\n```py\nfrom linelib import Client\nfrom linelib.notify import Notify\n\nclient = Client('channel secret', 'channel access token')\nnotify = Notify(\"access token\")\n\n@client.event('ready')\nasync def ready():\n  await notify.notify(\"Daily News:\\nLinelib version 2 has released!!11!\")\n  \nclient.run()\n```\n\n## 3: Simple Command Cog\nThis is a simple cog with the command \"hello\", which requires one argument (times) in order to work.\n\nUser: `hello 10`\n\nBot: `You greeted me 10 times!`\n\n```py\nfrom linelib import Client\nfrom linelib.ext import commands\n\nclient = Client('channel secret', 'channel access token')\n\nclass MyCog(commands.Cog):\n  @commands.cog_command(name=\"hello\")\n  async def greet_command(self, ctx, times: int):\n    # \"self\" is required!\n    await ctx.reply(f\"You greeted me {times} times!\")\n\nclient.load_cog(MyCog())\nclient.run()\n```\n\n## 4: Advanced Command Cog\nThis is a more advanced command cog with command rules, and rule rejection handlers.\n\nThe command (say) requires one argument \"text\", but you should add a \"*\" in the `greet_command` coroutine function to tell linelib to pass the rest of the message content into the argument (\"text\").\n\nUser: `say I love chocolate!`\n\nBot: `I love chocolate!`\n\n1 second later...\n\nUser: `say I still love it.`\n\nBot: `The cooldown is 10 seconds long! Please wait.`\n\n```py\nfrom linelib import Client\nfrom linelib.ext import commands, rule\n\nclient = Client('channel secret', 'channel access token')\n\nclass MyCog(commands.Cog):\n  @commands.cog_command(\n    name=\"say\",\n    rule=rule.CommandRule(\n      rule=\"cooldown\",\n      seconds=10\n    )\n  )\n  async def greet_command(self, ctx, *, text):\n    # \"self\" is required!\n    await ctx.reply(text)\n    \n  @greet_command.rule_reject\n  async def rejected(self, ctx):\n    await ctx.reply('The cooldown is 10 seconds long! Please wait.')\n\nclient.load_cog(MyCog())\nclient.run()\n```\n\n## 5: Custom Rule (Advanced)\nCustom rules must have a function named \"handler\". The handler must return a valid boolean (`True` or `False`).\n\n`True` represents that the user is able to use the command, vice versa.\n```py\nfrom linelib.ext import rule\n\nclass MyRule(rule.CommandRule):\n  def handler(self, ctx):\n    # ... your awesome code\n    return True # must return True or False\n    \nMyRule(rule=\"based.custom\") # Now, it's a valid command rule.\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "The solution to simplicity.",
    "version": "2.2.1",
    "split_keywords": [
        "line",
        "bot",
        "line bot",
        "sdk",
        "line notify",
        "commands"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "11c33895690dee49c835f8731f274a42e73dad78396203e08c77f71ea8a3d848",
                "md5": "e05799f8f51ec8482b1c8d3d673df301",
                "sha256": "8cb807f91bfdc6378b0b06596cc07669cac9e5223cff566f1b52fa14a395ad12"
            },
            "downloads": -1,
            "filename": "linelib-2.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e05799f8f51ec8482b1c8d3d673df301",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 28738,
            "upload_time": "2023-02-06T04:39:13",
            "upload_time_iso_8601": "2023-02-06T04:39:13.908841Z",
            "url": "https://files.pythonhosted.org/packages/11/c3/3895690dee49c835f8731f274a42e73dad78396203e08c77f71ea8a3d848/linelib-2.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-06 04:39:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "AWeirdScratcher",
    "github_project": "linelib",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "linelib"
}
        
Elapsed time: 0.04032s