Comments (7)
oooh and emoji
from scrappy.
Yeah I was going to implement on the frontend but actually it’d be way more performant to do backend-side
from scrappy.
export const formatText = (text) => {
//<@USLACKBOT>
// if (text.includes('<@')) {
// const userId = text.split('@').pop().split('>')[0]
// console.log(`userId`, userId)
// const userProfile = await fetch(`https://slack.com/api/users.profile.get?token=${process.env.SLACK_BOT_TOKEN}&user=${userId}`)
// }
let userIds = text.split(' ').filter((word) => word.includes('<@U'))
if (userIds.length == 0) return text
userIds.forEach(async (userId) => {
try {
const id = userId.split('@').pop().split('>')[0]
const userProfile = await fetch(
`https://slack.com/api/users.profile.get?token=${process.env.SLACK_BOT_TOKEN}&user=${id}`
).then((r) => r.json())
console.log(userProfile)
const displayName = userProfile.profile.display_name
userId = `@${displayName}`
} catch (err) {
console.log(err)
}
})
console.log(userIds.join(' '))
return userIds.join(' ')
}
from scrappy.
You’re an icon, thank you so much! @MatthewStanciu will test out/implement today.
from scrappy.
oh lol i didnt write this code, i found it in pre existing code in this repo
from scrappy.
Yep this is my code that I wrote in the beginning stages of scrappy but never finished. It doesn’t work, but it’s pretty close. If anyone wants to help get it all the way there, it would be super appreciated :)
from scrappy.
Try to do this, Javascript is confusing
#26 makes it a bit cleaner
Well it really only removes the angle brackets and wraps it in a span element with a specific class
from scrappy.
Related Issues (20)
- Scrappy keeps resetting my streak for some reason HOT 1
- Setup a staging environment on scrappy
- Emit metric to grafana for streak resets
- Scrappy doesn't have good error message when attempting to scrappify old slack msgs HOT 1
- Investigate why scrappy cannot listen on all channels for emoji reactions HOT 1
- Fix false-positive alert re: unsuccessful traffic HOT 1
- Ignore extraneous attachments HOT 5
- scrappy does not support media-only scrapbooks
- DUE 09/2025 - Migrate AWS SDK to JavaScript SDK v3
- add alerting to quickly detect when scrappy crashes
- add support for uploading heic images to scrapbook HOT 5
- API Route for turning Slack User -> Scrappy username HOT 8
- fix timezone check in scrappy app HOT 1
- Reacting & unreacting whilst processing creates duplicate posts
- Push to API endpoint on new post HOT 1
- Uncaught TypeError causes scrappy to crash
- differentiate scrappy traffic by requestor HOT 1
- Scrappy responds saying a post has been edited when a new scrap is sent HOT 5
- Scrappy mentions losing your streak every hour
- Feature Request - Scrapbook Plugins Support
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 scrappy.