Skip to content

Commit 86f3e71

Browse files
author
Krypton
committed
Template v4.0.1
* Fixed some *weird* code
1 parent 52f28b9 commit 86f3e71

File tree

10 files changed

+24
-34
lines changed

10 files changed

+24
-34
lines changed

UPDATES.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

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

5+
### Version 4.0.1
6+
7+
* Fixed some *weird* code
8+
59
### Version 4.0
610

711
* Now using [`disnake`](https://docs.disnake.dev)

bot.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
""""
2-
Copyright © Krypton 2021 - https://github.com/kkrypt0nn
2+
Copyright © Krypton 2021 - https://github.com/kkrypt0nn (https://krypt0n.co.uk)
33
Description:
44
This is a template to create your own discord bot in python.
55
6-
Version: 4.0
6+
Version: 4.0.1
77
"""
88

99
import json

cogs/fun.py

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
""""
2-
Copyright © Krypton 2021 - https://github.com/kkrypt0nn
2+
Copyright © Krypton 2021 - https://github.com/kkrypt0nn (https://krypt0n.co.uk)
33
Description:
44
This is a template to create your own discord bot in python.
55
6-
Version: 4.0
6+
Version: 4.0.1
77
"""
88

99
import json
@@ -118,13 +118,6 @@ async def randomfact(self, interaction: ApplicationCommandInteraction):
118118
"""
119119
Get a random fact.
120120
"""
121-
122-
# This is, for now, only temporary
123-
with open("blacklist.json") as file:
124-
blacklist = json.load(file)
125-
if interaction.author.id in blacklist["ids"]:
126-
return
127-
128121
# This will prevent your bot from stopping everything when doing a web request - see: https://discordpy.readthedocs.io/en/stable/faq.html#how-do-i-make-a-web-request
129122
async with aiohttp.ClientSession() as session:
130123
async with session.get("https://uselessfacts.jsph.pl/random.json?language=en") as request:
@@ -151,13 +144,6 @@ async def randomfact(self, context: Context):
151144
"""
152145
Get a random fact.
153146
"""
154-
155-
# This is, for now, only temporary
156-
with open("blacklist.json") as file:
157-
blacklist = json.load(file)
158-
if context.author.id in blacklist["ids"]:
159-
return
160-
161147
# This will prevent your bot from stopping everything when doing a web request - see: https://discordpy.readthedocs.io/en/stable/faq.html#how-do-i-make-a-web-request
162148
async with aiohttp.ClientSession() as session:
163149
async with session.get("https://uselessfacts.jsph.pl/random.json?language=en") as request:

cogs/general.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
""""
2-
Copyright © Krypton 2021 - https://github.com/kkrypt0nn
2+
Copyright © Krypton 2021 - https://github.com/kkrypt0nn (https://krypt0n.co.uk)
33
Description:
44
This is a template to create your own discord bot in python.
55
6-
Version: 4.0
6+
Version: 4.0.1
77
"""
88

99
import json
@@ -325,7 +325,7 @@ async def eight_ball(self, interaction: ApplicationCommandInteraction, question:
325325
'My sources say no.', 'Outlook not so good.', 'Very doubtful.']
326326
embed = disnake.Embed(
327327
title="**My Answer:**",
328-
description=f"{answers[random.randint(0, len(answers) - 1)]}",
328+
description=f"{random.choice(answers)}",
329329
color=0x9C84EF
330330
)
331331
embed.set_footer(
@@ -349,7 +349,7 @@ async def eight_ball(self, context: Context, *, question: str):
349349
'My sources say no.', 'Outlook not so good.', 'Very doubtful.']
350350
embed = disnake.Embed(
351351
title="**My Answer:**",
352-
description=f"{answers[random.randint(0, len(answers) - 1)]}",
352+
description=f"{random.choice(answers)}",
353353
color=0x9C84EF
354354
)
355355
embed.set_footer(

cogs/moderation.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
""""
2-
Copyright © Krypton 2021 - https://github.com/kkrypt0nn
2+
Copyright © Krypton 2021 - https://github.com/kkrypt0nn (https://krypt0n.co.uk)
33
Description:
44
This is a template to create your own discord bot in python.
55
6-
Version: 4.0
6+
Version: 4.0.1
77
"""
88

99
import json

cogs/owner.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
""""
2-
Copyright © Krypton 2021 - https://github.com/kkrypt0nn
2+
Copyright © Krypton 2021 - https://github.com/kkrypt0nn (https://krypt0n.co.uk)
33
Description:
44
This is a template to create your own discord bot in python.
55
6-
Version: 4.0
6+
Version: 4.0.1
77
"""
88

99
import json

cogs/template.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
""""
2-
Copyright © Krypton 2021 - https://github.com/kkrypt0nn
2+
Copyright © Krypton 2021 - https://github.com/kkrypt0nn (https://krypt0n.co.uk)
33
Description:
44
This is a template to create your own discord bot in python.
55
6-
Version: 4.0
6+
Version: 4.0.1
77
"""
88

99
import json

exceptions/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
""""
2-
Copyright © Krypton 2021 - https://github.com/kkrypt0nn
2+
Copyright © Krypton 2021 - https://github.com/kkrypt0nn (https://krypt0n.co.uk)
33
Description:
44
This is a template to create your own discord bot in python.
55
6-
Version: 4.0
6+
Version: 4.0.1
77
"""
88

99

helpers/checks.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
""""
2-
Copyright © Krypton 2021 - https://github.com/kkrypt0nn
2+
Copyright © Krypton 2021 - https://github.com/kkrypt0nn (https://krypt0n.co.uk)
33
Description:
44
This is a template to create your own discord bot in python.
55
6-
Version: 4.0
6+
Version: 4.0.1
77
"""
88

99
import json

helpers/json_manager.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
""""
2-
Copyright © Krypton 2021 - https://github.com/kkrypt0nn
2+
Copyright © Krypton 2021 - https://github.com/kkrypt0nn (https://krypt0n.co.uk)
33
Description:
44
This is a template to create your own discord bot in python.
55
6-
Version: 4.0
6+
Version: 4.0.1
77
"""
88

99
import json

0 commit comments

Comments
 (0)