|
|
@ -11,7 +11,7 @@ from random import randrange
|
|
|
|
|
|
|
|
|
|
|
|
from discord import Embed, Intents
|
|
|
|
from discord import Embed, Intents
|
|
|
|
from discord.ext import commands
|
|
|
|
from discord.ext import commands
|
|
|
|
from settings.config import IMAGE_TYPES, OW_API_CONFIG, PERMISSIONS, QUOTE_STACK
|
|
|
|
from settings.config import IMAGE_TYPES, OW_API_CONFIG, PERMISSIONS, QUOTE_STACK, RQ_LEADERBOARD
|
|
|
|
|
|
|
|
|
|
|
|
from utils.database import (count_quotes, count_quotes_user, get_by_id, get_quote_contains,
|
|
|
|
from utils.database import (count_quotes, count_quotes_user, get_by_id, get_quote_contains,
|
|
|
|
get_quotes, remove_quote, set_quote)
|
|
|
|
get_quotes, remove_quote, set_quote)
|
|
|
@ -28,6 +28,9 @@ stack_limit = int((count_quotes() * .25))
|
|
|
|
with open(QUOTE_STACK, mode='r') as f:
|
|
|
|
with open(QUOTE_STACK, mode='r') as f:
|
|
|
|
quote_id_stack = json.load(f)
|
|
|
|
quote_id_stack = json.load(f)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with open(RQ_LEADERBOARD, mode='r') as f:
|
|
|
|
|
|
|
|
rq_leaderboard = json.load(f)
|
|
|
|
|
|
|
|
|
|
|
|
quote_content = {}
|
|
|
|
quote_content = {}
|
|
|
|
|
|
|
|
|
|
|
|
last_quote = 0
|
|
|
|
last_quote = 0
|
|
|
@ -106,6 +109,12 @@ async def random_quote(bot: object) -> str:
|
|
|
|
chosen_one = get_quotes(quote_id_stack)
|
|
|
|
chosen_one = get_quotes(quote_id_stack)
|
|
|
|
stack_len = len(quote_id_stack)
|
|
|
|
stack_len = len(quote_id_stack)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Adds to --rq leaderboard
|
|
|
|
|
|
|
|
if bot.author.name in rq_leaderboard.keys():
|
|
|
|
|
|
|
|
rq_leaderboard[bot.author.name] += 1
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
rq_leaderboard[bot.author.name] = 1
|
|
|
|
|
|
|
|
|
|
|
|
if not chosen_one and stack_len > 0:
|
|
|
|
if not chosen_one and stack_len > 0:
|
|
|
|
quote_id_stack.pop(0)
|
|
|
|
quote_id_stack.pop(0)
|
|
|
|
chosen_one = get_quotes(quote_id_stack)
|
|
|
|
chosen_one = get_quotes(quote_id_stack)
|
|
|
@ -124,6 +133,10 @@ async def random_quote(bot: object) -> str:
|
|
|
|
with open(QUOTE_STACK, mode='w') as f:
|
|
|
|
with open(QUOTE_STACK, mode='w') as f:
|
|
|
|
json.dump(quote_id_stack, f)
|
|
|
|
json.dump(quote_id_stack, f)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Writes to persistent rq leaderboard
|
|
|
|
|
|
|
|
with open(RQ_LEADERBOARD, mode='w') as f:
|
|
|
|
|
|
|
|
json.dump(rq_leaderboard, f)
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
# To image links.
|
|
|
|
# To image links.
|
|
|
|
if 'http' in chosen_one.quote:
|
|
|
|
if 'http' in chosen_one.quote:
|
|
|
@ -470,6 +483,21 @@ async def count_leaderboard(bot:object) -> str:
|
|
|
|
|
|
|
|
|
|
|
|
return await bot.send(qlb)
|
|
|
|
return await bot.send(qlb)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@client.command(aliases=['rqlb'])
|
|
|
|
|
|
|
|
async def random_quote_leaderboard(bot:object) -> str:
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
Returns a list of --rq invokers, sorted by amount
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
data = "```\nLista de rqueiros\n"
|
|
|
|
|
|
|
|
lis = rq_leaderboard
|
|
|
|
|
|
|
|
lis = sorted(lis.items(), key=lambda x:x[1], reverse=True)
|
|
|
|
|
|
|
|
for people in lis:
|
|
|
|
|
|
|
|
data = data + people[0] + " - " + str(people[1]) + "\n"
|
|
|
|
|
|
|
|
data = data + "```"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return await bot.send(data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@client.command(aliases=['dbg'])
|
|
|
|
@client.command(aliases=['dbg'])
|
|
|
|
async def neeble_debug(bot:object) -> str:
|
|
|
|
async def neeble_debug(bot:object) -> str:
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|