(17 March, 2023 - 01:53 PM)ripperlol Wrote: Show More
import random
import discord
from discord.ext import commands
import requests
import os
from discord.ext.commands import CommandOnCooldown
tkn = "YOUR_TOKEN"
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
@
Bot.command()
async def addtype(ctx, type):
if ctx.author.guild_permissions.administrator:
with open(f"{type}.txt", "w") as file:
await ctx.send(f"added {type} to the database!")
file.close()
else:
ctx.send("bruh")
@
Bot.command()
async def deletetype(ctx, type):
if ctx.author.guild_permissions.administrator:
try:
os.remove(f"{type}.txt")
await ctx.send(f"removed {type} from the database!")
except:
await ctx.send(f"{type} is not in the database...")
@
Bot.command()
async def addaccounts(ctx, account):
if ctx.author.guild_permissions.administrator:
accounts = ctx.message.attachments[0].url
accs = requests.get(accounts)
lines = accs.content.decode()
with open(f"{account}.txt", "w", encoding="utf-8", newline='') as file:
file.write(lines)
@
Bot.command(pass_context=True)
@commands.cooldown(1, 30, commands.BucketType.user)
async def gen(ctx, type):
with open(f"{type}.txt", "r") as file:
lines = file.readlines()
user = ctx.author
if lines[0] == 0:
ctx.send(f"{type} is empty")
else:
await user.send(f"your accounts is: ||{lines[0]}|| \n you can use this command again it 30 seconds")
with open(f"{type}.txt", "w") as file:
for index, line in enumerate(lines):
if index != 0:
file.write(line)
bot.run(tkn)