Comments (6)
Fixed the issue by adding some line of codes after line 296
if re.search(r"https://ptb.discordapp\.com/channels/\d+/\d+/\d+", ctx.message.content, re.I) != None:
return "discord link"
if re.search(r"https://canary.discordapp\.com/channels/\d+/\d+/\d+", ctx.message.content, re.I) != None:
return "discord link"
I know it might be not a great solution knowing that I have 0 knowledge in progamming, let alone python, and I just basically strip the existing code and added one word on it. But at least it works.
Edit: Markdown error and added comment
from saucebot.
Hello, thank you very much for reporting this issue. Sorry for the late reply, but I only found time now to return to this.
I was not even aware of the PTB and Canary Discord environments. I do my development and testing in stable release of Discord, so currently I'm not able to test the changes myself. However, if the messages themselves are not structured differently in them, supporting those links should be very easy - I have changed the link-detecting regex from
https://discordapp\.com/channels/\d+/\d+/\d+
to
https://(ptb\.|canary\.){0,1}discordapp\.com/channels/\d+/\d+/\d+
and, at least when testing with regex101, it seems to correctly detect both normal and ptb/canary links.
Now, I'll add this change to the repository, but only once I get the bot running again, and for that I'll have to update the bot to run on discord.py 1.5.0 with Intents, so it'll be a few days.
from saucebot.
The change mentioned above has been added to the repo. If you want to, you can check now if it works in PTB/Canary environments.
from saucebot.
Unfortunately it didn't work and return canary and ptb link as a link and not detect the attachment
from saucebot.
Okay, I installed Canary and verified the issue. However, I have also immediately noticed my error in the regex. While the example I posted the the first comment is correct, what I added to the code has the optional part in the wrong place. The correction 3d4a283 has been pushed to the repo and now it seems to work correctly:
from saucebot.
I have done more testing - especially during reimplementing batch mode - and found that, at least in Canary, the domain in the links to messages has changed from discordapp.com
to discord.com
. Since the stable release of Discord still returns discordapp.com
, both possibilities are now handled by the bot.
from saucebot.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from saucebot.