This commit is contained in:
2024-09-05 15:40:27 +02:00
parent 35249d9ea5
commit 86e46b8338
2 changed files with 3 additions and 8 deletions
+1
View File
@@ -6,3 +6,4 @@ PUNISH_ROLES=[x.strip() for x in os.environ['PUNISH_ROLES'].split(',')]
REDIS_URL=os.environ['REDIS_URL'] REDIS_URL=os.environ['REDIS_URL']
REDIS_USER=os.environ['REDIS_USER'] REDIS_USER=os.environ['REDIS_USER']
REDIS_PSW=os.environ['REDIS_PSW'] REDIS_PSW=os.environ['REDIS_PSW']
COOLDOWN_PERIOD = 5
+1 -7
View File
@@ -7,11 +7,8 @@ import time
aura = Aura() aura = Aura()
client = discord.Client(intents=discord.Intents.all()) client = discord.Client(intents=discord.Intents.all())
# bot = commands.Bot(command_prefix="!", intents=discord.Intents.all())
tree = app_commands.CommandTree(client) tree = app_commands.CommandTree(client)
COOLDOWN_PERIOD = 5
@client.event @client.event
async def on_ready(): async def on_ready():
print(client.user) print(client.user)
@@ -27,13 +24,10 @@ async def on_message(msg: discord.Message):
if msg.author.bot: if msg.author.bot:
return return
user = aura.get(str(msg.author.id)) user = aura.get(str(msg.author.id))
time_elapsed = time.time() - user.last_earned if int(time.time() - user.last_earned) >= COOLDOWN_PERIOD:
print(time_elapsed)
if time_elapsed >= COOLDOWN_PERIOD:
user.balance += 3 user.balance += 3
user.last_earned = time.time() user.last_earned = time.time()
aura.update(user) aura.update(user)
await client.process_commands(msg)
@client.event @client.event
async def on_member_join(member: discord.Member): async def on_member_join(member: discord.Member):