I'm using the discussions API
And I'm just getting "an internal error occured"??
I'm using the discussions API
And I'm just getting "an internal error occured"??
Oki, lemme try
Still getting an error?
Error is..
{'title': 'An internal error was encountered. We are unable to fulfill the request at this time.', 'instance': '/internal/3385897/posts'}
Hmm okay what's your full code (minus username and password). I'll try and see if I get the same errors
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)
Try removing
'attachments':None,
From the payload
Oki!
IT WORKED
IT WORKED
THANK YOU SO SO SO SO MUCH
:DDDDDD
It sucks that there's no documentation
And again, THANK YOU SO SO SO MUCH
You might be able to make some use of https://github.com/YTFGolf/fandom-discussions-viewer/tree/main/src/lib/controllers/wikia if you want to do other things with a bot
There are some links at https://battle-cats.fandom.com/wiki/User:TheWWRNerdGuy/Messing_around_with_Discussions_API#Useful_links which also have a little documentation
What do you think?