It's a discord bot, so I'll censor the token, too.
import requests
import time
import discord
import json
user_agent = f'{username}/{botname}'
headers = {'Connection': 'Keep alive', 'Content-Type': 'application/x-www-form-urlencoded', 'User-Agent': user_agent}
def login() -> requests.Session:
session = requests.Session()
payload = {'username': username, 'password': password}
req = session.post('https://services.fandom.com/mobile-fandom-app/fandom-auth/login', data=payload, headers=headers)
print(req.json())
return session
x = login()
headers = {'Accept': 'application/hal+json', 'User-Agent': user_agent}
def postReply(y):
payload = {'source':"DISCUSSIONS", 'siteId':"3385897", 'threadId':"4400000000000152644",'attachments':None,'body':y,'jsonModel':y}
print(x.post("https://gabby-protection-program.fandom.com/wikia.php?controller=DiscussionPost&method=create",headers=headers,json=payload).json())
class MyClient(discord.Client):
async def on_ready(self):
print(f'Logged on as {self.user}!')
async def on_message(self, message):
postReply("Message%20from")
if (str(message.channel) == "wiki-chat"):
if message.author == client.user:
return
await message.channel.send("Hi!")
intents = discord.Intents.default()
intents.message_content = True
client = MyClient(intents=intents)