juzibot / qiji-bot Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
Add solutions for multiple people at the same time
Add Auto Refresh Function
need organization administrator privilege to do that.
QijiBot/src/coupling/sendpic.ts
import { getWechaty } from '../get-wechaty'
import { FileBox } from 'file-box'
export async function sendpic (
url: string,
toId: string,
) {
const name = process.env.WECHATY_NAME || 'heroku-wechaty'
const bot = getWechaty(name)
const contact = bot.Contact.load(toId)
await contact.sync()
const fileBox = FileBox.fromUrl(url)
await contact.say(fileBox)
}
QijiBot/src/start-web.ts
import { sendpic } from './coupling/sendpic'
async function sendpicHandler (request: Request, response: ResponseToolkit) {
log.info('startWeb', 'sendpicHandler()')
const payload: {
url: string,
toId: string,
} = request.payload as any
await sendpic(payload.url, payload.toId)
return response.redirect('/')
}
const SendpicHtml = (mes: Message, saying: string, abb: string, color:string) => {
const from = mes.from()
// <label for="sendmes">${saying}</label>
return `
<form action="/sendpic/" method="post" style="display:inline">
<input id="${mes.id}" type="hidden" name="url" value="${saying}" >
<input id="${mes.id}" type="hidden" name="toId" value="${(from && from.id) || ''}">
<input type="submit" value="${abb}" title="${saying}" style="width:10%;height:40px;background-color: #${color};border-radius:5px;color:#575169;margin:0 0.5% 0.5% 0">
</form>
`
}
const FourThree = SendpicHtml(mes, 'https://phaedodata-1253507825.cos.ap-beijing.myqcloud.com/YCCooperate/%E6%88%91%E6%83%B3%E6%8A%95%E8%B5%84%E5%B0%8F%E6%B5%85.png', '发图片png', 'f9f5ea')
server.route({
handler: sendpicHandler,
method : 'POST',
path : '/sendpic/',
})
The function can be run, but the picture can not be sent.
Add Picture Sending Function
Before user use the web, make sure who he is.
Enable to thank wechaty and contributor.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.