phonkd-bot


Namephonkd-bot JSON
Version 1.0.0 PyPI version JSON
download
home_page
SummaryA framework that makes discord bot programming easy
upload_time2023-11-02 10:33:47
maintainer
docs_urlNone
authorPhonki
requires_python
license
keywords python discord
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
<pre>
██████╗ ██╗  ██╗ ██████╗ ███╗   ██╗██╗  ██╗██████╗     ██████╗  ██████╗ ████████╗
██╔══██╗██║  ██║██╔═══██╗████╗  ██║██║ ██╔╝██╔══██╗    ██╔══██╗██╔═══██╗╚══██╔══╝
██████╔╝███████║██║   ██║██╔██╗ ██║█████╔╝ ██║  ██║    ██████╔╝██║   ██║   ██║   
██╔═══╝ ██╔══██║██║   ██║██║╚██╗██║██╔═██╗ ██║  ██║    ██╔══██╗██║   ██║   ██║   
██║     ██║  ██║╚██████╔╝██║ ╚████║██║  ██╗██████╔╝    ██████╔╝╚██████╔╝   ██║   
╚═╝     ╚═╝  ╚═╝ ╚═════╝ ╚═╝  ╚═══╝╚═╝  ╚═╝╚═════╝     ╚═════╝  ╚═════╝    ╚═╝   
---------------------------------------------------------------
A framework that makes discord bot programming easy
</pre>

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

</div>

## Installation and setup

Run this command in your terminal, it will download the framework along with the [discord](https://discordpy.readthedocs.io/en/stable/api.html) and [asyncio](https://docs.python.org/3/library/asyncio.html) libraries.

```shell
pip3 install phonkd_bot
```

Create a file named `config.json` in the same directory as your script. Copy and paste your bot token (from [discord.com/developers](https://discord.com/developers/applications)) into the file. The prefix field is optional.
```json
{
    "prefix": "/",
    "token": "YOUR BOT TOKEN HERE"
}
```

## Creating a Discord Bot
1. Go to [discord.com/developers/applications](https://discord.com/developers/applications)
2. Click `New Application`
3. Give the bot a name, agree to the terms, then click `Create`
4. (optional) give the bot a profile picture, tags, and or a description, then click `Save Changes`
5. Go to the `Bot` page on the side panel
6. (optional) give the bot a username
7. Click `Reset Token`, `Yes, do it!` and `Copy`, save the token somewhere safe
8. Allow `Presence Intent`, `Server Members Intent`, and `Message Content Intent`
9. Click `Save Changes`
10. Expand `OAuth2` on the side panel and go to `URL Generator`
11. Check `bot`, this will reveal `Bot Permissions`, you will need to check `Administrator` in this new section
12. Scroll down, and open the generated url in another tab
13. Select the server to add the bot to and click `Continue`
14. Make sure `Administrator` is checked and click `Authorize`
15. Do the captcha (if one appears) and close the window once you see `"Success!"` on your screen

## Usage Example

### Importing the bot

```python
import phonkd_bot
```

### Creating a bot instance

```python
bot = phonkd_bot.DiscordBot()
```

### Responding to messages
- Adding the `phonkd_bot.message` type hint to the `message` parameter allows your code editor to autocomplete attributes of the discord [`Message`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Message) object, see their [documentation](https://discordpy.readthedocs.io/en/stable/api.html#discord.Message) for more information.
- The function passed into `call_on_message` will be called when a the bot receives a message. The return value is what the bot will respond with.
- The framework will pass a discord.Message object as a paramater to the function provided to `call_on_message`.
```python
def on_message(message: phonkd_bot.message):
    return "Hello!"

bot.call_on_message(on_message)
```

### Activating the bot

```python
bot.start()
```

### Logging Information

The `DiscordBot` class has a sub class called `logger`. The `logger` class has multiple methods that will help you debug or catch errors in your script. These methods are:
- `logger.info`
- `logger.warning`
- `logger.error`
- `logger.critical`

Here is an example script.

```python
import phonkd_bot

bot = DiscordBot()

bot.logger.info("info message")
bot.logger.warning("warning message")
bot.logger.error("error message")
bot.logger.critical("critical error message")
```

This is the result.

![image of terminal containing logged information](https://i.imgur.com/wiIKZEQ.png)

### Example Discord Bot Script

```python
import phonkd_bot

bot = phonkd_bot.DiscordBot()

def on_message(message: phonkd_bot.message):
    return "Hello!"

bot.call_on_message(on_message)
bot.start()
```

This is the result.

![image of discord bot saying hello](https://i.imgur.com/4hcMWHE.png)

## Meta
Gmail - phonkibusiness@gmail.com

Github - https://github.com/RealPhonki

Find me on the Python Discord Server - https://discord.com/invite/python

Discord Tags - `Phonki#0090`, `slamsandwich19`

Code distributed under the MIT license. See `LICENSE` for more information.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "phonkd-bot",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python,discord",
    "author": "Phonki",
    "author_email": "<phonkibusiness@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/7f/cd/568b3d764ee14d4239b6a93feeded4e5d61dc584b0c410639a4ccba34f0c/phonkd_bot-1.0.0.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n<pre>\n\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557  \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2557  \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557     \u2588\u2588\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\n\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u255d\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557    \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557\u255a\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255d\n\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2554\u255d \u2588\u2588\u2551  \u2588\u2588\u2551    \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551   \u2588\u2588\u2551   \u2588\u2588\u2551   \n\u2588\u2588\u2554\u2550\u2550\u2550\u255d \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2588\u2588\u2557 \u2588\u2588\u2551  \u2588\u2588\u2551    \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551   \u2588\u2588\u2551   \n\u2588\u2588\u2551     \u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551  \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d    \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d   \u2588\u2588\u2551   \n\u255a\u2550\u255d     \u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d\u255a\u2550\u2550\u2550\u2550\u2550\u255d     \u255a\u2550\u2550\u2550\u2550\u2550\u255d  \u255a\u2550\u2550\u2550\u2550\u2550\u255d    \u255a\u2550\u255d   \n---------------------------------------------------------------\nA framework that makes discord bot programming easy\n</pre>\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n</div>\n\n## Installation and setup\n\nRun this command in your terminal, it will download the framework along with the [discord](https://discordpy.readthedocs.io/en/stable/api.html) and [asyncio](https://docs.python.org/3/library/asyncio.html) libraries.\n\n```shell\npip3 install phonkd_bot\n```\n\nCreate a file named `config.json` in the same directory as your script. Copy and paste your bot token (from [discord.com/developers](https://discord.com/developers/applications)) into the file. The prefix field is optional.\n```json\n{\n    \"prefix\": \"/\",\n    \"token\": \"YOUR BOT TOKEN HERE\"\n}\n```\n\n## Creating a Discord Bot\n1. Go to [discord.com/developers/applications](https://discord.com/developers/applications)\n2. Click `New Application`\n3. Give the bot a name, agree to the terms, then click `Create`\n4. (optional) give the bot a profile picture, tags, and or a description, then click `Save Changes`\n5. Go to the `Bot` page on the side panel\n6. (optional) give the bot a username\n7. Click `Reset Token`, `Yes, do it!` and `Copy`, save the token somewhere safe\n8. Allow `Presence Intent`, `Server Members Intent`, and `Message Content Intent`\n9. Click `Save Changes`\n10. Expand `OAuth2` on the side panel and go to `URL Generator`\n11. Check `bot`, this will reveal `Bot Permissions`, you will need to check `Administrator` in this new section\n12. Scroll down, and open the generated url in another tab\n13. Select the server to add the bot to and click `Continue`\n14. Make sure `Administrator` is checked and click `Authorize`\n15. Do the captcha (if one appears) and close the window once you see `\"Success!\"` on your screen\n\n## Usage Example\n\n### Importing the bot\n\n```python\nimport phonkd_bot\n```\n\n### Creating a bot instance\n\n```python\nbot = phonkd_bot.DiscordBot()\n```\n\n### Responding to messages\n- Adding the `phonkd_bot.message` type hint to the `message` parameter allows your code editor to autocomplete attributes of the discord [`Message`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Message) object, see their [documentation](https://discordpy.readthedocs.io/en/stable/api.html#discord.Message) for more information.\n- The function passed into `call_on_message` will be called when a the bot receives a message. The return value is what the bot will respond with.\n- The framework will pass a discord.Message object as a paramater to the function provided to `call_on_message`.\n```python\ndef on_message(message: phonkd_bot.message):\n    return \"Hello!\"\n\nbot.call_on_message(on_message)\n```\n\n### Activating the bot\n\n```python\nbot.start()\n```\n\n### Logging Information\n\nThe `DiscordBot` class has a sub class called `logger`. The `logger` class has multiple methods that will help you debug or catch errors in your script. These methods are:\n- `logger.info`\n- `logger.warning`\n- `logger.error`\n- `logger.critical`\n\nHere is an example script.\n\n```python\nimport phonkd_bot\n\nbot = DiscordBot()\n\nbot.logger.info(\"info message\")\nbot.logger.warning(\"warning message\")\nbot.logger.error(\"error message\")\nbot.logger.critical(\"critical error message\")\n```\n\nThis is the result.\n\n![image of terminal containing logged information](https://i.imgur.com/wiIKZEQ.png)\n\n### Example Discord Bot Script\n\n```python\nimport phonkd_bot\n\nbot = phonkd_bot.DiscordBot()\n\ndef on_message(message: phonkd_bot.message):\n    return \"Hello!\"\n\nbot.call_on_message(on_message)\nbot.start()\n```\n\nThis is the result.\n\n![image of discord bot saying hello](https://i.imgur.com/4hcMWHE.png)\n\n## Meta\nGmail - phonkibusiness@gmail.com\n\nGithub - https://github.com/RealPhonki\n\nFind me on the Python Discord Server - https://discord.com/invite/python\n\nDiscord Tags - `Phonki#0090`, `slamsandwich19`\n\nCode distributed under the MIT license. See `LICENSE` for more information.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A framework that makes discord bot programming easy",
    "version": "1.0.0",
    "project_urls": null,
    "split_keywords": [
        "python",
        "discord"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ae9f58b2a84626ad249b36736e32e08960b8f0ea95d3fa99d839f5cf41b819f0",
                "md5": "426335b89530361ff37c2188ac65018e",
                "sha256": "2ae2313685ace45f10216e419e3f0e90471d5c15e729d1caba6adab35bd16b13"
            },
            "downloads": -1,
            "filename": "phonkd_bot-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "426335b89530361ff37c2188ac65018e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 10912,
            "upload_time": "2023-11-02T10:33:46",
            "upload_time_iso_8601": "2023-11-02T10:33:46.158426Z",
            "url": "https://files.pythonhosted.org/packages/ae/9f/58b2a84626ad249b36736e32e08960b8f0ea95d3fa99d839f5cf41b819f0/phonkd_bot-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7fcd568b3d764ee14d4239b6a93feeded4e5d61dc584b0c410639a4ccba34f0c",
                "md5": "8856f8e0bf925c04cd4d67c8f92009d8",
                "sha256": "efbbcec74310855dea99b9652676037a5ecbbff1574b649e7cdc5014b586d280"
            },
            "downloads": -1,
            "filename": "phonkd_bot-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "8856f8e0bf925c04cd4d67c8f92009d8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 11020,
            "upload_time": "2023-11-02T10:33:47",
            "upload_time_iso_8601": "2023-11-02T10:33:47.492020Z",
            "url": "https://files.pythonhosted.org/packages/7f/cd/568b3d764ee14d4239b6a93feeded4e5d61dc584b0c410639a4ccba34f0c/phonkd_bot-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-02 10:33:47",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "phonkd-bot"
}
        
Elapsed time: 0.16939s