modified: bot.py
This commit is contained in:
24
bot.py
24
bot.py
@@ -311,7 +311,7 @@ async def points(ctx):
|
|||||||
"""Shows how many points you have."""
|
"""Shows how many points you have."""
|
||||||
user_id = ctx.author.id
|
user_id = ctx.author.id
|
||||||
# Lade Benutzerdaten aus der MySQL-Datenbank
|
# Lade Benutzerdaten aus der MySQL-Datenbank
|
||||||
user_data = load_user_data_from_mysql(user_id)
|
user_data = load_user_data(user_id)
|
||||||
|
|
||||||
points = user_data["points"]
|
points = user_data["points"]
|
||||||
|
|
||||||
@@ -328,7 +328,7 @@ async def permissionlevel(ctx):
|
|||||||
user_id = ctx.author.id
|
user_id = ctx.author.id
|
||||||
|
|
||||||
# Load user data from the MySQL database
|
# Load user data from the MySQL database
|
||||||
user_data = load_user_data_from_mysql(user_id)
|
user_data = load_user_data(user_id)
|
||||||
|
|
||||||
permission_level = user_data["permission"]
|
permission_level = user_data["permission"]
|
||||||
rank = ""
|
rank = ""
|
||||||
@@ -351,12 +351,12 @@ async def permissionlevel(ctx):
|
|||||||
@client.hybrid_command()
|
@client.hybrid_command()
|
||||||
async def addpoints(ctx, user: discord.User, amount: int):
|
async def addpoints(ctx, user: discord.User, amount: int):
|
||||||
"""Adds a certain number of points to a user."""
|
"""Adds a certain number of points to a user."""
|
||||||
user_perms = load_user_data_from_mysql(ctx.author.id)
|
user_perms = load_user_data(ctx.author.id)
|
||||||
if 5 <= user_perms["permission"]:
|
if 5 <= user_perms["permission"]:
|
||||||
user_id = user.id
|
user_id = user.id
|
||||||
|
|
||||||
# Lade Benutzerdaten aus der MySQL-Datenbank
|
# Lade Benutzerdaten aus der MySQL-Datenbank
|
||||||
user_data = load_user_data_from_mysql(user_id)
|
user_data = load_user_data(user_id)
|
||||||
|
|
||||||
# Füge die Punkte hinzu
|
# Füge die Punkte hinzu
|
||||||
user_data["points"] += amount
|
user_data["points"] += amount
|
||||||
@@ -376,12 +376,12 @@ async def addpoints(ctx, user: discord.User, amount: int):
|
|||||||
@client.hybrid_command()
|
@client.hybrid_command()
|
||||||
async def resetpoints(ctx, user: discord.User):
|
async def resetpoints(ctx, user: discord.User):
|
||||||
"""Resets a user's points to 0."""
|
"""Resets a user's points to 0."""
|
||||||
user_perms = load_user_data_from_mysql(ctx.author.id)
|
user_perms = load_user_data(ctx.author.id)
|
||||||
if 5 <= user_perms["permission"]:
|
if 5 <= user_perms["permission"]:
|
||||||
user_id = user.id
|
user_id = user.id
|
||||||
|
|
||||||
# Lade Benutzerdaten aus der MySQL-Datenbank
|
# Lade Benutzerdaten aus der MySQL-Datenbank
|
||||||
user_data = load_user_data_from_mysql(user_id)
|
user_data = load_user_data(user_id)
|
||||||
|
|
||||||
# Setze die Punkte auf 0 zurück
|
# Setze die Punkte auf 0 zurück
|
||||||
user_data["points"] = 0
|
user_data["points"] = 0
|
||||||
@@ -400,7 +400,7 @@ async def resetpoints(ctx, user: discord.User):
|
|||||||
|
|
||||||
@client.hybrid_command()
|
@client.hybrid_command()
|
||||||
async def shutdown_(ctx):
|
async def shutdown_(ctx):
|
||||||
user_perms = load_user_data_from_mysql(ctx.author.id)
|
user_perms = load_user_data(ctx.author.id)
|
||||||
if 8 <= user_perms["permission"]:
|
if 8 <= user_perms["permission"]:
|
||||||
await ctx.send("Shutting down the bot...")
|
await ctx.send("Shutting down the bot...")
|
||||||
await client.logout()
|
await client.logout()
|
||||||
@@ -411,7 +411,7 @@ async def shutdown_(ctx):
|
|||||||
@client.hybrid_command()
|
@client.hybrid_command()
|
||||||
async def owner_command(ctx):
|
async def owner_command(ctx):
|
||||||
try:
|
try:
|
||||||
user_perms = load_user_data_from_mysql(ctx.author.id)
|
user_perms = load_user_data(ctx.author.id)
|
||||||
if 10 <= user_perms["permission"]:
|
if 10 <= user_perms["permission"]:
|
||||||
await client.tree.sync()
|
await client.tree.sync()
|
||||||
await ctx.send("reloaded !")
|
await ctx.send("reloaded !")
|
||||||
@@ -430,7 +430,7 @@ async def askmultus(ctx, *, prompt: str):
|
|||||||
user_id = ctx.author.id
|
user_id = ctx.author.id
|
||||||
|
|
||||||
# Lade Benutzerdaten aus der MySQL-Datenbank
|
# Lade Benutzerdaten aus der MySQL-Datenbank
|
||||||
user_data = load_user_data_from_mysql(user_id)
|
user_data = load_user_data(user_id)
|
||||||
|
|
||||||
if user_data["points"] >= 5:
|
if user_data["points"] >= 5:
|
||||||
user_data["points"] -= 5
|
user_data["points"] -= 5
|
||||||
@@ -465,7 +465,7 @@ async def process_ai_queue():
|
|||||||
if not askmultus_queue.empty():
|
if not askmultus_queue.empty():
|
||||||
ctx, user_id, user_name, prompt, channel_id, full_data, user_history_field, model = await askmultus_queue.get()
|
ctx, user_id, user_name, prompt, channel_id, full_data, user_history_field, model = await askmultus_queue.get()
|
||||||
|
|
||||||
user_data = load_user_data_from_mysql(user_id)
|
user_data = load_user_data(user_id)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
user_history = user_data.get(user_history_field, [])
|
user_history = user_data.get(user_history_field, [])
|
||||||
@@ -590,7 +590,7 @@ async def addbackgrounddata(ctx, *, data: str):
|
|||||||
@client.hybrid_command()
|
@client.hybrid_command()
|
||||||
async def summarize(ctx, number: int):
|
async def summarize(ctx, number: int):
|
||||||
"""Summarizes the last x messages in the chat."""
|
"""Summarizes the last x messages in the chat."""
|
||||||
user_perms = load_user_data_from_mysql(ctx.author.id)
|
user_perms = load_user_data(ctx.author.id)
|
||||||
if 5 < user_perms["permission"]:
|
if 5 < user_perms["permission"]:
|
||||||
try:
|
try:
|
||||||
# Fetch the last 10 messages in the channel
|
# Fetch the last 10 messages in the channel
|
||||||
@@ -656,7 +656,7 @@ async def switch(ctx, mode: str, state: str):
|
|||||||
|
|
||||||
mode = mode.lower()
|
mode = mode.lower()
|
||||||
state = state.lower()
|
state = state.lower()
|
||||||
user_perms = load_user_data_from_mysql(ctx.author.id)
|
user_perms = load_user_data(ctx.author.id)
|
||||||
if 5 < user_perms["permission"]:
|
if 5 < user_perms["permission"]:
|
||||||
if mode == "vision":
|
if mode == "vision":
|
||||||
if state == "on":
|
if state == "on":
|
||||||
|
|||||||
Reference in New Issue
Block a user