lets go we ball
This commit is contained in:
parent
e2d064cda5
commit
aaf17c5bd1
2 changed files with 13 additions and 69 deletions
81
main.py
81
main.py
|
@ -1,82 +1,25 @@
|
|||
import time
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from dotenv import load_dotenv
|
||||
import os
|
||||
import re
|
||||
import random
|
||||
|
||||
load_dotenv()
|
||||
|
||||
user_last_processed = {}
|
||||
|
||||
def contains_only_1_to_12(text):
|
||||
return bool(re.search(r'(?:\D|^)(0?[1-9]|1[0-2])(?:\D|$)', text))
|
||||
|
||||
def should_process_message(user_id):
|
||||
current_time = time.time()
|
||||
|
||||
if user_id == 886685857560539176:
|
||||
return True # Always allow the owner
|
||||
|
||||
last_time = user_last_processed.get(user_id, 0)
|
||||
|
||||
if current_time - last_time >= 1:
|
||||
user_last_processed[user_id] = current_time
|
||||
return True # Allow processing
|
||||
else:
|
||||
return False # Too soon
|
||||
|
||||
class Vaius(discord.Client):
|
||||
class Vaius(commands.Bot):
|
||||
async def on_ready(self):
|
||||
print("logged in as", self.user)
|
||||
await self.change_presence(
|
||||
status=discord.Status.invisible
|
||||
)
|
||||
print(f"Logged in as {self.user.name}")
|
||||
|
||||
async def on_message(self, message):
|
||||
if message.channel.id != 1363685774800978074:
|
||||
return
|
||||
|
||||
if not should_process_message(message.author.id):
|
||||
async def on_message(self, message: discord.Message):
|
||||
if (message.guild and message.guild.id != 1362175947612098892) and message.channel.id != 1363685774800978074:
|
||||
return
|
||||
ctx = await self.get_context(message)
|
||||
if ctx.valid:
|
||||
await self.invoke(ctx)
|
||||
|
||||
mc = message.content.lstrip("> ")
|
||||
@Vaius.command
|
||||
async def ping(self, ctx):
|
||||
await ctx.reply("Pong!")
|
||||
|
||||
if mc == "vping":
|
||||
await message.reply("Pong!")
|
||||
if mc.startswith("vsay "):
|
||||
tosay = mc.replace("vsay ", "")
|
||||
if contains_only_1_to_12(tosay):
|
||||
await message.reply(random.choice(["https://open.spotify.com/track/2Rk4JlNc2TPmZe2af99d45", "https://open.spotify.com/track/1P17dC1amhFzptugyAO7Il", "https://open.spotify.com/track/1jJci4qxiYcOHhQR247rEU"]))
|
||||
return
|
||||
await message.reply(tosay)
|
||||
client = Vaius(command_prefix="v", user_bot=True, chunk_guilds_at_startup=False)
|
||||
|
||||
if mc.startswith("vban"):
|
||||
parts = message.content.split()
|
||||
if len(parts) < 2:
|
||||
return
|
||||
|
||||
target = None
|
||||
|
||||
if message.mentions:
|
||||
target = message.mentions[0].id
|
||||
else:
|
||||
try:
|
||||
target = int(parts[1])
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print(target)
|
||||
if target:
|
||||
try:
|
||||
if message.author.id == 785227396218748949:
|
||||
target = 785227396218748949
|
||||
user = await self.fetch_user(target)
|
||||
if user.id == 886685857560539176:
|
||||
return
|
||||
await message.channel.remove_recipients(user)
|
||||
await message.reply(f"Done! <:BAN:1313652115041816616>\n\nBanned **{user}** (<@{user.id}>)")
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
client = Vaius(chunk_guilds_at_startup=False)
|
||||
client.run(os.getenv("TOKEN"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue