Advertisement
Guest User

cool message edit animation

a guest
Nov 12th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.26 KB | None | 0 0
  1. import random
  2. import time
  3. import os
  4. import requests
  5. import json
  6.  
  7. if os.name == "nt":
  8.     os.system("cls")
  9. else:
  10.     os.system("clear")
  11.  
  12. messagesend = input("Enter message: ")
  13. status_data = json.dumps({"content": messagesend})
  14.  
  15. token = "YOUR TOKEN"
  16.  
  17. channel_id = input("Enter channel ID: ")
  18.  
  19. r = requests.post("https://discordapp.com/api/v6/channels/" + channel_id + "/messages", headers={"Authorization": token, "Content-Type": "application/json"}, data=status_data)
  20.  
  21. data = r.json()
  22. message_id = data['id']
  23.  
  24.  
  25. while True:
  26.   message = messagesend
  27.   message2 = message
  28.   loop = ""
  29.   for n in message:
  30.       loop += n
  31.       status_data = json.dumps({
  32.               "content": loop
  33.               })
  34.      
  35.  
  36.       r = requests.patch("https://discordapp.com/api/v6/channels/" + channel_id + "/messages/" + message_id, headers={"Authorization": token, "Content-Type": "application/json"}, data=status_data)
  37.       print(loop + "\r", end="")
  38.       if r.status_code == 429:
  39.           time.sleep(5)
  40.           break
  41.       time.sleep(0.1)
  42.  
  43.   message = " " + message + " "
  44.   for n in message:
  45.       count = 2
  46.       while count > 0:
  47.           message += message[0]
  48.           message = message[1:]
  49.           count -= 1
  50.          
  51.           status_data = json.dumps(
  52.               {
  53.                   "content": message
  54.               }
  55.           )
  56.  
  57.           r = requests.patch("https://discordapp.com/api/v6/channels/" + channel_id + "/messages/" + message_id, headers={"Authorization": token, "Content-Type": "application/json"}, data=status_data)
  58.           print(message + "\r", end="")
  59.           if r.status_code == 429:
  60.               time.sleep(5)
  61.               meme = True
  62.           #time.sleep(0.09)
  63.  
  64.   message = message2
  65.  
  66.   for n in range(len(message)):
  67.       message = message.replace(message[random.randint(0, len(message) - 1)], " ")
  68.       status_data = json.dumps(
  69.           {
  70.               "content": message
  71.           }
  72.       )
  73.  
  74.       r = requests.patch("https://discordapp.com/api/v6/channels/" + channel_id + "/messages/" + message_id, headers={"Authorization": token, "Content-Type": "application/json"}, data=status_data)
  75.       print(message + "\r", end="")
  76.       if r.status_code == 429:
  77.           time.sleep(5)
  78.       time.sleep(0.2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement