Search code examples
terminaldiscord.pymessage

Can a bot send a message copied from terminal?


Okay, so this is just a random idea i got. but does anyone know if i can send a message with my bot, that was copied out of my terminal after startup?

so, i got this in my terminal at on_ready:

@client.event

async def on_ready():

print("                                                              ")
print("       ____        __________            ____   ____   ____   ")
print("      /   /       /         /           /   /  /   /  /   /   ")
print("     /   /       /   _____ /           /   /  /   /  /   /    ")
print("    /   /       /_____    /           /   /  /   /  /   /     ")
print("   /   /____   /         /           /   /__/   /__/   /      ")
print("  /________/  /_________/           /_________________/       ")
print("                        ============                          ")
print("                                                              ")
await asyncio.sleep(1.5)
print("                           READY                              ")
await asyncio.sleep(1.5)
print("                            TO                                ")
await asyncio.sleep(1.5)
print("                            GO                                ")
print("                                                              ")

does anyone know if theres a possibility that i can exactly copy this and make it a message?

i tried making one with instead of print, i used await ctx.send but then i got this as my message:

        __                  __
/   /       /         /           /   /  /   /  /   /
/   /       /   _ /           /   /  /   /  /   /
/   /       /_    /           /   /  /   /  /   /
/   /__   /         /           /   //   /__/   /
/__/  /__/           /__/
============

this is the code btw:

@client.command()
async def name(ctx):

await ctx.send("                                                              ")
await ctx.send("       ____        __________            ____   ____   ____   ")
await ctx.send("      /   /       /         /           /   /  /   /  /   /   ")
await ctx.send("     /   /       /   _____ /           /   /  /   /  /   /    ")
await ctx.send("    /   /       /_____    /           /   /  /   /  /   /     ")
await ctx.send("   /   /____   /         /           /   /__/   /__/   /      ")
await ctx.send("  /________/  /_________/           /_________________/       ")
await ctx.send("                        ============                          ")
await ctx.send("                                                              ")

edit: LS_W is the name of the bot. i want to be able to do !name, and then that LS_W from the terminal will be in a dc text message if possible.


Solution

  • Discord will delete leading spaces for all normal messages.

    You could try enclosing it in a code block.

    @client.command()
    async def name(ctx):
    
        message = "```\n"
        message += "       ____        __________            ____   ____   ____   \n"
        message += "      /   /       /         /           /   /  /   /  /   /   \n"
        message += "     /   /       /   _____ /           /   /  /   /  /   /    \n"
        message += "    /   /       /_____    /           /   /  /   /  /   /     \n"
        message += "   /   /____   /         /           /   /__/   /__/   /      \n"
        message += "  /________/  /_________/           /_________________/       \n"
        message += "                        ============                          \n"
        message += "                                                              \n"
        message += "```"
    
        await ctx.send(message)