fix: removing useless data
This commit is contained in:
parent
6c150045f5
commit
2173998ced
2 changed files with 11 additions and 36 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -3,3 +3,5 @@ galaxy_server.yaml
|
||||||
global.yaml
|
global.yaml
|
||||||
galaxy_staff_server.yaml
|
galaxy_staff_server.yaml
|
||||||
combat_welder.yaml
|
combat_welder.yaml
|
||||||
|
.venv
|
||||||
|
/OOUCogs
|
||||||
|
|
|
@ -32,7 +32,7 @@ class SugonCredit(commands.Cog):
|
||||||
ELSE
|
ELSE
|
||||||
PRINT 'True';''')
|
PRINT 'True';''')
|
||||||
if exist_check == False:
|
if exist_check == False:
|
||||||
cur.execute(f'''CREATE TABLE '{guild_id}' (username text, user_id text, balance real)''')
|
cur.execute(f'''CREATE TABLE '{guild_id}' (user_id text, balance real)''')
|
||||||
con.commit()
|
con.commit()
|
||||||
con.close()
|
con.close()
|
||||||
|
|
||||||
|
@ -42,18 +42,7 @@ class SugonCredit(commands.Cog):
|
||||||
con = sqlite3.connect(f'{self.data_path}')
|
con = sqlite3.connect(f'{self.data_path}')
|
||||||
cur = con.cursor()
|
cur = con.cursor()
|
||||||
cur.execute(f'''INSERT INTO {guild_id}
|
cur.execute(f'''INSERT INTO {guild_id}
|
||||||
VALUES ('{username}', {target.id}, 250);''')
|
VALUES ({target.id}, 250);''')
|
||||||
con.commit()
|
|
||||||
con.close()
|
|
||||||
|
|
||||||
def username_updater(self, guild_id, target):
|
|
||||||
"""Updates a users' username in the SQLite database."""
|
|
||||||
new_username = str(target)
|
|
||||||
con = sqlite3.connect(f'{self.data_path}')
|
|
||||||
cur = con.cursor()
|
|
||||||
cur.execute(f'''UPDATE {guild_id}
|
|
||||||
SET username = '{new_username}'
|
|
||||||
WHERE user_id = {target.id};''')
|
|
||||||
con.commit()
|
con.commit()
|
||||||
con.close()
|
con.close()
|
||||||
|
|
||||||
|
@ -96,8 +85,6 @@ class SugonCredit(commands.Cog):
|
||||||
await self.new_user_generation({ctx.guild.id}, target)
|
await self.new_user_generation({ctx.guild.id}, target)
|
||||||
stored_username = cur.execute(f'''SELECT username FROM {ctx.guild.id}
|
stored_username = cur.execute(f'''SELECT username FROM {ctx.guild.id}
|
||||||
WHERE user_id = {target.id};''')
|
WHERE user_id = {target.id};''')
|
||||||
if str(target) != stored_username:
|
|
||||||
await self.username_updater({ctx.guild.id}, target)
|
|
||||||
bal = cur.execute(f'''SELECT balance FROM {ctx.guild.id}
|
bal = cur.execute(f'''SELECT balance FROM {ctx.guild.id}
|
||||||
WHERE user_id = {target.id};''')
|
WHERE user_id = {target.id};''')
|
||||||
output_bal = (f'{bal:,}')
|
output_bal = (f'{bal:,}')
|
||||||
|
@ -126,13 +113,6 @@ class SugonCredit(commands.Cog):
|
||||||
currency_name = await self.config.currency_name()
|
currency_name = await self.config.currency_name()
|
||||||
max_bal = await self.config.max_bal()
|
max_bal = await self.config.max_bal()
|
||||||
min_bal = await self.config_min_bal()
|
min_bal = await self.config_min_bal()
|
||||||
if cur.execute(f'''SELECT user_id FROM {ctx.guild.id}
|
|
||||||
WHERE EXISTS (SELECT user_id FROM {ctx.guild.id} WHERE {target.id});''')=="FALSE":
|
|
||||||
await self.new_user_generation({ctx.guild.id}, target)
|
|
||||||
stored_username = cur.execute(f'''SELECT username FROM {ctx.guild.id}
|
|
||||||
WHERE user_id = {target.id};''')
|
|
||||||
if str(target) != stored_username:
|
|
||||||
await self.username_updater({ctx.guild.id}, target)
|
|
||||||
current_bal = cur.execute(f'''SELECT balance FROM {ctx.guild.id}
|
current_bal = cur.execute(f'''SELECT balance FROM {ctx.guild.id}
|
||||||
WHERE user_id = {target.id};''')
|
WHERE user_id = {target.id};''')
|
||||||
new_bal = current_bal + amount
|
new_bal = current_bal + amount
|
||||||
|
@ -185,13 +165,6 @@ class SugonCredit(commands.Cog):
|
||||||
currency_name = await self.config.currency_name()
|
currency_name = await self.config.currency_name()
|
||||||
max_bal = await self.config.max_bal()
|
max_bal = await self.config.max_bal()
|
||||||
min_bal = await self.config_min_bal()
|
min_bal = await self.config_min_bal()
|
||||||
if cur.execute(f'''SELECT user_id FROM {ctx.guild.id}
|
|
||||||
WHERE EXISTS (SELECT user_id FROM {ctx.guild.id} WHERE {target.id});''')=="FALSE":
|
|
||||||
await self.new_user_generation({ctx.guild.id}, target)
|
|
||||||
stored_username = cur.execute(f'''SELECT username FROM {ctx.guild.id}
|
|
||||||
WHERE user_id = {target.id};''')
|
|
||||||
if str(target) != stored_username:
|
|
||||||
await self.username_updater({ctx.guild.id}, target)
|
|
||||||
current_bal = cur.execute(f'''SELECT balance FROM {ctx.guild.id}
|
current_bal = cur.execute(f'''SELECT balance FROM {ctx.guild.id}
|
||||||
WHERE user_id = {target.id};''')
|
WHERE user_id = {target.id};''')
|
||||||
new_bal = current_bal - amount
|
new_bal = current_bal - amount
|
||||||
|
|
Loading…
Reference in a new issue