async function getUserID() {
const auth = await api.storage.get('user_auth')
return auth.id || 0
}
const chatHistory = async chat => {
const max = 400
const limit = 100
let offset = 0
let full = [],
messages = []
do {
const history = await telegram('messages.getHistory', {
peer: {
_ : 'inputPeerChannel',
channel_id : chat.id,
access_hash: chat.access_hash
},
max_id: offset,
offset: -full.length,
limit
})