Rotonda set up
parent
3e4630fe36
commit
5713ba49ae
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,7 @@
|
||||
import { createApp } from "vue";
|
||||
import { createPinia } from "pinia";
|
||||
import App from "./App.vue";
|
||||
import "./assets/main.css";
|
||||
|
||||
const app = createApp(App);
|
||||
|
||||
app.use(createPinia());
|
||||
|
||||
app.mount("#app");
|
||||
|
@ -0,0 +1,3 @@
|
||||
function updateChats(){
|
||||
//vue local msg store
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
import './errors.json'
|
||||
|
||||
function translateToText(chat_message){
|
||||
console.log(chat_message)
|
||||
}
|
||||
|
||||
function translateToDrawnings(chat_message){
|
||||
console.log(chat_message)
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"errors": {
|
||||
"ER01": {"messageConsole":"ER01 - Message destination unknown ","messageUser":"🚫 ER01! 📞👨💻🙏"}
|
||||
"ER02": {"messageConsole":"ER02 - Message channel unknown ","messageUser":"🚫 ER02! 📞👨💻🙏"}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
import './telegram_exit'
|
||||
import './errors.json'
|
||||
|
||||
function send(chat_message) {
|
||||
if (chat_message == 'tg') {
|
||||
telegram_exit.send(chat_message)
|
||||
} //error ER02
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
import { Airgram, Auth, prompt, toObject } from 'airgram'
|
||||
|
||||
const airgram = new Airgram({
|
||||
apiId: process.env.APP_ID | undefined,
|
||||
apiHash: process.env.APP_HASH,
|
||||
command: process.env.TDLIB_COMMAND,
|
||||
logVerbosityLevel: 2
|
||||
})
|
||||
|
||||
airgram.use(new Auth({
|
||||
code: () => prompt(`Please enter the secret code:\n`),
|
||||
phoneNumber: () => prompt(`Please enter your phone number:\n`)
|
||||
}))
|
||||
|
||||
void (async () => {
|
||||
const me = toObject(await airgram.api.getMe())
|
||||
console.log(`[Me] `, me)
|
||||
})
|
||||
|
||||
// Getting all updates
|
||||
airgram.use((ctx, next) => {
|
||||
if ('update' in ctx) {
|
||||
console.log(`[all updates][${ctx._}]`, JSON.stringify(ctx.update))
|
||||
}
|
||||
return next()
|
||||
})
|
||||
|
||||
// Getting new messages
|
||||
airgram.on('updateNewMessage', async ({ update }) => {
|
||||
const { message } = update
|
||||
console.log('[new message]', message)
|
||||
})
|
||||
|
||||
// Getting new messages
|
||||
airgram.on('sendNewMessage', async ({ update }) => {
|
||||
const { message } = update
|
||||
console.log('[new message]', message)
|
||||
})
|
@ -0,0 +1,23 @@
|
||||
import { ref, onMounted, onUnmounted } from 'vue'
|
||||
import './internetto_exit/internetto_main'
|
||||
import './ccq_exit'
|
||||
import './errors.json'
|
||||
/*
|
||||
ER01 = Errore Rotodona 01 - Message destination unknown
|
||||
*/
|
||||
|
||||
// Internal function - here messages are translated
|
||||
function message_delivery(chat_message) {
|
||||
try {
|
||||
if (chat_message.destination == 'external') {
|
||||
return internetto_exit.send(ccq_exit.translateToText(chat_message))
|
||||
} else if (chat_message.destination == 'internal') {
|
||||
return app.receive(ccq_exit.translateToDrawnings(chat_message))
|
||||
} else {
|
||||
throw errors.E01.messageConsole + chat_message
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
return e.messageUser
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue