Skip to content

Commit 7bca763

Browse files
committed
Merge branch 'v.0.0.1.6' of https://github.com/RedCokeDevelopment/Teapot.py into v0.0.1.5
2 parents a3cc6f9 + 1760f06 commit 7bca763

File tree

4 files changed

+62
-9
lines changed

4 files changed

+62
-9
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
![banner](https://user-images.githubusercontent.com/43201383/72987537-89830a80-3e25-11ea-95ef-ecfa0afcff7e.png)
22

33
<p align="center">
4-
<a href="https://github.com/RedCokeDevelopment/Teapot.py/blob/dev/LICENSE"><img src="https://img.shields.io/github/license/redcokedevelopment/teapot.py.svg?style=flat-square" alt="GitHub License"></a>
4+
<a href="https://github.com/RedCokeDevelopment/Teapot.py/blob/master/LICENSE"><img src="https://img.shields.io/github/license/redcokedevelopment/teapot.py.svg?style=flat-square" alt="GitHub License"></a>
55
<a href="https://github.com/RedCokeDevelopment/Teapot.py/issues"><img src="https://img.shields.io/github/issues/redcokedevelopment/teapot.py.svg?color=purple&style=flat-square" alt="GitHub Issues"></a>
66
<a href="https://github.com/RedCokeDevelopment/Teapot.py/pulls"><img src="https://img.shields.io/github/issues-pr/redcokedevelopment/teapot.py.svg?color=purple&style=flat-square" alt="GitHub Pull Requests"></a>
77
<a href="https://github.com/RedCokeDevelopment/Teapot.py/stargazers"><img src="https://img.shields.io/github/stars/redcokedevelopment/teapot.py.svg?style=flat-square" alt="GitHub Stars"></a>
@@ -50,10 +50,10 @@ There are two owners for this project. They all contribute massively to the runn
5050
## 📜 Requirements
5151
These are the requirements for the bot, and they will be bundled in future releases.
5252

53-
- [Python 3.7](https://www.python.org/downloads/release/python-376/) (Required packages listed in requirements.txt)
53+
- [Python 3.8](https://www.python.org/downloads/release/python-382/) (Required packages listed in requirements.txt)
5454
- [LavaLink Server](https://github.com/Frederikam/Lavalink) (Java 11 required)
5555

5656
## 💛 Credits
5757
The projects listed in below have provided inspiration, and we thought we'd mention them:
5858

59-
- LavaLink: https://github.com/Frederikam/Lavalink
59+
- LavaLink: https://github.com/Frederikam/Lavalink

Teapot.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,27 @@
3535
if not versionlisted:
3636
print("You are currently using an unlisted version!\n")
3737
elif req.status_code == 404:
38-
print("Unable to fetch the latest Teapot.py version from GitHub!\n")
38+
# 404 Not Found
39+
print("Latest Teapot.py version not found!\n")
40+
elif req.status_code == 500:
41+
# 500 Internal Server Error
42+
print("An error occurred while fetching the latest Teapot.py version. [500 Internal Server Error]\n")
43+
elif req.status_code == 502:
44+
# 502 Bad Gateway
45+
print("An error occurred while fetching the latest Teapot.py version. [502 Bad Gateway]\n")
46+
elif req.status_code == 503:
47+
# 503 Service Unavailable
48+
print("An error occurred while fetching the latest Teapot.py version. [503 Service Unavailable]\n")
3949
else:
40-
print("An unknown error has occurred when fetching the latest version of Teapot.py\n")
50+
print("An unknown error has occurred when fetching the latest Teapot.py version\n")
51+
print("Error Code:" + str(req.status_code))
4152

4253
load_dotenv(join(dirname(__file__), '.env'))
4354

4455
if os.getenv('CONFIG_VERSION') != teapot.config_version():
4556
if os.path.isfile('.env'):
46-
print("Missing environment variables. Please delete .env and run Teapot.py again.")
47-
quit()
57+
print("Missing environment variables. Please backup and delete .env, then run Teapot.py again.")
58+
quit(2)
4859
print("Unable to find required environment variables. Running setup.py...")
4960
teapot.setup.__init__()
5061

teapot/cogs/music.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,15 @@ async def pause(self, ctx):
175175
await ctx.send('⏯ | Paused')
176176

177177
@commands.command(aliases=['vol'])
178-
async def volume(self, ctx, volume: int = None):
178+
async def volume(self, ctx, volume):
179179
""" Changes the player's volume (0-1000). """
180180
player = self.bot.lavalink.players.get(ctx.guild.id)
181181

182+
try:
183+
volume = int(volume)
184+
except:
185+
volume = int(volume[:-1])
186+
182187
if not volume:
183188
return await ctx.send(f'🔈 | {player.volume}%')
184189

teapot/events.py

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
import teapot
3+
import discord
34

45

56
def __init__(bot):
@@ -53,7 +54,6 @@ async def on_guild_join(ctx):
5354
def message_send(bot):
5455
@bot.event
5556
async def on_message(message):
56-
guild = message.guild
5757
if teapot.config.storage_type() == "mysql":
5858
try:
5959
database = teapot.database.__init__()
@@ -78,6 +78,43 @@ async def on_message(message):
7878
print(e)
7979
await bot.process_commands(message)
8080

81+
@bot.event
82+
async def on_message(message):
83+
# SAO Easter Egg
84+
punctuations = '!()-[]{};:\'"\\,<>./?@#$%^&*_~'
85+
# remove punctuation from the string
86+
msg = ""
87+
for char in message.content.lower():
88+
if char not in punctuations:
89+
msg = msg + char
90+
91+
if msg.startswith("system call "):
92+
content = msg[12:].split(" ")
93+
if content[0].lower() == "inspect":
94+
if content[1].lower() == "entire":
95+
if content[2].lower() == "command":
96+
if content[3].lower() == "list":
97+
em = discord.Embed(title=f"🍢 SAO Command List", color=0x7400FF)
98+
em.set_thumbnail(
99+
url="https://cdn.discordapp.com/attachments/668816286784159763/674285661510959105/Kirito-Sao-Logo-1506655414__76221.1550241566.png")
100+
em.add_field(name='Commands',
101+
value="generate xx element\ngenerate xx element xx shape\ninspect entire command list")
102+
103+
em.set_footer(text=f"{teapot.copyright()} | Code licensed under the MIT License")
104+
await message.channel.send(embed=em)
105+
elif content[0].lower() == "generate":
106+
if content[-1].lower() == "element":
107+
em = discord.Embed(title=f"✏ Generated {content[1].lower()} element!",
108+
color=0xFF0000)
109+
await message.channel.send(embed=em)
110+
if content[-1].lower() == "shape":
111+
if content[2].lower() == "element":
112+
em = discord.Embed(
113+
title=f"✏ Generated {content[-2].lower()} shaped {content[1].lower()} element!",
114+
color=0xFF0000)
115+
await message.channel.send(embed=em)
116+
await bot.process_commands(message)
117+
81118

82119
def message_edit(bot):
83120
@bot.event

0 commit comments

Comments
 (0)