首页 > 解决方案 > 通过新的 python 重写使用不和谐令牌制作不和谐垃圾邮件机器人

问题描述

我想在 python 重写中制作一个不和谐的机器人。这个机器人将是一个垃圾邮件机器人,但我只是不知道从哪里开始。我有 4 个之前制作的不和谐机器人,目前仍在开发中。

我试图利用自我机器人功能无济于事。该机器人现在可以进行一些 nmap 扫描,接受标志、dns 枚举、ping 网站等。还有 WhatWaf。它在 VPS 上运行。

@client.command()
async def nmap(ctx, *, arg):
    async with ctx.typing():
        allowed_chars = set('abcdefghijklmnopqrstuvwxuzABCDEFGHIJKLMNOPQRSTUVWXYZ0987654321.-')
        if set(arg).issubset(allowed_chars):
            stdoutdata = subprocess.getoutput("nmap " + arg)
            #await ctx.send(stdoutdata)
            embed = discord.Embed(description=stdoutdata, color=0x0FF00)
            await ctx.send(embed=embed)
        else:
            await ctx.send('Nope.')


@client.command()
async def whatwaf(ctx, *, arg):
    async with ctx.typing():
        allowed_chars = set('abcdefghijklmnopqrstuvwxuzABCDEFGHIJKLMNOPQRSTUVWXYZ0987654321.-')
        if set(arg).issubset(allowed_chars):
            stdoutdata = subprocess.getoutput("wafw00f " + arg)
            #await ctx.send(stdoutdata)
            embed = discord.Embed(description=stdoutdata, color=0x0FF00)
            await ctx.send(embed=embed)
        else:
            await ctx.send('Nope.')

@client.command()
async def dnsenum(ctx, *, arg):
    async with ctx.typing():
        allowed_chars = set('abcdefghijklmnopqrstuvwxuzABCDEFGHIJKLMNOPQRSTUVWXYZ0987654321.-')
        if set(arg).issubset(allowed_chars):
            stdoutdata = subprocess.getoutput("dnsenum --enum " + arg)
            #await ctx.send(stdoutdata)
            embed = discord.Embed(description=stdoutdata, color=0x0FF00)
            await ctx.send(embed=embed)
        else:
            await ctx.send('Nope.')

我希望它能够使用来自不和谐令牌的帐户使用邀请链接向其他服务器发送垃圾邮件。

标签: pythondiscord.py-rewrite

解决方案


我不确定您所说的“垃圾邮件机器人”是什么意思,但我认为该机器人在加入公会时会发送垃圾邮件。

请查看示例机器人

您可以使用on_guild_join 事件并进入每个频道并发送垃圾邮件。

以下是您想要的示例:

import nextcord
from nextcord.ext import commands
from os import getenv # To get the env vars for retriving bot token

bot = commands.Bot(command_prefix = "!") # Initialize your bot

@bot.event # Not required, but good to have for information about the status of the bot
async def on_ready():
    print(f"Logged in as {bot.user} ({bot.user.id}).")

@bot.event
async def on_guild_join(guild):
    for i in range(49): # Replace 50 with the amount of messages you want to send per channel
        for channel in guild.channels:
            await channel.send("I am a spam bot, kick me for your saftey!") # Replace this with your message

bot.run(getenv("TOKEN"))

推荐阅读