This repository has been archived by the owner on May 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 116
Adding Redirections
Aditya Thebe edited this page Nov 10, 2018
·
2 revisions
/add <source> <destination>
/**
* @param {String} sender Chat id of the owner
* @param {String} source Username / Link of Source
* @param {String} destination Username / Link of Destination
*/
addRedirection (sender, source, destination)
- Usernames must start with '@"
- Invitation links must start with 'https://t.me/joinchat' or 't.me/joinchat'
- Should return an object
Example Response
// Response for username
{
'username': 'adityathebe',
}
// Response for invitation link
{
'hash': 'xyzjskdl123'
}
// If neither
{
'error': 'Invalid format'
}
ForwardAgent.getEntity(entity)
Need to make sure the entities are valid before we send a join request to them.
NOTE: This check is important because a request to join an entity where the agent is already a participant of will result in an error.
Should return an object in case of success
// User Entity
{
joinable: true,
accessHash: 'kjsdfkasd1234kl1j',
bot: true, // false
title: 'adityathebe',
chatId: '491823011',
}
// Channel Entity
{
joinable: true,
chatId: '023129382',
title: 'Best Channel',
accessHash: 'kjasdf902134j',
megagroup: true, // false
left: true, //false
}
// Unreachable Invitation link
{
joinable: true,
}
In any other case, will return an error object
// Private Entity
ForwardAgent.joinPrivateEntity(hash)
// Public Entity
ForwardAgent.joinPublicEntity(entity)
database.getRedirection(owner)
Store redirection
- src_title
- src_chat_id
- src_username
- dest_title
- dest_chat_id
- dest_username
- owner