-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add multiple messages to avoid the bot being blocked as spam
- Loading branch information
Showing
3 changed files
with
65 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,81 @@ | ||
enum TWHookServerTexts { | ||
USER_NOT_FOUND = 'π΄ User Not Found.\nPlease use\n/init\nto initialize your account', | ||
INVALID_PROJECT_NUM = 'π΄ Invalid project number\n', | ||
BAD_TOKEN = 'π΄ Something is wrong with your account configuration.\nPlease run\n/init\ncommand', | ||
TWEETS_SAVED_TO = 'π΄ Now the tweets will be saved to:\n', | ||
ADDED_TO_ACCOUNT = 'π΄ Added to your account', | ||
CANT_DELETE = 'π΄ Can\'t delete your account. Try again. If the problem persists, contact @dubisdev_', | ||
DELETED_ACCOUNT = 'π΄ All your account data has been deleted', | ||
ALERT_DELETE = 'π΄ Are you sure you want to delete your account? This action CAN NOT be undone. \nType\n/deleteall\nto continue', | ||
HELP = 'π΄ Available Commands:\n\n/init - Set up your account\n/config - Get your account data\n/delete - Delete your account\n/project <number> - Set up your default project\n/help - Shows this message\n\nβ οΈ Don\'t forget the slash (/) before the command' | ||
} | ||
|
||
export const generateInitText = (userId: string) => ` | ||
π΄ Hi there!\n\ | ||
export const getRandomAddedToAccountText = () => { | ||
const texts = [ | ||
'π΄ Added to your account', | ||
'π΄ Tweet added to your account', | ||
'π΄ I\'ve added that to your account', | ||
'π΄ The tweet\'s been added to your account', | ||
'π Tweet added to your account', | ||
'π Added to your account', | ||
'π I\'ve added that to your account', | ||
'π The tweet\'s been added to your account'] as const; | ||
return texts[Math.floor(Math.random() * texts.length)]; | ||
}; | ||
|
||
export const getRandomUserNotFoundMessage = () => { | ||
const texts = [ | ||
'π΄ User not found. Please send \'/init\' to start using this bot', | ||
'β User not found. Please send \'/init\' to start using this bot', | ||
'π΄ I couldn\'t find you in my database. Please send \'/init\' to start using this bot', | ||
'β I couldn\'t find you in my database. Please send \'/init\' to start using this bot', | ||
'β User Not Found. Who are you? Please send \'/init\' to start using this bot', | ||
'β I couldn\'t find you in my database. Who are you? Please send \'/init\' to start using this bot', | ||
'π΄ User Not Found. Who are you? Please send \'/init\' to start using this bot' | ||
] as const; | ||
return texts[Math.floor(Math.random() * texts.length)]; | ||
}; | ||
|
||
const TWHookServerTexts = { | ||
USER_NOT_FOUND: 'π΄ User Not Found.\nPlease use\n/init\nto initialize your account', | ||
INVALID_PROJECT_NUM: 'π΄ Invalid project number\n', | ||
BAD_TOKEN: 'π΄ Something is wrong with your account configuration.\nPlease run\n/init\ncommand', | ||
TWEETS_SAVED_TO: 'π΄ Now tweets will be saved to:\n', | ||
CANT_DELETE: 'π΄ Can\'t delete your account. Maybe your account has already been deleted?', | ||
DELETED_ACCOUNT: 'π΄ All your account data has been deleted', | ||
ALERT_DELETE: 'π΄ Are you sure you want to delete your account? This action CAN NOT be undone. \nType\n/deleteall\nto continue', | ||
HELP: 'π΄ Available Commands:\n\n/init - Set up your account\n/config - Get your account data\n/delete - Delete your account\n/project <number> - Set up your default project\n/help - Shows this message\n\nβ οΈ Don\'t forget the slash (/) before the command' | ||
} as const; | ||
|
||
export const generateInitText = (userId: string) => { | ||
const HEADER_EMOJIS = ['π΄', 'π', 'π', 'π'] as const; | ||
const headerEmoji = HEADER_EMOJIS[Math.floor(Math.random() * HEADER_EMOJIS.length)]; | ||
return ` | ||
${headerEmoji} Hi there!\n\ | ||
I'm AddTodoist bot and I'm here to help you save tweets and threads to your Todoist account.\n\ | ||
\nFirst of all, you must cofigure me for making me able to access your account.\n\n\ | ||
Follow this steps:\n\ | ||
1. Go to https://todoist.com/oauth/authorize?client_id=${process.env.TODOIST_CLIENT_ID}&scope=data:read_write&state=${userId}\n\ | ||
2. Grant app permissions.\n\ | ||
3. When you are done I will come back to set up your projects cofiguration.`; | ||
}; | ||
|
||
export const generateConfigText = ({ | ||
username, | ||
email, | ||
projectName, | ||
projectId, | ||
}) => ` | ||
π΄ This is your current configuration:\n\ | ||
}) => { | ||
const HEADER_EMOJIS = ['π΄', 'βοΈ', 'β¬οΈ', 'π'] as const; | ||
const headerEmoji = HEADER_EMOJIS[Math.floor(Math.random() * HEADER_EMOJIS.length)]; | ||
return ` | ||
${headerEmoji} This is your current configuration:\n\ | ||
- Username: ${username}\n\ | ||
- Email: ${email}\n\ | ||
- Project: ${projectName} (id: ${projectId})`; | ||
}; | ||
|
||
export const generateInvalidDMText = (username: string) => ` | ||
π΄ Welcome ${username}!\n\n\ | ||
export const generateInvalidDMText = (username: string) => { | ||
const HEADER_EMOJIS = ['π΄', 'π«', 'β', 'β'] as const; | ||
const headerEmoji = HEADER_EMOJIS[Math.floor(Math.random() * HEADER_EMOJIS.length)]; | ||
return ` | ||
${headerEmoji} Hi ${username}!\n\n\ | ||
It seems like you have sent me an invalid message.\n\n\ | ||
Please, send me a valid command or type\n\ | ||
'/init'\n\ | ||
to start your account configuration.\n\n\ | ||
For more information type\n\ | ||
'/help'\n\n\ | ||
β οΈ Don't forget the slash (/) before the commands`; | ||
}; | ||
|
||
export default TWHookServerTexts; |