Skip to content

Commit 0e6daba

Browse files
committed
🏷️ Template v6.2.0
* Added a new `feedback` command for showcasing the use of modals (popups) * Some wording changes in the `README.md` file and the project description
1 parent c254406 commit 0e6daba

File tree

9 files changed

+84
-37
lines changed

9 files changed

+84
-37
lines changed

Diff for: README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
<a href="https://github.com/psf/black"><img src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
1111
</p>
1212

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

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

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

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

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

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

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

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

123123
Me or other people will take their time to answer and help you.

Diff for: UPDATES.md

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

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

5+
### Version 6.2.0 (21 July 2024)
6+
7+
- Added a new `feedback` command for showcasing the use of modals (popups)
8+
- Some wording changes in the `README.md` file and the project description
9+
510
### Version 6.1.0 (20 September 2023)
611

712
- Various bug fixes

Diff for: bot.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""
2-
Copyright © Krypton 2019-2023 - https://github.com/kkrypt0nn (https://krypton.ninja)
2+
Copyright © Krypton 2019-Present - https://github.com/kkrypt0nn (https://krypton.ninja)
33
Description:
4-
🐍 A simple template to start to code your own and personalized discord bot in Python programming language.
4+
🐍 A simple template to start to code your own and personalized Discord bot in Python
55
6-
Version: 6.1.0
6+
Version: 6.2.0
77
"""
88

99
import json

Diff for: cogs/fun.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
""""
2-
Copyright © Krypton 2019-2023 - https://github.com/kkrypt0nn (https://krypton.ninja)
1+
"""
2+
Copyright © Krypton 2019-Present - https://github.com/kkrypt0nn (https://krypton.ninja)
33
Description:
4-
🐍 A simple template to start to code your own and personalized discord bot in Python programming language.
4+
🐍 A simple template to start to code your own and personalized Discord bot in Python
55
6-
Version: 6.1.0
6+
Version: 6.2.0
77
"""
88

99
import random

Diff for: cogs/general.py

+50-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
""""
2-
Copyright © Krypton 2019-2023 - https://github.com/kkrypt0nn (https://krypton.ninja)
1+
"""
2+
Copyright © Krypton 2019-Present - https://github.com/kkrypt0nn (https://krypton.ninja)
33
Description:
4-
🐍 A simple template to start to code your own and personalized discord bot in Python programming language.
4+
🐍 A simple template to start to code your own and personalized Discord bot in Python
55
6-
Version: 6.1.0
6+
Version: 6.2.0
77
"""
88

99
import platform
@@ -16,6 +16,21 @@
1616
from discord.ext.commands import Context
1717

1818

19+
class FeedbackForm(discord.ui.Modal, title="Feeedback"):
20+
feedback = discord.ui.TextInput(
21+
label="What do you think about this bot?",
22+
style=discord.TextStyle.long,
23+
placeholder="Type your answer here...",
24+
required=True,
25+
max_length=256,
26+
)
27+
28+
async def on_submit(self, interaction: discord.Interaction):
29+
self.interaction = interaction
30+
self.answer = str(self.feedback)
31+
self.stop()
32+
33+
1934
class General(commands.Cog, name="general"):
2035
def __init__(self, bot) -> None:
2136
self.bot = bot
@@ -264,9 +279,7 @@ async def bitcoin(self, context: Context) -> None:
264279
"https://api.coindesk.com/v1/bpi/currentprice/BTC.json"
265280
) as request:
266281
if request.status == 200:
267-
data = await request.json(
268-
content_type="application/javascript"
269-
) # For some reason the returned content is of type JavaScript
282+
data = await request.json()
270283
embed = discord.Embed(
271284
title="Bitcoin price",
272285
description=f"The current price is {data['bpi']['USD']['rate']} :dollar:",
@@ -280,6 +293,36 @@ async def bitcoin(self, context: Context) -> None:
280293
)
281294
await context.send(embed=embed)
282295

296+
@app_commands.command(
297+
name="feedback", description="Submit a feedback for the owners of the bot"
298+
)
299+
async def feedback(self, interaction: discord.Interaction) -> None:
300+
"""
301+
Submit a feedback for the owners of the bot.
302+
303+
:param context: The hybrid command context.
304+
"""
305+
feedback_form = FeedbackForm()
306+
await interaction.response.send_modal(feedback_form)
307+
308+
await feedback_form.wait()
309+
interaction = feedback_form.interaction
310+
await interaction.response.send_message(
311+
embed=discord.Embed(
312+
description="Thank you for your feedback, the owners have been notified about it.",
313+
color=0xBEBEFE,
314+
)
315+
)
316+
317+
app_owner = (await self.bot.application_info()).owner
318+
await app_owner.send(
319+
embed=discord.Embed(
320+
title="New Feedback",
321+
description=f"{interaction.user} (<@{interaction.user.id}>) has submitted a new feedback:\n```\n{feedback_form.answer}\n```",
322+
color=0xBEBEFE,
323+
)
324+
)
325+
283326

284327
async def setup(bot) -> None:
285328
await bot.add_cog(General(bot))

Diff for: cogs/moderation.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
""""
2-
Copyright © Krypton 2019-2023 - https://github.com/kkrypt0nn (https://krypton.ninja)
1+
"""
2+
Copyright © Krypton 2019-Present - https://github.com/kkrypt0nn (https://krypton.ninja)
33
Description:
4-
🐍 A simple template to start to code your own and personalized discord bot in Python programming language.
4+
🐍 A simple template to start to code your own and personalized Discord bot in Python
55
6-
Version: 6.1.0
6+
Version: 6.2.0
77
"""
88

99
import os

Diff for: cogs/owner.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
""""
2-
Copyright © Krypton 2019-2023 - https://github.com/kkrypt0nn (https://krypton.ninja)
1+
"""
2+
Copyright © Krypton 2019-Present - https://github.com/kkrypt0nn (https://krypton.ninja)
33
Description:
4-
🐍 A simple template to start to code your own and personalized discord bot in Python programming language.
4+
🐍 A simple template to start to code your own and personalized Discord bot in Python
55
6-
Version: 6.1.0
6+
Version: 6.2.0
77
"""
88

99
import discord

Diff for: cogs/template.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
""""
2-
Copyright © Krypton 2019-2023 - https://github.com/kkrypt0nn (https://krypton.ninja)
1+
"""
2+
Copyright © Krypton 2019-Present - https://github.com/kkrypt0nn (https://krypton.ninja)
33
Description:
4-
🐍 A simple template to start to code your own and personalized discord bot in Python programming language.
4+
🐍 A simple template to start to code your own and personalized Discord bot in Python
55
6-
Version: 6.1.0
6+
Version: 6.2.0
77
"""
88

99
from discord.ext import commands

Diff for: database/__init__.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
""""
2-
Copyright © Krypton 2019-2023 - https://github.com/kkrypt0nn (https://krypton.ninja)
1+
"""
2+
Copyright © Krypton 2019-Present - https://github.com/kkrypt0nn (https://krypton.ninja)
33
Description:
4-
🐍 A simple template to start to code your own and personalized discord bot in Python programming language.
4+
🐍 A simple template to start to code your own and personalized Discord bot in Python
55
6-
Version: 6.1.0
6+
Version: 6.2.0
77
"""
88

9-
109
import aiosqlite
1110

1211

0 commit comments

Comments
 (0)