Created
July 17, 2024 19:05
-
-
Save Priyansxu/af046bc18c03ff22991203daad3578c4 to your computer and use it in GitHub Desktop.
Discord Nitro Sniper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import discord | |
import re | |
import requests | |
class NitroSniper(discord.Client): | |
def __init__(self, token): | |
super().__init__() | |
self.token = token | |
async def on_ready(self): | |
print(f'Logged in as {self.user}') | |
async def on_message(self, message): | |
nitro_pattern = r'(discord\.gift|discord\.com\/gifts)\/[a-zA-Z0-9]+' | |
codes = re.findall(nitro_pattern, message.content) | |
for code in codes: | |
self.redeem_nitro(code) | |
def redeem_nitro(self, code): | |
headers = {'Authorization': self.token} | |
url = f'https://discordapp.com/api/v6/entitlements/gift-codes/{code.split("/")[-1]}/redeem' | |
response = requests.post(url, headers=headers) | |
if response.status_code == 200: | |
print(f'Successfully redeemed Nitro code: {code}') | |
else: | |
print(f'Failed to redeem Nitro code: {code}') | |
if __name__ == "__main__": | |
TOKEN = 'YOUR_DISCORD_TOKEN' | |
client = NitroSniper(TOKEN) | |
client.run(TOKEN) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment