Skip to content

Commit

Permalink
🏷️ Template v6.2.0
Browse files Browse the repository at this point in the history
* Added a new `feedback` command for showcasing the use of modals (popups)
* Some wording changes in the `README.md` file and the project description
  • Loading branch information
kkrypt0nn committed Jul 21, 2024
1 parent c254406 commit 0e6daba
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 37 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
<a href="https://github.com/psf/black"><img src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
</p>

This repository is a template that everyone can use for the start of their discord bot.
This repository is a template that everyone can use for the start of their Discord bot.

When I first started creating my discord bot it took me a while to get everything setup and working with cogs and more.
When I first started creating my Discord bot it took me a while to get everything setup and working with cogs and more.
I would've been happy if there were any template existing. However, there wasn't any existing template. That's why I
decided to create my own template to let **you** guys create your discord bot easily.
decided to create my own template to let **you** guys create your Discord bot easily.

Please note that this template is not supposed to be the best template, but a good template to start learning how
discord.py works and to make your own bot easily.
Expand All @@ -33,7 +33,7 @@ Before requesting support, you should know that this template requires you to ha
Python and the library is made for **advanced users**. Do not use this template if you don't know the
basics or some advanced topics such as OOP or async. [Here's](https://pythondiscord.com/pages/resources) a link for resources to learn python.

If you need some help for something, do not hesitate to join my discord server [here](https://discord.gg/mTBrXyWxAF).
If you need some help for something, do not hesitate to join my Discord server [here](https://discord.gg/mTBrXyWxAF).

All the updates of the template are available [here](UPDATES.md).

Expand Down Expand Up @@ -63,7 +63,7 @@ Alternatively you can do the following:
- Clone/Download the repository
- To clone it and get the updates you can definitely use the command
`git clone`
- Create a discord bot [here](https://discord.com/developers/applications)
- Create a Discord bot [here](https://discord.com/developers/applications)
- Get your bot token
- Invite your bot on servers using the following invite:
https://discord.com/oauth2/authorize?&client_id=YOUR_APPLICATION_ID_HERE&scope=bot+applications.commands&permissions=PERMISSIONS (
Expand Down Expand Up @@ -117,7 +117,7 @@ python bot.py

If you have any issues or questions of how to code a specific command, you can:

- Join my discord server [here](https://discord.gg/mTBrXyWxAF)
- Join my Discord server [here](https://discord.gg/mTBrXyWxAF)
- Post them [here](https://github.com/kkrypt0nn/Python-Discord-Bot-Template/issues)

Me or other people will take their time to answer and help you.
Expand Down
5 changes: 5 additions & 0 deletions UPDATES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

Here is the list of all the updates that I made on this template.

### Version 6.2.0 (21 July 2024)

- Added a new `feedback` command for showcasing the use of modals (popups)
- Some wording changes in the `README.md` file and the project description

### Version 6.1.0 (20 September 2023)

- Various bug fixes
Expand Down
6 changes: 3 additions & 3 deletions bot.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""
Copyright Β© Krypton 2019-2023 - https://github.com/kkrypt0nn (https://krypton.ninja)
Copyright Β© Krypton 2019-Present - https://github.com/kkrypt0nn (https://krypton.ninja)
Description:
🐍 A simple template to start to code your own and personalized discord bot in Python programming language.
🐍 A simple template to start to code your own and personalized Discord bot in Python
Version: 6.1.0
Version: 6.2.0
"""

import json
Expand Down
8 changes: 4 additions & 4 deletions cogs/fun.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
""""
Copyright Β© Krypton 2019-2023 - https://github.com/kkrypt0nn (https://krypton.ninja)
"""
Copyright Β© Krypton 2019-Present - https://github.com/kkrypt0nn (https://krypton.ninja)
Description:
🐍 A simple template to start to code your own and personalized discord bot in Python programming language.
🐍 A simple template to start to code your own and personalized Discord bot in Python
Version: 6.1.0
Version: 6.2.0
"""

import random
Expand Down
57 changes: 50 additions & 7 deletions cogs/general.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
""""
Copyright Β© Krypton 2019-2023 - https://github.com/kkrypt0nn (https://krypton.ninja)
"""
Copyright Β© Krypton 2019-Present - https://github.com/kkrypt0nn (https://krypton.ninja)
Description:
🐍 A simple template to start to code your own and personalized discord bot in Python programming language.
🐍 A simple template to start to code your own and personalized Discord bot in Python
Version: 6.1.0
Version: 6.2.0
"""

import platform
Expand All @@ -16,6 +16,21 @@
from discord.ext.commands import Context


class FeedbackForm(discord.ui.Modal, title="Feeedback"):
feedback = discord.ui.TextInput(
label="What do you think about this bot?",
style=discord.TextStyle.long,
placeholder="Type your answer here...",
required=True,
max_length=256,
)

async def on_submit(self, interaction: discord.Interaction):
self.interaction = interaction
self.answer = str(self.feedback)
self.stop()


class General(commands.Cog, name="general"):
def __init__(self, bot) -> None:
self.bot = bot
Expand Down Expand Up @@ -264,9 +279,7 @@ async def bitcoin(self, context: Context) -> None:
"https://api.coindesk.com/v1/bpi/currentprice/BTC.json"
) as request:
if request.status == 200:
data = await request.json(
content_type="application/javascript"
) # For some reason the returned content is of type JavaScript
data = await request.json()
embed = discord.Embed(
title="Bitcoin price",
description=f"The current price is {data['bpi']['USD']['rate']} :dollar:",
Expand All @@ -280,6 +293,36 @@ async def bitcoin(self, context: Context) -> None:
)
await context.send(embed=embed)

@app_commands.command(
name="feedback", description="Submit a feedback for the owners of the bot"
)
async def feedback(self, interaction: discord.Interaction) -> None:
"""
Submit a feedback for the owners of the bot.
:param context: The hybrid command context.
"""
feedback_form = FeedbackForm()
await interaction.response.send_modal(feedback_form)

await feedback_form.wait()
interaction = feedback_form.interaction
await interaction.response.send_message(
embed=discord.Embed(
description="Thank you for your feedback, the owners have been notified about it.",
color=0xBEBEFE,
)
)

app_owner = (await self.bot.application_info()).owner
await app_owner.send(
embed=discord.Embed(
title="New Feedback",
description=f"{interaction.user} (<@{interaction.user.id}>) has submitted a new feedback:\n```\n{feedback_form.answer}\n```",
color=0xBEBEFE,
)
)


async def setup(bot) -> None:
await bot.add_cog(General(bot))
8 changes: 4 additions & 4 deletions cogs/moderation.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
""""
Copyright Β© Krypton 2019-2023 - https://github.com/kkrypt0nn (https://krypton.ninja)
"""
Copyright Β© Krypton 2019-Present - https://github.com/kkrypt0nn (https://krypton.ninja)
Description:
🐍 A simple template to start to code your own and personalized discord bot in Python programming language.
🐍 A simple template to start to code your own and personalized Discord bot in Python
Version: 6.1.0
Version: 6.2.0
"""

import os
Expand Down
8 changes: 4 additions & 4 deletions cogs/owner.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
""""
Copyright Β© Krypton 2019-2023 - https://github.com/kkrypt0nn (https://krypton.ninja)
"""
Copyright Β© Krypton 2019-Present - https://github.com/kkrypt0nn (https://krypton.ninja)
Description:
🐍 A simple template to start to code your own and personalized discord bot in Python programming language.
🐍 A simple template to start to code your own and personalized Discord bot in Python
Version: 6.1.0
Version: 6.2.0
"""

import discord
Expand Down
8 changes: 4 additions & 4 deletions cogs/template.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
""""
Copyright Β© Krypton 2019-2023 - https://github.com/kkrypt0nn (https://krypton.ninja)
"""
Copyright Β© Krypton 2019-Present - https://github.com/kkrypt0nn (https://krypton.ninja)
Description:
🐍 A simple template to start to code your own and personalized discord bot in Python programming language.
🐍 A simple template to start to code your own and personalized Discord bot in Python
Version: 6.1.0
Version: 6.2.0
"""

from discord.ext import commands
Expand Down
9 changes: 4 additions & 5 deletions database/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
""""
Copyright Β© Krypton 2019-2023 - https://github.com/kkrypt0nn (https://krypton.ninja)
"""
Copyright Β© Krypton 2019-Present - https://github.com/kkrypt0nn (https://krypton.ninja)
Description:
🐍 A simple template to start to code your own and personalized discord bot in Python programming language.
🐍 A simple template to start to code your own and personalized Discord bot in Python
Version: 6.1.0
Version: 6.2.0
"""


import aiosqlite


Expand Down

0 comments on commit 0e6daba

Please sign in to comment.