Using Python Requests to Send Discord Messages

Поділитися
Вставка
  • Опубліковано 1 гру 2024

КОМЕНТАРІ • 59

  • @user-bf9gf8yv6k
    @user-bf9gf8yv6k 7 місяців тому +22

    import requests
    url = "place you want to send"
    payload ={
    "content" : "content of what you want to send"
    }
    headers = {
    "Authorization" : "token"
    }
    res = requests.post(url, payload, headers=headers)

    • @SansUndertale-vg4jp
      @SansUndertale-vg4jp 7 місяців тому

      Tip: you can leave one line and paste it again to add two messages
      Tip2: if you want to spam just use auto clicker on run button

    • @ShivanshTiwari-mp6fp
      @ShivanshTiwari-mp6fp 6 місяців тому

      ​@@SansUndertale-vg4jp you can use a loop if you want to spam

    • @edbertjuans2706
      @edbertjuans2706 4 місяці тому

      @@ShivanshTiwari-mp6fp how

    • @chessperson
      @chessperson 3 місяці тому

      @@edbertjuans2706
      import requests
      k = "number of times you want to send the same message"
      n = int(k)
      url = "place you want to send"
      payload ={
      "content" : "content of what you want to send"
      }
      headers = {
      "Authorization" : "token"
      }
      for i in range(1,n+1,1):
      res = requests.post(url, payload, headers=headers)

    • @8DLORE
      @8DLORE 2 місяці тому

      @@edbertjuans2706 for i in range(1000):

  • @rugmaable
    @rugmaable Рік тому +4

    you are a saver. Your tutorial is straight to the point. You are really doing an amazing job.

  • @cmrncrick
    @cmrncrick Рік тому +3

    This is exactly what I needed! Thank you!

  • @ultrapluton3883
    @ultrapluton3883 8 місяців тому +6

    could you please make a video on how can you incorporate slash (/) commands with this since the message is getting sent but the bot action is not being taken

  • @MuhaPale
    @MuhaPale 8 місяців тому +2

    how can you incorporate slash (/) commands with this since the message is getting sent but the bot action is not being taken

  • @criticols310
    @criticols310 11 місяців тому +3

    My code does not work at line 1 "import requests". I'm assuming I do not have the requests stuff to import, how can I fix this

    • @thecodebear
      @thecodebear  11 місяців тому +1

      You need to install requests library
      Type this command in terminal : pip install requests
      Or this one pip3 install requests

    • @heartsxxluna
      @heartsxxluna 10 місяців тому

      still doesnt work@@thecodebear

  • @SiddharthNarula
    @SiddharthNarula Місяць тому +1

    Hey!
    This is an awesome video
    But I put the code in a for loop like this -
    for i in range(12550, 13000):
    payload = {
    "content" : str(i)
    }
    res = requests.post(url, payload, headers=headers)
    sleep(1)
    And every 5th message is not being sent.
    Can someone please explain why?

  • @ragingscout97
    @ragingscout97 Рік тому +2

    thx man i just made the infinite pinging script :)

  • @sanjaydotzdr
    @sanjaydotzdr 3 місяці тому

    Thank you for this. Is there any way to do delete messages?

  • @xx_sad_dam_whose_sane_xx
    @xx_sad_dam_whose_sane_xx 9 місяців тому +1

    Does this work even if you close the discord app? Like if i just wanted to send a message but my client wasn't opened, not only minimized but completely exited

    • @Kuestionmarq
      @Kuestionmarq 9 місяців тому +1

      Yes it does work without having discord open

  • @tushantbhardwaj
    @tushantbhardwaj 10 місяців тому +1

    Can we use slash commands with this?

  • @leloth22
    @leloth22 10 місяців тому +1

    Hi, great tutorial, only when I try it, it is saying that there is "No module named 'requests' "

    • @thecodebear
      @thecodebear  10 місяців тому

      Run this command in terminal : pip install requests
      Or : pip3 install requests

    • @leloth22
      @leloth22 10 місяців тому

      @@thecodebear thank you so much! that really helped, keep up the amazing work!

  • @kfsman-b550
    @kfsman-b550 Рік тому +2

    very good tutorial, but how do i use more tokens to send messages

    • @TheHeadphonesAreNeeded
      @TheHeadphonesAreNeeded Місяць тому

      yes

    • @TheHeadphonesAreNeeded
      @TheHeadphonesAreNeeded Місяць тому

      add import random to the top
      headers = {
      "Authorization" : ["token 1, token 2, token 3"]
      }
      while(True):
      res = requests.post(url, payload, headers=random.choice(headers))
      and this

  • @qxr1
    @qxr1 2 місяці тому

    What about reading messages in a channel?

  • @kakw436
    @kakw436 Місяць тому

    THAAAANKS!!!

  • @maira4382
    @maira4382 9 місяців тому

    hi, this can be programmed to send the message every 8 hours or so?

  • @SamJha-j9p
    @SamJha-j9p Рік тому +1

    brooo thxx a lot

  • @eyebol
    @eyebol Рік тому +1

    how do you send slash commands with python requests

    • @thecodebear
      @thecodebear  11 місяців тому +3

      That is a bit complicated

    • @eyebol
      @eyebol 11 місяців тому +1

      @@thecodebear can you do a video on it🙏🙏🙏

  • @uzeryy
    @uzeryy 11 місяців тому +2

    do you need to go into developer mode

  • @JJReselling
    @JJReselling 8 місяців тому

    This action cannot be performed due to slowmode rate limit

  • @zelven6109
    @zelven6109 3 місяці тому

    How do i do this with my own bots

  • @BonaFideBOSS
    @BonaFideBOSS 7 місяців тому

    I'm getting unauthorized response

  • @IkarusBoi
    @IkarusBoi 7 місяців тому

    Why does it tell me No module named 'requests'

    • @thecodebear
      @thecodebear  7 місяців тому +1

      You need to install requests libarary

    • @IkarusBoi
      @IkarusBoi 7 місяців тому

      @@thecodebear Thank you i got it now :)
      Is there a way to automate, so the message is sent e.g. every 15 minutes?

  • @ethanf5441
    @ethanf5441 4 місяці тому

    i understand slash commands are harder. but nobody will elaborate on the code requirements to run it. i clearly can already send a message, so why not explain/show how to run slash commands with this system?
    even if someone has a link to an explanation, id take it....

  • @JerryShi-bv8wg
    @JerryShi-bv8wg 6 місяців тому

    how to make it so it auto sends every 2mins

    • @hinto_the_pancake
      @hinto_the_pancake 6 місяців тому

      you could import the time module and write a "while True" loop where the content is sent and then the program does "time.sleep(120)" before reiterating the loop, until the user enters some keyword like "exit" to break the loop

  • @hiengletran4134
    @hiengletran4134 4 місяці тому

    How if I change authorization of many accounts 😂?

  • @jy3044
    @jy3044 5 місяців тому

    Does Discord ban users for doing this?

  • @EMRANTHEBESTYT
    @EMRANTHEBESTYT Місяць тому

    hello

  • @DesmondNwan
    @DesmondNwan 10 місяців тому +1

    will this flag my account as bot ?

    • @Alvarezz6969
      @Alvarezz6969 9 місяців тому +2

      no. Simplemente es la forma de enviar mensajes en discord desde python

  • @theghuraba3387
    @theghuraba3387 8 місяців тому

    I want to send message every 5minute in a discord server

    • @hinto_the_pancake
      @hinto_the_pancake 6 місяців тому

      you could import the time module and write a "while True" loop where the content is sent and then the program does "time.sleep(300)" before reiterating the loop, until the user enters some keyword like "exit" to break the loop

  • @MuhaPale
    @MuhaPale 8 місяців тому +1

    how can you incorporate slash (/) commands with this since the message is getting sent but the bot action is not being taken

  • @JerryShi-bv8wg
    @JerryShi-bv8wg 6 місяців тому

    how to make it so it auto sends every 2mins