Add shuffle command
This commit is contained in:
parent
84bda4043e
commit
86473c1028
1 changed files with 11 additions and 0 deletions
11
bot.py
11
bot.py
|
@ -24,6 +24,8 @@ class Bot(commands.Bot):
|
||||||
commands = self.db_cur.execute("SELECT count(*) FROM custom_commands").fetchone()
|
commands = self.db_cur.execute("SELECT count(*) FROM custom_commands").fetchone()
|
||||||
print(f"{commands[0]} custom commands available")
|
print(f"{commands[0]} custom commands available")
|
||||||
|
|
||||||
|
self.last_message = "cubes are just balls with corners lmao"
|
||||||
|
|
||||||
# Adds a custom command from a string
|
# Adds a custom command from a string
|
||||||
async def add_custom_command(self, ctx, command_str, author):
|
async def add_custom_command(self, ctx, command_str, author):
|
||||||
args = command_str.split(" ", 1)
|
args = command_str.split(" ", 1)
|
||||||
|
@ -86,6 +88,9 @@ class Bot(commands.Bot):
|
||||||
|
|
||||||
await self.handle_commands(message)
|
await self.handle_commands(message)
|
||||||
|
|
||||||
|
if len(message.content.split(" ")) > 1:
|
||||||
|
self.last_message = message.content
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
async def hello(self, ctx: commands.Context):
|
async def hello(self, ctx: commands.Context):
|
||||||
# Basic hello world command, executed with "!hello". Reply hello to whoever made the command
|
# Basic hello world command, executed with "!hello". Reply hello to whoever made the command
|
||||||
|
@ -161,6 +166,12 @@ class Bot(commands.Bot):
|
||||||
r = requests.get("https://taskinoz.com/gdq/api/")
|
r = requests.get("https://taskinoz.com/gdq/api/")
|
||||||
await ctx.send(r.text)
|
await ctx.send(r.text)
|
||||||
|
|
||||||
|
@commands.command()
|
||||||
|
async def shuffle(self, ctx: commands.Context):
|
||||||
|
shuffled_message_list = self.last_message.split(" ")
|
||||||
|
random.shuffle(shuffled_message_list)
|
||||||
|
await ctx.send(" ".join(shuffled_message_list))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
Loading…
Add table
Reference in a new issue