LGHChat
Object
Basic anonymized user object
+0
| 1
| 2
| 3
| 4
Punishment to apply
+Object
antispam.js settings Object.
+Object
Object to reresent different punish settings for more chat types
+Object
Object to reresent different punish settings for messages containing various Alphabets
+Object
Object that refers to a target user
+Object
LGHPerms Object.
+Object
Object
object of MessageMaker
+object
TelegramBot.ChatAdministratorRights
| LGHAdminAdds
Array.<LGHAdmin>
Object
object with data about an user in a group
+Object
if pre-made role (string key) only users object should be used
+Object
warns.js plugin related data
+Object
welcome.js settings Object.
+Object
antiflood.js settings additional Object elements.
+LGHFloodAdds
| LGHPunish
antiflood.js settings Object.
+Object
antispam.js settings Object additional items.
+LGHSpamTgLinksAdds
| LGHPunish
antispam.js settings about Telegram Links Object.
+Object
antispam.js spam links Object additional items.
+LGHSpamLinksAdds
| LGHPunish
antispam.js settings about Links Object.
+LGHChatBasedPunish
antispam.js settings about foward.
+LGHChatBasedPunish
antispam.js settings about quote.
+Object
antispam.js settings Object.
+Object
goodbye.js settings
+Object
captcha.js settings
+Object
media.js settings, if LGHPunish is disabled the object will be deleted (undefinied)
+Object
Additional chat elements for chat object by LibreGroupHelp
+TelegramBot.Chat
| CustomChat
Full LGH chat object given by LGHBot events, custom items avaiable if working about a group
+Object
TelegramBot.User
| CustomUser
Custom chat object given by LGHBot events, custom items avaiable if working about a group
+Object
ParsedCommand Object.
+Object
Additional items to command for LGH
+Object
TelegramBot.Message
| CustomMessage
Custom chat object given by LGHBot events, custom items avaiable if working about a group
+Object
TelegramBot.CallbackQuery
| CustomCallback
Custom callback object given by LGHBot events, custom items may be avaiable
+Object
Object containing chat-related database functions.
+Object
Object containing user-related database functions.
+Object
Type returned by the getDatabase function.
+Object
LGHInterface
](#LGHInterface)
+ * [.TGbot](#LGHInterface+TGbot) : [TelegramBot
](https://github.com/yagop/node-telegram-bot-api/blob/master/doc/api.md)
+ * [.db](#LGHInterface+db) : [LGHDatabase
](#LGHDatabase)
+ * [.config](#LGHInterface+config) : Object
+ * [.onMessage(handler)](#LGHInterface+onMessage)
+ * [.onCallback(handler)](#LGHInterface+onCallback)
+ * [.sendMessage(userId, chatId, text, options)](#LGHInterface+sendMessage) ⇒ Boolean
\| Promise.<TelegramBot.Message>
+ * [.sendPhoto(userId, chatId, photo, options, fileOptions)](#LGHInterface+sendPhoto) ⇒ Boolean
\| Promise.<TelegramBot.Message>
+ * [.editMessageMedia(userId, media, options)](#LGHInterface+editMessageMedia) ⇒ Boolean
\| Promise.<TelegramBot.Message>
+ * [.editMessageText(userId, text, options)](#LGHInterface+editMessageText) ⇒ Promise.<Boolean>
+ * [.answerCallbackQuery(userId, callbackId, options)](#LGHInterface+answerCallbackQuery) ⇒ Promise.<Boolean>
+ * [.banChatMember(userId, chatId, targetId, options)](#LGHInterface+banChatMember) ⇒ Promise.<Boolean>
+ * [.unbanChatMember(userId, chatId, targetId, options)](#LGHInterface+unbanChatMember) ⇒ Promise.<Boolean>
+ * [.restrictChatMember(userId, chatId, targetId, options)](#LGHInterface+restrictChatMember) ⇒ Promise.<Boolean>
+
+
+
+### new LGHInterface(LibreGHelp)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| LibreGHelp | [LibreGHelp
](#LibreGHelp) | Libre Group Help telegram bot handler |
+
+
+
+### lghInterface.GHbot : [LGHInterface
](#LGHInterface)
+**Kind**: instance property of [LGHInterface
](#LGHInterface)
+
+
+### lghInterface.TGbot : [TelegramBot
](https://github.com/yagop/node-telegram-bot-api/blob/master/doc/api.md)
+**Kind**: instance property of [LGHInterface
](#LGHInterface)
+
+
+### lghInterface.db : [LGHDatabase
](#LGHDatabase)
+**Kind**: instance property of [LGHInterface
](#LGHInterface)
+
+
+### lghInterface.config : Object
+**Kind**: instance property of [LGHInterface
](#LGHInterface)
+
+
+### lghInterface.onMessage(handler)
+LGHbot message event handler
+
+**Kind**: instance method of [LGHInterface
](#LGHInterface)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| handler | function
| handler function |
+
+
+
+### lghInterface.onCallback(handler)
+LGHbot callback event handler
+
+**Kind**: instance method of [LGHInterface
](#LGHInterface)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| handler | function
| handler function |
+
+
+
+### lghInterface.sendMessage(userId, chatId, text, options) ⇒ Boolean
\| Promise.<TelegramBot.Message>
+LGHbot safely send message under user request limit
+
+**Kind**: instance method of [LGHInterface
](#LGHInterface)
+**Returns**: Boolean
\| Promise.<TelegramBot.Message>
- - returns true on success, false if request has been dropped out
+
+| Param | Type | Description |
+| --- | --- | --- |
+| userId | number
\| string
| id of user that's the cause of your request |
+| chatId | number
\| string
| chat where message should be sent |
+| text | String
| text of message |
+| options | TelegramBot.SendMessageOptions
| additional telegram options |
+
+
+
+### lghInterface.sendPhoto(userId, chatId, photo, options, fileOptions) ⇒ Boolean
\| Promise.<TelegramBot.Message>
+LGHbot safely send message under user request limit
+
+**Kind**: instance method of [LGHInterface
](#LGHInterface)
+**Returns**: Boolean
\| Promise.<TelegramBot.Message>
- - returns true on success, false if request has been dropped out
+
+| Param | Type | Description |
+| --- | --- | --- |
+| userId | | |
+| chatId | number
\| string
| chat where message should be sent |
+| photo | TelegramBot.InputMediaPhoto
| photo |
+| options | TelegramBot.SendPhotoOptions
| additional telegram options |
+| fileOptions | TelegramBot.FileOptions
| file metadata |
+
+
+
+### lghInterface.editMessageMedia(userId, media, options) ⇒ Boolean
\| Promise.<TelegramBot.Message>
+**Kind**: instance method of [LGHInterface
](#LGHInterface)
+**Returns**: Boolean
\| Promise.<TelegramBot.Message>
- - returns true on success, false if request has been dropped out
+
+| Param | Type | Description |
+| --- | --- | --- |
+| userId | number
\| string
| id of user that's the cause of your request |
+| media | TelegramBot.InputMedia
| input media |
+| options | TelegramBot.EditMessageMediaOptions
| |
+
+
+
+### lghInterface.editMessageText(userId, text, options) ⇒ Promise.<Boolean>
+LGHbot safely edit message under user request limit
+
+**Kind**: instance method of [LGHInterface
](#LGHInterface)
+**Returns**: Promise.<Boolean>
- - returns true on success, false if request has been dropped out
+
+| Param | Type | Description |
+| --- | --- | --- |
+| userId | number
\| string
| id of user that's the cause of your request |
+| text | String
| text of message |
+| options | TelegramBot.EditMessageTextOptions
| additional telegram options |
+
+
+
+### lghInterface.answerCallbackQuery(userId, callbackId, options) ⇒ Promise.<Boolean>
+LGHbot safely answerCallbackQuert under user request limit
+
+**Kind**: instance method of [LGHInterface
](#LGHInterface)
+**Returns**: Promise.<Boolean>
- - returns true on success, false if request has been dropped out
+
+| Param | Type | Description |
+| --- | --- | --- |
+| userId | number
\| string
| id of user that's the cause of your request |
+| callbackId | number
\| string
| id of user that's the cause of your request |
+| options | TelegramBot.AnswerCallbackQueryOptions
| additional telegram options |
+
+
+
+### lghInterface.banChatMember(userId, chatId, targetId, options) ⇒ Promise.<Boolean>
+LGHbot safely answerCallbackQuert under user request limit
+
+**Kind**: instance method of [LGHInterface
](#LGHInterface)
+**Returns**: Promise.<Boolean>
- - returns true on success, false if request has been dropped out
+
+| Param | Type | Description |
+| --- | --- | --- |
+| userId | number
\| string
| id of user that's the cause of your request |
+| chatId | number
\| string
| - chat where message should be sent |
+| targetId | number
\| string
| id of user that should be banned |
+| options | TelegramBot.BanOptions
| additional telegram options |
+
+
+
+### lghInterface.unbanChatMember(userId, chatId, targetId, options) ⇒ Promise.<Boolean>
+LGHbot safely answerCallbackQuert under user request limit
+
+**Kind**: instance method of [LGHInterface
](#LGHInterface)
+**Returns**: Promise.<Boolean>
- - returns true on success, false if request has been dropped out
+
+| Param | Type | Description |
+| --- | --- | --- |
+| userId | number
\| string
| id of user that's the cause of your request |
+| chatId | number
\| string
| - chat where message should be sent |
+| targetId | number
\| string
| id of user that should be unbanned |
+| options | TelegramBot.UnbanOptions
| additional telegram options |
+
+
+
+### lghInterface.restrictChatMember(userId, chatId, targetId, options) ⇒ Promise.<Boolean>
+LGHbot safely answerCallbackQuert under user request limit
+
+**Kind**: instance method of [LGHInterface
](#LGHInterface)
+**Returns**: Promise.<Boolean>
- - returns true on success, false if request has been dropped out
+
+| Param | Type | Description |
+| --- | --- | --- |
+| userId | number
\| string
| id of user that's the cause of your request |
+| chatId | number
\| string
| - chat where message should be sent |
+| targetId | number
\| string
| id of user to restrict |
+| options | TelegramBot.RestrictChatMemberOptions
| additional telegram options |
+
+
+
+## PermissionStatus : enum
+Permission status
+- 1: allowed
+- 0: neutral
+- -1: denied
+
+**Kind**: global enum
+**Properties**
+
+| Name | Type | Default |
+| --- | --- | --- |
+| ALLOWED | number
| 1
|
+| NEUTRAL | number
| 0
|
+| DENIED | number
| -1
|
+
+
+
+## testObject() ⇒ [LGHChat
](#LGHChat)
+**Kind**: global function
+**Returns**: [LGHChat
](#LGHChat) - testing jsdoc advices
+
+
+## AnonTGUser : Object
+Basic anonymized user object
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| id | String
\| Number
| userId |
+
+
+
+## Punishment : 0
\| 1
\| 2
\| 3
\| 4
+Punishment to apply
+- 0: off
+- 1: warn
+- 2: kick
+- 3: mute
+- 4: ban
+
+**Kind**: global typedef
+
+
+## LGHPunish : Object
+antispam.js settings Object.
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| punishment | [Punishment
](#Punishment) | Punishment to apply [0:off/1:warn/2:kick/3:mute/4:ban]. |
+| PTime | Number
\| null
| Available if punishment is set to warn/mute/ban, contains seconds of punishment. |
+| delete | boolean
\| null
| True if deletion is enabled as side effect. |
+
+
+
+## LGHChatBasedPunish : Object
+Object to reresent different punish settings for more chat types
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| channels | [LGHPunish
](#LGHPunish) | Punish to apply for channels. |
+| groups | [LGHPunish
](#LGHPunish) | Punish to apply for groups. |
+| users | [LGHPunish
](#LGHPunish) | Punish to apply for users. |
+| bots | [LGHPunish
](#LGHPunish) | Punish to apply for bots. |
+
+
+
+## LGHAlphabetBasedPunish : Object
+Object to reresent different punish settings for messages containing various Alphabets
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| arabic | [LGHPunish
](#LGHPunish) | Punish to apply for messages containing arabic characters. |
+| cyrillic | [LGHPunish
](#LGHPunish) | Punish to apply for messages containing cyrillic (russian) characters. |
+| chinese | [LGHPunish
](#LGHPunish) | Punish to apply for messages containing chinese characters. |
+| latin | [LGHPunish
](#LGHPunish) | Punish to apply for messages containing latin characters. |
+
+
+
+## TargetUser : Object
+Object that refers to a target user
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| id | string
\| number
| Telegram user Id |
+| name | string
| Full LGH name identifier: "fullName [id]" |
+| perms | [LGHPerms
](#LGHPerms) | LGHPerms with perms of target |
+| user | TelegramBot.User
\| null
| If avaiable, target basic user object |
+
+
+
+## LGHPerms : Object
+LGHPerms Object.
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| commands | Array.<string>
| Array of commands, if starts with "COMMAND_" means its to be translated, otherwise is the literal command. |
+| immune | [PermissionStatus
](#PermissionStatus) | Active if this user can't receive any punishment (kick/warn/mute/ban) [1/0/-1]. |
+| flood | [PermissionStatus
](#PermissionStatus) | Permission to flood messages [1/0/-1]. |
+| link | [PermissionStatus
](#PermissionStatus) | Permission to send links [1/0/-1]. |
+| tgLink | [PermissionStatus
](#PermissionStatus) | Permission to send telegram links/usernames [1/0/-1]. |
+| forward | [PermissionStatus
](#PermissionStatus) | Permission to forward messages from anywhere [1/0/-1]. |
+| quote | [PermissionStatus
](#PermissionStatus) | Permission to quote from anywhere [1/0/-1]. |
+| porn | [PermissionStatus
](#PermissionStatus) | Bypass porn/gore checks [1/0/-1]. |
+| night | [PermissionStatus
](#PermissionStatus) | Bypass any night mode limitation [1/0/-1]. |
+| media | [PermissionStatus
](#PermissionStatus) | Bypass any media limitation [1/0/-1]. |
+| alphabets | [PermissionStatus
](#PermissionStatus) | Bypass any alphabets characters limitations [1/0/-1]. |
+| words | [PermissionStatus
](#PermissionStatus) | Bypass banned words limitations [1/0/-1]. |
+| length | [PermissionStatus
](#PermissionStatus) | Bypass message length limitations [1/0/-1]. |
+| roles | [PermissionStatus
](#PermissionStatus) | Permission to change roles of lower level users [1/0/-1]. |
+| settings | [PermissionStatus
](#PermissionStatus) | Permission to change bot group settings [1/0/-1]. |
+
+
+
+## simpleMedia : Object
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| type | String
\| null
| Type of media (audio, photo, video, video_note, animation, sticker, document) or false |
+| fileId | String
| media fileId or false |
+| options | Object
| additional options for TelegramBot |
+
+
+
+## customMessage : Object
+object of MessageMaker
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| text | String
| Text of messsage |
+| entities | Array.<TelegramBot.MessageEntity>
| Telegram entities of text |
+| roles | Array.<String>
| array user roles, string for pre-made roles, number for custom roles (user-made) |
+| format | Boolean
| true if message should be formatted (enabled by default), mean that entities should be passed on sendMessage function |
+| media | [simpleMedia
](#simpleMedia) | user administrator title |
+| buttons | String
| can be transformed in inline_keyboard with parseTextToInlineKeyboard() |
+| buttonsParsed | Array.<TelegramBot.KeyboardButton>
| already parsed buttons ready to use for inline_keyboard |
+
+
+
+## LGHAdminAdds : object
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| user | [AnonTGUser
](#AnonTGUser) | Basic anonymized user object |
+| status | TelegramBot.ChatMemberStatus
| |
+
+
+
+## LGHAdmin : TelegramBot.ChatAdministratorRights
\| [LGHAdminAdds
](#LGHAdminAdds)
+**Kind**: global typedef
+
+
+## LGHAdminList : [Array.<LGHAdmin>
](#LGHAdmin)
+**Kind**: global typedef
+
+
+## userStatus : Object
+object with data about an user in a group
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| firtJoin | Number
| Unix number of first user join time in seconds, false if unknown (managed by welcome.js) |
+| perms | [LGHPerms
](#LGHPerms) | LGHPerms object for all user-specific permissions |
+| adminPerms | [LGHPerms
](#LGHPerms) | LGHPerms object for user permissions if admin |
+| roles | Array.<String>
| array user roles, string for pre-made roles, number for custom roles (user-made) |
+| title | String
\| undefined
| user administrator title |
+| waitingReply | String
\| null
| string with callback data hirarchy if bot is expecting a message from user on group |
+
+
+
+## LGHRole : Object
+if pre-made role (string key) only users object should be used
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| name | String
\| null
| role name |
+| emoji | String
\| null
| emoji for the role |
+| level | Number
\| null
| role level, higher level users can use commands that affect lower level users |
+| perms | [LGHPerms
](#LGHPerms) \| null
| LGHPerms object applyed at lowest priority on any user in this role |
+| users | Array.<String>
| array of userId in this role |
+
+
+
+## LGHWarns : Object
+warns.js plugin related data
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| timed | Object.<string, Number>
| ([userId]: [endTime, endTime, endTime]) contains necerray data to revoke scheduled warns when time is over |
+| count | Object.<string, Number>
| ([userId]: number) countains count of warns for each user |
+| limit | Number
| number of warns after wich should be applyed a punishment |
+| punishment | 2
\| 3
\| 4
| punishment when limit is hit [2:kick/3:mute/4:ban] |
+| PTime | Number
\| null
| avaiable if punishment is set to warn/mute/ban, contains seconds of punishment |
+
+
+
+## LGHWelcome : Object
+welcome.js settings Object.
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| state | boolean
| True if welcome is enabled (default false). |
+| once | boolean
| True if should be sent only at first user join (default false). |
+| clean | boolean
| True if last welcome message on the group should be (default false). |
+| joinList | Array.<(string\|number)>
| cronology of users that joined the group over time. |
+| lastWelcomeId | string
\| number
\| boolean
| MessageId of last welcome message sent, useful if clean is enabled, false if never sent one before. |
+| message | [customMessage
](#customMessage) | CustomMessage object. |
+
+
+
+## LGHFloodAdds : Object
+antiflood.js settings additional Object elements.
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| messages | Number
| Number of messages needed to trigger the Antiflood. |
+| time | Number
| Seconds within the specified message should be sent to trigger the Antiflood. |
+
+
+
+## LGHFlood : [LGHFloodAdds
](#LGHFloodAdds) \| [LGHPunish
](#LGHPunish)
+antiflood.js settings Object.
+
+**Kind**: global typedef
+
+
+## LGHSpamTgLinksAdds : Object
+antispam.js settings Object additional items.
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| usernames | Boolean
| True if usernames should be considered as spam. |
+| bots | Boolean
| True if bots should be considered as spam. |
+| exceptions | Array.<String>
| Array of Telegram exceptions, may contain "Name:Id", `Name:|hidden` (for hidden users), or t.me link, or @username, "Name" |
+
+
+
+## LGHSpamTgLinks : [LGHSpamTgLinksAdds
](#LGHSpamTgLinksAdds) \| [LGHPunish
](#LGHPunish)
+antispam.js settings about Telegram Links Object.
+
+**Kind**: global typedef
+
+
+## LGHSpamLinksAdds : Object
+antispam.js spam links Object additional items.
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| exceptions | Array.<String>
| Array of strings of allowed links or hostnames. |
+
+
+
+## LGHSpamLinks : [LGHSpamLinksAdds
](#LGHSpamLinksAdds) \| [LGHPunish
](#LGHPunish)
+antispam.js settings about Links Object.
+
+**Kind**: global typedef
+
+
+## LGHSpamForward : [LGHChatBasedPunish
](#LGHChatBasedPunish)
+antispam.js settings about foward.
+
+**Kind**: global typedef
+
+
+## LGHSpamQuote : [LGHChatBasedPunish
](#LGHChatBasedPunish)
+antispam.js settings about quote.
+
+**Kind**: global typedef
+
+
+## LGHSpam : Object
+antispam.js settings Object.
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| tgLinks | [LGHSpamTgLinks
](#LGHSpamTgLinks) | rules and exceptions for telegram links considered as spam |
+| links | [LGHSpamLinks
](#LGHSpamLinks) | rules and exceptions for all links considered as spam |
+| forward | [LGHSpamForward
](#LGHSpamForward) | rules and exceptions for all forwarded messages considered as spam |
+| quote | [LGHSpamQuote
](#LGHSpamQuote) | rules and exceptions for all quoted messages considered as spam |
+
+
+
+## LGHGoodbye : Object
+goodbye.js settings
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| group | Boolean
| True if goodbye should be sent on group |
+| clear | Boolean
| True if last goodbye message should be deleted before sending a new one |
+| lastId | TelegramBot.MessageId
| messageId of last goodbye message sent on group |
+| gMsg | [CustomMessage
](#CustomMessage) | Goodbye message to send on group |
+| private | Boolean
| True if goodbye should be sent on private chat |
+| pMsg | [CustomMessage
](#CustomMessage) | Goodbye message to send on private chat |
+
+
+
+## LGHCaptcha : Object
+captcha.js settings
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| state | Boolean
| True if welcome is enabled (default false). |
+| mode | string
| Type of captcha, can be "image" (default "image"). |
+| time | Number
| Time limit to solve the captcha |
+| once | boolean
| True if should be sent only at first user join (from welcome.js) (default false). |
+| fails | boolean
| True if captcha should notify on group that someone failed the captcha (default false). |
+| punishment | [Punishment
](#Punishment) | Punishment to apply [1:warn/2:kick/3:mute/4:ban]. |
+| PTime | Number
| Available if punishment is set to warn/mute/ban, contains seconds of punishment. |
+
+
+
+## LGHMedia : Object
+media.js settings, if LGHPunish is disabled the object will be deleted (undefinied)
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type |
+| --- | --- |
+| photo | [LGHPunish
](#LGHPunish) \| undefined
|
+| video | [LGHPunish
](#LGHPunish) \| undefined
|
+| album | [LGHPunish
](#LGHPunish) \| undefined
|
+| gif | [LGHPunish
](#LGHPunish) \| undefined
|
+| voice | [LGHPunish
](#LGHPunish) \| undefined
|
+| audio | [LGHPunish
](#LGHPunish) \| undefined
|
+| sticker | [LGHPunish
](#LGHPunish) \| undefined
|
+| sticker_video | [LGHPunish
](#LGHPunish) \| undefined
|
+| dice | [LGHPunish
](#LGHPunish) \| undefined
|
+| emoji_video | [LGHPunish
](#LGHPunish) \| undefined
|
+| emoji_premium | [LGHPunish
](#LGHPunish) \| undefined
|
+| video_note | [LGHPunish
](#LGHPunish) \| undefined
|
+| file | [LGHPunish
](#LGHPunish) \| undefined
|
+| game | [LGHPunish
](#LGHPunish) \| undefined
|
+| contact | [LGHPunish
](#LGHPunish) \| undefined
|
+| poll | [LGHPunish
](#LGHPunish) \| undefined
|
+| location | [LGHPunish
](#LGHPunish) \| undefined
|
+| capital | [LGHPunish
](#LGHPunish) \| undefined
|
+| payment | [LGHPunish
](#LGHPunish) \| undefined
|
+| via_bot | [LGHPunish
](#LGHPunish) \| undefined
|
+| story | [LGHPunish
](#LGHPunish) \| undefined
|
+| spoiler | [LGHPunish
](#LGHPunish) \| undefined
|
+| spoiler_media | [LGHPunish
](#LGHPunish) \| undefined
|
+| giveaway | [LGHPunish
](#LGHPunish) \| undefined
|
+| mention | [LGHPunish
](#LGHPunish) \| undefined
|
+| text_mention | [LGHPunish
](#LGHPunish) \| undefined
|
+| hashtag | [LGHPunish
](#LGHPunish) \| undefined
|
+| cashtag | [LGHPunish
](#LGHPunish) \| undefined
|
+| command | [LGHPunish
](#LGHPunish) \| undefined
|
+| url | [LGHPunish
](#LGHPunish) \| undefined
|
+| email | [LGHPunish
](#LGHPunish) \| undefined
|
+| number | [LGHPunish
](#LGHPunish) \| undefined
|
+| bold | [LGHPunish
](#LGHPunish) \| undefined
|
+| italic | [LGHPunish
](#LGHPunish) \| undefined
|
+| underline | [LGHPunish
](#LGHPunish) \| undefined
|
+| striketrough | [LGHPunish
](#LGHPunish) \| undefined
|
+| quoteblock | [LGHPunish
](#LGHPunish) \| undefined
|
+| closed_blockquote | [LGHPunish
](#LGHPunish) \| undefined
|
+| code | [LGHPunish
](#LGHPunish) \| undefined
|
+| pre_code | [LGHPunish
](#LGHPunish) \| undefined
|
+| textlink | [LGHPunish
](#LGHPunish) \| undefined
|
+| scheduled | [LGHPunish
](#LGHPunish) \| undefined
|
+| effect | [LGHPunish
](#LGHPunish) \| undefined
|
+
+
+
+## CustomChat : Object
+Additional chat elements for chat object by LibreGroupHelp
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| admins | [LGHAdminList
](#LGHAdminList) \| null
| array with known admins objects (user data anonymized) |
+| lang | String
\| null
| current chat lang |
+| currency | String
\| null
| currency of chat, default to USD |
+| link | string
\| null
| group access link |
+| isGroup | Boolean
| temporary item, result of `(chat.type == "supergroup" || chat.type == "group")` |
+| users | Object.<string, userStatus>
\| null
| Object-IdName based data about every user in the group (ex. users[643547] access data of userId 643547) |
+| roles | Object.<string, LGHRole>
\| null
| data about a specific role, full role Object if it's a custom role (key with a number) |
+| basePerms | [LGHPerms
](#LGHPerms) | base permissions applyed to every user |
+| adminPerms | [LGHPerms
](#LGHPerms) | base permissions applyed to admin |
+| warns | [LGHWarns
](#LGHWarns) \| null
| warns.js plugin related data |
+| rules | [customMessage
](#customMessage) \| null
| rules.js plugin related data |
+| welcome | [LGHWelcome
](#LGHWelcome) \| null
| welcome.js plugin related data |
+| flood | [LGHFlood
](#LGHFlood) \| null
| antiflood.js plugin related data |
+| spam | [LGHSpam
](#LGHSpam) \| null
| antispam.js plugin related data |
+| captcha | [LGHCaptcha
](#LGHCaptcha) \| null
| captcha.js plugin related data |
+| goodbye | [LGHGoodbye
](#LGHGoodbye) \| null
| goodbye.js plugin related data |
+| alphabets | [LGHAlphabetBasedPunish
](#LGHAlphabetBasedPunish) \| null
| alphabets.js plugin related data |
+| media | [LGHMedia
](#LGHMedia) \| null
| media.js plugin related data |
+
+
+
+## LGHChat : TelegramBot.Chat
\| [CustomChat
](#CustomChat)
+Full LGH chat object given by LGHBot events, custom items avaiable if working about a group
+
+**Kind**: global typedef
+
+
+## CustomUser : Object
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| perms | [LGHPerms
](#LGHPerms) \| null
| temporary object with summary of user permissions |
+| lang | String
| current user lang |
+| waitingReply | String
| set to true if the bot is expecting a message from the user |
+
+
+
+## LGHUser : TelegramBot.User
\| [CustomUser
](#CustomUser)
+Custom chat object given by LGHBot events, custom items avaiable if working about a group
+
+**Kind**: global typedef
+
+
+## ParsedCommand : Object
+ParsedCommand Object.
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| text | string
| The original text input. |
+| prefix | string
| The prefix used in the command (e.g., "/", "!", "."). |
+| botCommand | string
| The command with bot name (e.g., "start@usernamebot"). |
+| name | string
| The name of the command. |
+| bot | string
| The bot name (if available). |
+| args | string
\| boolean
| The arguments of the command (optional). |
+| splitArgs | Array.<string>
\| boolean
| The split arguments of the command (optional). |
+
+
+
+## CustomCommand : Object
+Additional items to command for LGH
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| target | [TargetUser
](#TargetUser) \| null
| Optional temporary object with data about a target LGH user in the command, false if no target found |
+
+
+
+## CustomMessage : Object
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| chat | [LGHChat
](#LGHChat) | Always original chat object where the message is coming from |
+| command | [ParsedCommand
](#ParsedCommand) \| [CustomCommand
](#CustomCommand) | result of message text parsed with parseCommand() |
+| target | [TargetUser
](#TargetUser) \| null
| Optional temporary object with data about a command target |
+| waitingReply | string
\| null
| Optional temporary object with waitingReply data for the selected chat |
+| waitingReplyTarget | [TargetUser
](#TargetUser) \| null
| Optional temporary object with data about a target LGH user, false if no target found |
+
+
+
+## LGHMessage : TelegramBot.Message
\| [CustomMessage
](#CustomMessage)
+Custom chat object given by LGHBot events, custom items avaiable if working about a group
+
+**Kind**: global typedef
+
+
+## CustomCallback : Object
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| chat | [LGHChat
](#LGHChat) | Always original chat object where the callback is coming from |
+| target | [TargetUser
](#TargetUser) | Optional temporary object with data about a target LGH user in the command, false if no target found |
+
+
+
+## LGHCallback : TelegramBot.CallbackQuery
\| [CustomCallback
](#CustomCallback)
+Custom callback object given by LGHBot events, custom items may be avaiable
+
+**Kind**: global typedef
+
+
+## chatsDatabase : Object
+Object containing chat-related database functions.
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| add | function
| Function to add a new chat to the database. ------------------------------------ `function(TelegramBot.Chat): boolean` |
+| delete | function
| Function to delete a chat from the database. ------------------------------------ `function(TelegramBot.ChatId): boolean` |
+| exhist | function
| Function to check if a chat exhists in the database. ------------------------------------ `function(TelegramBot.ChatId): boolean` |
+| get | function
| Function to retrieve a chat from the database. ------------------------------------ `function(LGHChat): boolean` |
+| update | function
| Function to update a chat in the database. ------------------------------------ `function(LGHChat): boolean` |
+| save | function
| Function to save a chat to the database. ------------------------------------ `function(TelegramBot.ChatId): boolean` |
+
+
+
+## usersDatabase : Object
+Object containing user-related database functions.
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| add | function
| Function to add a new user to the database. ------------------------------------ `function(TelegramBot.User): boolean` |
+| delete | function
| Function to delete a user from the database. ------------------------------------ `function(TelegramBot.ChatId): boolean` |
+| exhist | function
| Function to check if a user exhists in the database. ------------------------------------ `function(TelegramBot.ChatId): boolean` |
+| get | function
| Function to retrieve a user from the database. ------------------------------------ `function(TelegramBot.ChatId): LGHUser` |
+| update | function
| Function to update a user in the database. ------------------------------------ `function(LGHUser): boolean` |
+
+
+
+## LGHDatabase : Object
+Type returned by the getDatabase function.
+
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| innerDir | string
| Location where the database folder should be placed (and/or generated). |
+| dir | string
| Full path to the database folder. |
+| chatsDir | string
| Full path to the chats folder within the database. |
+| usersDir | string
| Full path to the users folder within the database. |
+| chats | [chatsDatabase
](#chatsDatabase) | Object containing chat-related database functions. |
+| users | [usersDatabase
](#usersDatabase) | Object containing user-related database functions. |
+| unload | function
| Function to unload chats from memory. |
+
+
+
+## LibreGHelp : Object
+**Kind**: global typedef
+**Properties**
+
+| Name | Type | Description |
+| --- | --- | --- |
+| GHbot | [LGHInterface
](#LGHInterface) | Public interface for LGH Functions |
+| TGbot | [TelegramBot
](https://github.com/yagop/node-telegram-bot-api/blob/master/doc/api.md) | Raw telegram bot api |
+| db | [LGHDatabase
](#LGHDatabase) | Database interface |
+
diff --git a/docs/documentation/TODO-List.md b/docs/documentation/TODO-List.md
new file mode 100644
index 0000000..0403fec
--- /dev/null
+++ b/docs/documentation/TODO-List.md
@@ -0,0 +1,55 @@
+If you want an idea of what currently miss on the bot and you may want to implement it, that's the right page
+
+-short term:
+
+ allow to edit single user perms
+ commands help panel
+
+-medium term:
+
+ allow on /perms to change user perms and roles, +add it in a button for /info or when a role is set (/free /mod etc..), +ask double confirm to give an user the "settings" and "roles" permission
+ support for anonymous admins
+ allow to customize /staff allowing to set roles to hide
+ create a privacy setting where users can ask to esclude themself from tagResolver and replace his's first name in database with "Anonymous"
+ allow to disable tagResolver log on group settings
+ allow to mute only media, or specific media type or extras
+ create a privacy option to allow a user deleting his data from the bot
+ custom roles
+ optimize database.get, .update and .save to store in temporal array most used users
+ implement time zone setting +implement it in /info
+
+-long term:
+
+ add log channel
+ chatIds anonymization on database
+ compress chats data stored on database
+ support all group help functions and more (+anti-sheduled messages[msg.is_from_offline], )
+ allow bot clone bot when user give a token
+ add optionally an userbot (when active implement in tagResolver.js)
+
+-other things:
+
+ user should have an option to delete also his warn or roles data from the entire database but accepting that he is going to be banned by any group where he got at least a warn and accepting that he is going to lose any acquired role on every group
+ implement direct private settings with /*settings
+ add a /commands command to help user to know bot commands, admin commands, and custom-group commands if avaiable
+ a check system to drop wrong formatted cb.data and waitingReply
+ allow to see perms calculation trough user perms, then roles by priority, then base group perms, going from left to right (or opposite)
+ add something to allow a group admin to identify all users with additional bot perms
+ ?add an automatic leveling system for admins? (maybe?)
+ add photo preview-mode in MessageMaker.js
+ allow to warn only usersIds who exhist on telegram, it can be checked if applyng a restriction returns true
+ add config to allow/disallow adding bot from non-admin users
+ ?identify reply_parameters and add everytime allow_sending_without_reply? (GHBot.js)
+ /geturl, by replying to a message (via reply) and writing this command, you receive the link that refers directly to that message.
+ /inactives [days] sends in private chat the list of users who have not sent a message in the last [days], with the possibility of punish them.
+ /pin [message] - sends the message through the Bot and pins it.
+ /editpin [message] - edits the current pinned message (if sent from the Bot).
+ /delpin - removes the pinned message.
+ /repin - removes and pins again the current pinned message, with notification!
+ /pinned - refers to the current pinned message.
+ /list - sends in private chat the list of users of the group with the number of messages sent by them.
+ /list roles - sends in private chat the list of all the special roles assigned to users
+ /graphic - sends a graph showing the trend of the group members.
+ /trend - sends the group's growth statistics.
+ /logdel - deletes the selected message and sends it to the Log Channel
+ /send - permits to send a post through the Bot with parse mode support
\ No newline at end of file
diff --git a/docs/documentation/callbacks.md b/docs/documentation/callbacks.md
new file mode 100644
index 0000000..547b2e5
--- /dev/null
+++ b/docs/documentation/callbacks.md
@@ -0,0 +1,123 @@
+## LGH Hirarchy
+
+We need to expect button clicks and messages from users to be able to perform most of actions for our bot
+
+
+That's why we need an unified hirarchy of how callbacks data are organized, on LibreGroupHelp they are avaiable for buttons on `cb.data` and `msg.waitingReply` for messages, we will talk about how to expect user messages soon, but first you should follow the right hirachy so main.js can set right variables for [LGH Events](events.md)
+
+
+
+That's the hirarchy:
+
+`CallbackName_opt1_opt2!data#editorName_opt1_opt2|editorData:groupId?targetUserId`
+
+
+
+It works too with less items like this: `CallbackName:groupId`, `CallbackName#editor?targetUserId`, `CallbackName:groupId?targetUserId`.
+
+
+
+**CallbackName**
+Name of callback that you can use, be sure that not conflicts with other names, often plugins check if it's their match with `string.startsWith()`, `opt1` and `opt2` separated by `_` is avaiable to futher go deep with your callback listener
+
+---
+
+**data**
+Some additional data that you can attach to CallbackName (requires `CallbackName`)
+
+---
+
+**editorName**
+Also that is often identified with string.startsWith(), it's usually used by re-usable menus like MessageMaker.js, setNum.js, setTime.js
+
+[What are editors?](editors.md)
+
+---
+
+**editorData**
+Additional data that editor may attach (requires `editorName`)
+
+---
+
+**groupId**
+This value when given allow main.js to set by any chat context a specific full chat object on it's events inside [GHBot](GHBot.md/#LGHInterface) (`msg.chat` or `cb.message.chat` are not affected) and `user.perms` related to user permissions on the given groupId
+
+[Read how groupId helps LGH Events](events.md/#expect-messages)
+
+---
+
+**targetUserId**
+This value when given allow main.js to set a specific target user in various cases: `cb.target`, `msg.waitingReplyTarget` (note: it's volontarily separated from `msg.target` that's command target dedicated)
+
+[Read how targetUserId helps LGH Events](events.md/#target-user)
+
+---
+
+
+## Expect user messages
+
+In this example i will show you how to expect futher message from user and, listen it back when he replicate, and then disable futher message expectations
+
+For messages callbacks comes at help 2 functions:
+
+ waitReplyForChat(database, callback, user, chat, onGroup)
+ unsetWaitReply(database, user, chat, onGroup)
+
+
+
+Keep in mind that Callback Hirarchy upon explained has to be followed
+
+```javascript
+const LGHelpTemplate = require("../GHbot.js")
+const {waitReplyForChat, unsetWaitReply} = require( "../api/utils/utils.js" );
+
+function main(args)
+{
+
+ const GHbot = new LGHelpTemplate(args);
+ const {TGbot, db, config} = GHbot;
+
+ GHbot.onMessage( (msg, chat, user) => {
+
+ if(msg.text != "/guess") return;
+
+ //if users type /guess expect a message with "EXPECT_PASSWORD" callback
+
+ /**
+ * waitReplyForChat, if chat.isGroup == false, will set
+ * automatically the callback as EXAMPLE:groupId
+ */
+ waitReplyForChat(db, "EXPECT_PASSWORD", user, chat, chat.isGroup)
+
+ GHbot.sendMessage(user.id, chat.id, "Guess the password")
+
+ })
+
+ GHbot.onMessage( (msg, chat, user) => {
+
+ var isMyCallback = msg.waitingReply && msg.waitingReply.startsWith("EXPECT_PASSWORD")
+ if(!isMyCallback) return;
+
+ if(msg.text == "password1234"){
+ GHbot.sendMessage(user.id, chat.id, "Congratulation, password guessed!")
+ unsetWaitReply(db, user, chat, chat.isGroup) //do not expect futher messages
+ }
+ else{
+ GHbot.sendMessage(user.id, chat.id, "Password incorrect, try again ): ")
+ }
+
+ })
+
+}
+
+module.exports = main;
+```
+
+When you are expecting a message other plugins will see (with `msg.waitingReply` != false) your decision and they may stop working until you finished, so be sure to use unsetWaitReply eventually
+
+
+## Expect user button clicks
+
+Currently LGH has no special procedure to expect button clicks, just follow the hirarchy and do how you would do with [TGbot](https://github.com/yagop/node-telegram-bot-api/blob/master/doc/api.md)
+
+You find an example here: [LGH Events: Expect buttons clicks](events.md/#expect-buttons-clicks)
diff --git a/docs/documentation/commands.md b/docs/documentation/commands.md
new file mode 100644
index 0000000..71d3958
--- /dev/null
+++ b/docs/documentation/commands.md
@@ -0,0 +1,184 @@
+# Create a command
+
+LibreGroupHelp offers multi-language command support, when the user sends a command LGH will try to resolve the command trying first to translate the raw one to the command code (usually starting with `COMMAND_`), then, if registered, their function will be ran
+
+
+## Create command lang-code
+
+Before registering your first command you need to know how to add it to the bot dictionary
+
+Open `langs/en_en.json` and scroll down below until you find the values keys starting with `"COMMAND_"`
+
+```json
+"/rules": "COMMAND_RULES",
+"/regulation" : "COMMAND_RULES",
+"COMMAND_RULES" : "rules",
+"CMDDESC_RULES" : "/{name} or /regulation\nSend group regulament message, it can be changed in settings",
+"/permissions": "COMMAND_PERMS",
+"/perms": "COMMAND_PERMS",
+"COMMAND_PERMS" : "perms",
+```
+
+As you see, `"COMMAND_RULES" : rules` define the main command as the `/rules` one
+But it owns also some alias, still linked to `COMMAND_RULES`
+
+```json
+"/rules": "COMMAND_RULES",
+"/regulation" : "COMMAND_RULES",
+```
+
+Both `/rules` and `/regulation` will fire up the same function
+
+We see also a `"CMDDESC_RULES"` parameter with a `{name}` substitution key, set this value can help back in some cases where bot has to show a short description of what the command does, it's not mandatory to add this but is reccomended
+
+
+
+Now add our own command
+
+```json
+"/example" : "COMMAND_EXAMPLE",
+"/showcase" : "COMMAND_EXAMPLE",
+"/anotheralias" : "COMMAND_EXAMPLE",
+"COMMAND_EXAMPLE" : "example",
+"CMDDESC_EXAMPLE" : "/{name} or /showcase or /anotheralias\nThese are just commands to show an example on LibreGroupHelp Wiki"
+"/rules": "COMMAND_RULES",
+"/regulation" : "COMMAND_RULES",
+"COMMAND_RULES" : "rules",
+"CMDDESC_RULES" : "/{name} or /regulation\nSend group regulament message, it can be changed in settings",
+"/permissions": "COMMAND_PERMS",
+"/perms": "COMMAND_PERMS",
+"COMMAND_PERMS" : "perms",
+```
+
+We added as main command of `COMMAND_EXAMPLE` the command `/example`, anyway also `/showcase` and `/anotheralias` are avaiable as aliases
+
+*Note: `"/example" : "COMMAND_EXAMPLE"` and `"COMMAND_EXAMPLE" : "example"` are always both needed, even if example is already described as the main command, it has to be anyway in the aliases list*
+
+---
+
+## Register command
+
+The command registering tool can be required with
+`const GHCommand = require("../api/tg/LGHCommand.js")`
+
+To reply a command the right procedure is using the sendCommandReply utility (from `api/utils/utils.js` )
+
+Giving back to `sendCommandReply` the `GHCommand.registerCommand` parameters will allow it to decide what is the correct destination chat to reply, running then a callback that gives you a `chadId` where to reply
+
+That's because the user may have the permission to use this command only with a private bot reply, but there are also many other caveuts, this system will handle everything for you, so you can focus on the acutal command creation
+
+Here an example:
+
+```javascript
+const { sendCommandReply } = require("../api/utils/utils.js");
+const GHCommand = require("../api/tg/LGHCommand.js");
+const LGHelpTemplate = require("../GHbot.js");
+
+function main(args)
+{
+
+ const GHbot = new LGHelpTemplate(args);
+ const {TGbot, db, config} = GHbot;
+
+ GHCommand.registerCommands(["COMMAND_EXAMPLE"], (msg, chat, user, private, lang, key, keyLang) => {
+
+ //we want this command to work only if from groups
+ if(!msg.chat.isGroup) return;
+
+ sendCommandReply(private, lang, GHbot, user.id, chat.id, (sendId)=>{
+ var text = "Thanks for the interest into LGH, we appreciate this";
+ GHbot.sendMessage(user.id, sendId, text);
+ })
+
+ })
+
+}
+
+module.exports = main;
+```
+
+If are you sure that your command reply has always to be on the group you can still set `false` instead of `private` on `sendCommandReply`
+
+In the same way if your command reply should be always on private chat, you set `true` instead of `private`
+
+*Note: `msg`, `chat` and `user` are exactly the same parameters you get within [LGH Events](events.md/#expect-messages), they come acutally from there*
+
+
+## Some insights
+
+Any [msg](GHBot.md/#lghmessage-telegrambotmessage-custommessage) object contains [msg.command](GHBot.md/#parsedcommand-object), can be useful to handle more parameters on your command
+
+---
+
+Why first parameter of `GHCommand.registerCommands` is an array?
+Yes it's exactly what you think, you can run the same function for more commands, but why?
+
+I will show you this directly using `promote.js` plugin as example
+
+
+```javascript
+var commandsList = ["COMMAND_FREE", "COMMAND_UNFREE", "COMMAND_HELPER", "COMMAND_UNHELPER", "COMMAND_CLEANER", "COMMAND_UNCLEANER",
+ "COMMAND_MUTER", "COMMAND_UNMUTER", "COMMAND_MODERATOR", "COMMAND_UNMODERATOR", "COMMAND_COFOUNDER", "COMMAND_UNCOFOUNDER",
+ "COMMAND_ADMINISTRATOR", "COMMAND_UNADMINISTRATOR", "COMMAND_TITLE", "COMMAND_UNTITLE"];
+
+GHCommand.registerCommands(commandsList, async (msg, chat, user, private, lang, key, keyLang) => {
+ if(!msg.chat.isGroup) return;
+
+ /**
+ * note how we return in case of msg.waitingReply, that's because
+ * otherwise we would handle this command also while the user is
+ * dealing with some other piece of the bot
+ * */
+ if(msg.waitingReply) return;
+
+ var command = msg.command;
+ var lang = msg.chat.lang;
+ var target = msg.waitingReplyTarget || msg.target;
+ var text = false;
+ var options = {parse_mode : "HTML"};
+ var toSetRole = false;
+ var toUnsetRole = false;
+
+ if( key == "COMMAND_FREE")
+ toSetRole = "free";
+ if( key == "COMMAND_UNFREE")
+ toUnsetRole = "free";
+
+ if( key == "COMMAND_HELPER")
+ toSetRole = "helper";
+ if( key == "COMMAND_UNHELPER")
+ toUnsetRole = "helper";
+
+ if( key == "COMMAND_CLEANER")
+ toSetRole = "cleaner"
+ if( key == "COMMAND_UNCLEANER")
+ toUnsetRole = "cleaner";
+
+ if( key == "COMMAND_MUTER")
+ toSetRole = "muter";
+ if( key == "COMMAND_UNMUTER")
+ toUnsetRole = "muter";
+
+ if( key == "COMMAND_MODERATOR")
+ toSetRole = "moderator";
+ if( key == "COMMAND_UNMODERATOR")
+ toUnsetRole = "moderator";
+
+ if( key == "COMMAND_COFOUNDER")
+ toSetRole = "cofounder"
+ if( key == "COMMAND_UNCOFOUNDER")
+ toUnsetRole = "cofounder";
+
+ if( key == "COMMAND_ADMINISTRATOR"){...}
+ if( key == "COMMAND_UNADMINISTRATOR"){...}
+ if( key == "COMMAND_TITLE"){...}
+ if( key == "COMMAND_UNTITLE"){...}
+
+ //check if user can change a role and if he can apply it to target
+ if(toSetRole || toUnsetRole){...}
+ if(toSetRole){...}
+ if(toUnsetRole){...}
+})
+```
+
+As you see, in this case we need to listen for multiple commands at the same time as they need to run pretty the same code, we need only `key` to change `toSetRole` and `toUnsetRole` variable, then the code is same for everyone
diff --git a/docs/documentation/database.md b/docs/documentation/database.md
new file mode 100644
index 0000000..1b8f75a
--- /dev/null
+++ b/docs/documentation/database.md
@@ -0,0 +1,74 @@
+# Database
+
+As you may have seen by many examples, an object that we always get is [db](GHBot.md/#LGHDatabase) (database)
+
+```javascript
+const LGHelpTemplate = require("../GHbot.js")
+
+function main(args)
+{
+
+ const GHbot = new LGHelpTemplate(args);
+ const {TGbot, db, config} = GHbot;
+ ...
+}
+
+module.exports = main;
+```
+
+[Database](GHBot.md/#LGHDatabase) is the core of LibreGroupHelp to store chat and users data, as to the privacy implications of that we aim to minimize the amount of sensitive data there and anyway we keep in mind that the user should be able to remove any trace of him there
+
+## Database usage
+
+Currently [database](GHBot.md/#LGHDatabase) let you control [chats](GHBot.md/#chatsDatabase) and [users](GHBot.md/#usersDatabase) using same interface of functions
+
+You are supposed to use `update` method everytime you want to apply changes to one of them
+
+```javascript
+const LGHelpTemplate = require("../GHbot.js")
+
+function main(args)
+{
+
+ const GHbot = new LGHelpTemplate(args);
+ const {TGbot, db, config} = GHbot;
+
+ GHbot.onMessage( (msg, chat, user) => {
+
+ if(!chat.isGroup) return;
+
+ if( msg.text == "/antiflood kind" )
+ {
+ chat.flood.messages = 8;
+ chat.flood.time = 10;
+ db.chats.update(chat); //apply changes to database
+ GHbot.sendMessage( user.id, chat.id, "Antiflood set to be kind" );
+ }
+ else if( msg.text == "/antiflood hard" )
+ {
+ chat.flood.messages = 3;
+ chat.flood.time = 5;
+ db.chats.update(chat); //apply changes to database
+ GHbot.sendMessage( user.id, chat.id, "Antiflood set to be hard" );
+ }
+
+ if( msg.text == "/anonymize" )
+ {
+ user.first_name = "anonymous"
+ user.last_name = "anonymous"
+ db.users.update(users); //apply changes to database
+ GHbot.sendMessage( user.id, chat.id, "Anonymized successfully" );
+ }
+
+ } )
+
+}
+
+module.exports = main;
+```
+You find all relative methods documented clicking [db.chats](GHBot.md/#chatsDatabase) and [db.users](GHBot.md/#usersDatabase)
+
+---
+
+
+*Note: as written on [Known issues](known-issues.md) there are a problem with [chats](GHBot.md/#chatsDatabase) interface of database wich gives a reference copy of a LGHChat object, that's mean that it may be eventually stored on database even without `update` functions, fixing this would require some code refacory, you should still follow the rule of using `update` to confirm changes, if you need to apply only temporary changes of an LGHChat object please make a deep copy*
\ No newline at end of file
diff --git a/docs/documentation/editors.md b/docs/documentation/editors.md
new file mode 100644
index 0000000..bc9e54d
--- /dev/null
+++ b/docs/documentation/editors.md
@@ -0,0 +1,99 @@
+# What are editors?
+
+Editors are a way create re-usable interfaces of panels, with their expect messages and expect buttons callbacks handling to allow you to show something to an user or edit a variable, object, or something else
+
+As you already know by [LGH Hirarchy](callbacks.md/#lgh-hirarchy), editors has their own space there, the reason why we need to make them separate is simple:
+You still need to know who is the caller of the editor it's so can correctly handle like a possible variable change
+
+Let's begin from the most useful of the editors, `MessageMaker`, that allow the user to modify a [customMessage](GHBot.md/#custommessage-object) object and then also to send it as a telegram message
+
+That's how `rules.js` uses that (some code not interested has been suppressed):
+
+```javascript
+const LGHelpTemplate = require("../GHbot.js");
+const {sendCommandReply, waitReplyForChat, unsetWaitReply} = require( "../api/utils/utils.js" );
+const MSGMK = require( "../api/editors/MessageMaker.js" )
+...
+
+function main(args)
+{
+
+ const GHbot = new LGHelpTemplate(args);
+ const {TGbot, db, config} = GHbot;
+ ...
+
+ GHbot.onMessage( async (msg, chat, user) => {
+
+ //check if it's our callback
+ if(!chat.isGroup) return;
+ if( !(msg.waitingReply && msg.waitingReply.startsWith("S_RULES")) ) return;
+ ...
+
+ /**
+ * rules never expect for other messages
+ * so we can give it all directly to MessageMaker hands
+ */
+ var customMessage = await MSGMK.messageEvent(GHbot, db, chat.rules, msg, chat, user, "S_RULES");
+
+ //then if customMessage has an update, we save that
+ if(customMessage)
+ {
+ chat.rules = customMessage;
+ db.chats.update(chat);
+ }
+
+ } )
+
+
+ GHbot.onCallback( (cb, chat, user) => {
+
+ var msg = cb.message;
+ var lang = user.lang;
+
+ //check if it's our callback
+ if(!chat.isGroup) return;
+ if( !cb.data.startsWith("S_RULES")) return;
+ ...
+
+ //from rules panel we add a button to access MessageMaker
+ if( cb.data.startsWith("S_RULES_BUTTON:") )
+ {
+
+ GHbot.editMessageText( user.id, l[lang].RULES_SETTING, {
+ ...
+ reply_markup : {inline_keyboard :[
+ [{
+ text: l[lang].RULES_CHANGE_BUTTON,
+ //we give a button to access MessageMaker
+ callback_data: "S_RULES#MSGMK:"+chat.id
+ }],
+ ...
+ ]}})
+ GHbot.answerCallbackQuery(user.id, cb.id);
+ }
+
+ //we listen here back for requested MessageMaker accesses
+ if( cb.data.startsWith("S_RULES#MSGMK") )
+ {
+ var returnButtons = [[{text: l[lang].BACK_BUTTON, callback_data: "S_RULES_BUTTON:"+chat.id}]];
+ var title = l[lang].REGULATION;
+ var msgTitle = l[lang].RULES_TITLE;
+ //giving the buttons handling to MessageMaker hands
+ var customMessage = MSGMK.callbackEvent(GHbot, db, chat.rules, cb, chat, user, "S_RULES", returnButtons, title, msgTitle)
+
+ //then if customMessage has an update, we save that
+ if(customMessage)
+ {
+ chat.rules = customMessage;
+ db.chats.update(chat);
+ }
+ }
+ ...
+ })
+}
+
+module.exports = main;
+
+```
+
+The access point of MessageMaker is trough buttons callbacks, but it works then with the user also by expecting messages, so we need to forward also them
diff --git a/docs/documentation/events.md b/docs/documentation/events.md
new file mode 100644
index 0000000..1e09aa3
--- /dev/null
+++ b/docs/documentation/events.md
@@ -0,0 +1,307 @@
+# Events
+
+ONLY for events from GHBot you have additional elements on parameters bot-related
+
+Usually GHBot events has 3 parameters:
+([callback](./GHBot.md/#lghcallback-telegrambotcallbackquery-customcallback)
+or
+[message](GHBot.md/#lghmessage-telegrambotmessage-custommessage)),
+[chat](GHBot.md/#LGHChat),
+[user](GHBot.md/#LGHUser)
+
+GHBot currently has 2 events fully supported
+
+```javascript
+GHBot.onCallback( (cb, chat, user) => { console.log(cb) } )
+GHBot.onMessage( (msg, chat, user) => { console.log(msg) } )
+```
+
+---
+
+##Chat data
+
+So how [GHBot](GHBot.md/#LGHInterface) enchanches events for LibreGroupHelp more than using the raw [TGBot](https://github.com/yagop/node-telegram-bot-api/blob/master/doc/api.md)?
+
+First at all, it allow us to get already a full chat object from the database, thus giving you the full chat configuration
+
+```javascript
+const { punishmentToFullText } = require("../api/utils/utils.js");
+const LGHelpTemplate = require("../GHbot.js")
+
+function main(args)
+{
+
+ const GHbot = new LGHelpTemplate(args);
+ const {TGbot, db, config} = GHbot;
+
+ GHbot.onMessage( (msg, chat, user) => {
+
+ var runTest = msg.chat.isGroup && msg.text == "/test"
+ if( !runTest ) return;
+
+ console.log("Logging chat flood settings")
+ console.log("Message limit: " + msg.chat.flood.messages)
+ console.log("Fire if sent within " + msg.chat.flood.time + " seconds")
+ var punish = punishmentToFullText(user.lang, msg.chat.flood.punishment, msg.chat.flood.PTime, msg.chat.flood.delete)
+ console.log("User will be punished with " + punish)
+
+ } )
+
+}
+
+module.exports = main;
+```
+
+Output if any user type `/test` on a group:
+
+ Logging chat flood settings
+ Message limit: 3
+ Fire if sent within 5 seconds
+ User will be punished with Warn for 1 day + delete
+
+*You may wonder why we use msg.chat instead of chat? You get that in detail on [Expect messages](events.md/#expect-messages) section, shotly it's because we want to work on the chat where the message is coming from, not the select chat*
+
+---
+
+## User permissions
+
+We may also want to allow the user to change settings, but we need to know if he has the permission to do that, so we have [user.perms](GHBot.md/#LGHPerms) containing a permissions object about the user on that chat
+
+*Note: [user.perms](GHBot.md/#LGHPerms) is a temporary item*
+
+```javascript
+const LGHelpTemplate = require("../GHbot.js")
+
+function main(args)
+{
+
+ const GHbot = new LGHelpTemplate(args);
+ const {TGbot, db, config} = GHbot;
+
+ GHbot.onMessage( (msg, chat, user) => {
+
+ if(!chat.isGroup) return;
+
+ //we never listen to commands like this on LGH, it's just as example
+ if( !msg.text.startsWith("/antiflood") ) return
+
+ //Check for user permissions to change settings
+ if(user.perms.settings != 1)
+ {
+ GHbot.sendMessage(user.id, chat.id, "You haven't settings permission");
+ return;
+ }
+
+ if( msg.text == "/antiflood kind" )
+ {
+ chat.flood.messages = 8;
+ chat.flood.time = 10;
+ db.chats.update(chat); //apply changes to database
+ GHbot.sendMessage( user.id, chat.id, "Antiflood set to be kind" );
+ }
+ else if( msg.text == "/antiflood hard" )
+ {
+ chat.flood.messages = 3;
+ chat.flood.time = 5;
+ db.chats.update(chat); //apply changes to database
+ GHbot.sendMessage( user.id, chat.id, "Antiflood set to be hard" );
+ }
+
+ } )
+
+}
+
+module.exports = main;
+```
+
+---
+
+## Expect messages
+
+[GHBot](GHBot.md/#LGHInterface) makes also you easy to expect messages or callbacks from users in private chat and both still relating to the group, keeping the group [chat](GHBot.md/#LGHChat) object
+
+Let's see:
+
+```javascript
+const { unsetWaitReply, waitReplyForChat } = require("../api/utils/utils.js");
+const LGHelpTemplate = require("../GHbot.js")
+
+function main(args)
+{
+
+ const GHbot = new LGHelpTemplate(args);
+ const {TGbot, db, config} = GHbot;
+
+ GHbot.onMessage( async (msg, chat, user) => {
+
+ if(!msg.chat.isGroup) return;
+
+ if(msg.text == "/antiflood")
+ {
+ /**
+ * waitReplyForChat, if chat.isGroup == false, will set
+ * automatically the callback as EXAMPLE:groupId
+ */
+ waitReplyForChat(db, "EXAMPLE", user, chat, chat.isGroup);
+ var text = `Ok, antiflood should be kind or hard?\n`+
+ `You can reply both here or private chat\n`+
+ `@${TGbot.me.username}`;
+ GHbot.sendMessage(user.id, chat.id, text);
+ }
+
+ } )
+
+ GHbot.onMessage( (msg, chat, user) => {
+
+
+ /**
+ * Here, if msg.waitingReply has a groupId (ex. EXAMPLE:-109848493476)
+ * so it's following correctly the LGH Callbacks Hirarchy,
+ * the "chat" parameter would be bind to the group
+ * enriched by the database, we have a full LGH chat object
+ */
+
+ //So behaivor is different from "if(!msg.chat.isGroup) return"
+ if(!chat.isGroup) return; //think that as "!selectedChat.isGroup"
+ if( !msg.waitingReply.startsWith("EXAMPLE") ) return;
+
+ //even on private chat, user.perms still exhist if a group is binded
+ if(user.perms.settings != 1)
+ {
+ GHbot.sendMessage(user.id, chat.id, "You haven't settings permission");
+ return;
+ }
+
+ if( msg.text == "kind" )
+ {
+ chat.flood.messages = 8;
+ chat.flood.time = 10;
+ db.chats.update(chat); //apply changes to database
+ GHbot.sendMessage( user.id, chat.id, "Antiflood set to be kind" );
+ unsetWaitReply(db, user, chat, chat.isGroup);
+ }
+ else if( msg.text == "hard" )
+ {
+ chat.flood.messages = 3;
+ chat.flood.time = 5;
+ db.chats.update(chat); //apply changes to database
+ GHbot.sendMessage( user.id, chat.id, "Antiflood set to be hard" );
+ unsetWaitReply(db, user, chat, chat.isGroup);
+ }
+
+ //msg.chat keeps for sure the chat wich message is coming from
+ var text = `This message is from private chat? ${!msg.chat.isGroup}`;
+ GHbot.sendMessage( user.id, chat.id, text);
+
+ } )
+
+}
+
+module.exports = main;
+```
+
+---
+
+
+
+## Expect buttons clicks
+
+Buttons callbacks works pretty in the same way:
+
+```javascript
+const { punishmentToFullText } = require("../api/utils/utils.js");
+const LGHelpTemplate = require("../GHbot.js");
+
+function main(args)
+{
+
+ const GHbot = new LGHelpTemplate(args);
+ const {TGbot, db, config} = GHbot;
+
+ GHbot.onMessage( async (msg, chat, user) => {
+
+ if(!msg.chat.isGroup) return;
+
+ //we never listen to commands like this on LGH, it's just as example
+ if(msg.text == "/private")
+ {
+ var text = "Proceed on private chat\n@"+TGbot.me.username;
+ var buttons = [[
+ {
+ //As you see we follow the hirarchy
+ callback_data: "EXAMPLE_SHOW_CONFIG:"+chat.id,
+ text: "Show antiflood config"
+ }
+ ]];
+ var options = {reply_markup:{inline_keyboard:buttons}};
+ GHbot.sendMessage(user.id, user.id, text, options);
+ }
+
+ } )
+
+ GHbot.onCallback( (cb, chat, user) => {
+
+ /**
+ * Also here, if cb.data has a groupId (ex. EXAMPLE:-109848493476)
+ * following correctly the LGH Callbacks Hirarchy
+ * the "chat" parameter would be bind to the group
+ * enriched by the database we have a full LGH chat object
+ */
+
+ if(!chat.isGroup) return;
+
+ //callback data is stored on cb.data
+ if( !cb.data.startsWith("EXAMPLE") ) return
+
+ /**
+ * Note: we use cb.chat.id, because editMessageText
+ * needs the chatId where callback is coming from
+ */
+ var editOpts = {
+ message_id: cb.message.message_id,
+ chat_id: cb.chat.id,
+ }
+
+ if(user.perms.settings != 1)
+ {
+ GHbot.editMessageText(user.id, "You haven't settings permission", editOpts);
+ return;
+ }
+
+ if( cb.data.startsWith("EXAMPLE_SHOW_CONFIG") )
+ {
+ var punish = punishmentToFullText(user.lang, chat.flood.punishment, chat.flood.PTime, chat.flood.delete)
+ var text = `Chat flood settings
+ Message limit: ${chat.flood.messages}
+ Fire if sent within ${chat.flood.time} seconds
+ User will be punished with ${punish}`
+ GHbot.editMessageText(user.id, text, editOpts);
+ }
+
+ //cb.chat keeps for sure the chat wich message is coming from
+ GHbot.sendMessage( user.id, chat.id, "This callback is from private chat? " + !cb.chat.isGroup );
+
+ } )
+
+}
+
+module.exports = main;
+```
+
+## Target user
+
+As you may have seen from the [LGH Callbacks hirarchy](callbacks.md/#lgh-hirarchy), after `?` exhists a parameter for target users, this callback parameter allows you to bind an user intended to be affected in some way trough the callback, so he is going to be avaiable on [cb.target](GHBot/#targetuser-object) or [msg.waitingReplyTarget](GHBot/#targetuser-object)
+
+---
+
+If you need instead data about a direct target of a message you have msg.target
+
+These are some cases where [msg.target](GHBot/#targetuser-object) appears:
+User X, replying to User Y, Y is the target
+User X, use a command mentioning Y (ex. `/ban @UserY`), Y is the target
+
+That comes useful while handling a command after a [Command creation](commands.md)
+
+## Conclusion
+
+Is better to think about the [chat](GHBot.md/#LGHChat) parameter as the selected chat, not the chat we are (that's on msg.chat), but the chat where we are asked to work on
diff --git a/docs/documentation/index.md b/docs/documentation/index.md
new file mode 100644
index 0000000..e1b6801
--- /dev/null
+++ b/docs/documentation/index.md
@@ -0,0 +1,18 @@
+# GHBot documentation
+
+## How it works
+
+Begin point is from `index.js` which loads [plugins](./plugins.md), database and the acutal bot is then started by main.js
+
+Other than starting the bot `main.js` emits on [GHBot](GHBot.md/#LGHInterface) some [events](events.md) with many LibreGroupHelp related integrated data ready to use, simplyfing the code
+
+[Database](database.md) is managed by `database.js`, usually on the `db` variable, main methods are found on db.chats and db.users to manage data about them
+
+[JSDocs Objects](GHBot.md) documentation are on `GHbot.js`, it may also implement small fixes always to make an easyer interface
+
+[TGbot](https://github.com/yagop/node-telegram-bot-api/blob/master/doc/api.md) variable will give you direct access to the [telegram-bot-api](https://github.com/yagop/node-telegram-bot-api), when possible you should use GHbot events and methods and if does not exhist the one needed create that
+*Additionally on [TGbot.me](https://core.telegram.org/bots/api#getme) is avaiable `await TGbot.getMe()` result*
+
+Any LibreGroupHelp code should keep in mind that user should be able to delete his data in any moment, that's for respecting at best our privacy philosophy
+
+[Github good first issues](https://github.com/Sp3rick/GroupHelp/contribute)
\ No newline at end of file
diff --git a/docs/documentation/known-issues.md b/docs/documentation/known-issues.md
new file mode 100644
index 0000000..379b7d9
--- /dev/null
+++ b/docs/documentation/known-issues.md
@@ -0,0 +1,11 @@
+# Known possible bugs:
+
+-sometimes db.chats.update in plugins may be not used at all because you can still edit the global object cause to reference, not using it may cause some issue. +if global reference get cleared too early code may try to access and inexistent variable
+
+-cleanHTML() may be not applyed in some text where it should, and nothing assure that it's 100% able to clean everything needed for telegram api
+
+-if you add a new permission on userPerms object, every userPerms object should be updated adding that, otherwise this may cause incorrect result in sumUserPerms
+
+-in some unkown cases you may get stuck in exceptions menu and SafeGram.js will block any user request due too high accumulated volume of something pending
+
+-permissions setup on first bot adding to groups is not the same as using /reload that's more complete
\ No newline at end of file
diff --git a/docs/documentation/languages.md b/docs/documentation/languages.md
new file mode 100644
index 0000000..7d64f60
--- /dev/null
+++ b/docs/documentation/languages.md
@@ -0,0 +1,28 @@
+## Language info
+
+LibeGrouHelp has a language configuration for users (user.lang) and for groups (chat.lang)
+
+When our bot is added to a group the default group language will be inherited from the user who added LGH Bot
+
+*Note: currently LGH does not inherit the user language from it's device telegram settings, but it's planned as a future feature*
+
+`global.LGHLangs` is an object with every language translation loaded
+Usually plugins get that using `l = global.LGHLangs`
+To translate use this format: `l[lang].KEY`
+
+Don't bother for missing keys in case of missing translation, every missing key is already replaced with the english one version
+
+
+## Extend bot dictionary
+
+The main language is english, so open `langs/en_en.json` and simply insert new parameters there
+
+```json
+"FLAG" : "🇬🇧",
+"LANG_SELECTOR" : "🇬🇧 English",
+"LANG_NAME" : "International English",
+"LANG_SHORTNAME" : "English",
+"LANG_CHOOSE" : "🇬🇧 Choose your language",
+"LANG_CHOOSE_GROUP" : "🇬🇧 Choose group language",
+"EXAMPLE_MESSAGE" : "This a new item on dictionary for wiki example"
+```
\ No newline at end of file
diff --git a/docs/documentation/plugins.md b/docs/documentation/plugins.md
new file mode 100644
index 0000000..2cf5b41
--- /dev/null
+++ b/docs/documentation/plugins.md
@@ -0,0 +1,34 @@
+# Plugins
+
+You can create any plugin you want creating a new file inside `plugins` folder
+
+Look at `example.js` to see how it should be organized:
+
+```javascript
+const LGHelpTemplate = require("../GHbot.js")
+
+function main(args)
+{
+
+ const GHbot = new LGHelpTemplate(args);
+ const {TGbot, db, config} = GHbot;
+
+ //here your plugin code//
+
+ l = global.LGHLangs; //importing langs object
+
+ GHbot.onMessage( (msg, chat, user) => {
+
+ if( chat.type == "private" && msg.text == "/test999" )
+ GHbot.sendMessage( user.id, chat.id, "Hello, i send this because im a plugin\n"+l[user.lang].flag );
+
+ } )
+
+
+}
+
+module.exports = main;
+```
+
+Put and import in your plugin any needed utility on `api` folder, but if you know that some functions will be ever needed only on your plugin, you are free to declare it directly there
+
diff --git a/docs/index.md b/docs/index.md
new file mode 100644
index 0000000..8b67ce9
--- /dev/null
+++ b/docs/index.md
@@ -0,0 +1,93 @@
+# LibreGroupHelp
+
+Open-Source re-creation of telegram group manager Group Help in NodeJS based on [node-telegram-api](https://github.com/yagop/node-telegram-bot-api).
+
+An official instance of bot is running on [@LibreGroupHelpBot](https://t.me/LibreGroupHelpBot)
+
+## Installation:
+
+Be sure to have installed a recent version of [NodeJS](https://nodejs.org/)
+
+Verify NodeJS installation with `node -v`
+
+Set your bot token using configuration file, look at [config documentation](configuration.md).
+
+Open a terminal inside LibreGroupHelp folder and run this commands
+
+```bash
+npm install
+```
+
+Now you should be ready to run LibreGroupHelp using:
+```bash
+node index.js
+```
+
+
+## What is done
+
+✅ Completed and working
+
+🟡 Not fully implemented (work in progress)
+
+❌ Not implemented at all
+
+```
+✅ Roles and permissions hirarchy
+❌ Custom roles
+✅ Moderation commands
+❌ Support moderation for channels users
+❌ Support for anonymous admins
+🟡 Bot support
+❌ Bot help (how to use)
+❌ Bot clones support
+❌ UTC Time settings
+✅ Langs and lang settings
+✅ Rules
+✅ Welcome
+✅ Anti-flood
+✅ Anti-spam
+✅ Goodbye
+✅ Alphabets
+✅ Captcha (1 mode)
+❌ Checks settings
+❌ @Admin
+❌ Blocks settings
+✅ Media blocks
+❌ Anti-NSFW
+✅ Warns settings
+❌ Nigth mode
+❌ Tag settings
+✅ Link settings
+❌ Approve mode
+❌ Message Deletion settings
+❌ Topics settings
+❌ Banned words
+❌ Recurring messages
+❌ Members management
+❌ Masked users settings
+❌ Discussion group settings
+❌ Personal commands
+❌ Magic Strickers/GIFs
+❌ Max message length settings
+❌ Log channel
+❌ Staff group
+❌ Group statistics
+✅ General commands permissions editor
+✅ Remove user-data from group (/forget)
+❌ Remove user-data from bot
+❌ User privacy mode
+✅ Crypto prices external api
+```
+
+## Updating
+
+To update LibreGroupHelp you need to backup ./database folder and ./config.json, then repeat installation process and paste there again both file and folder, you may need to add some config.json parameters manually if has been added
+
+## Contribute
+
+[Documentation](../documentation/) is the section you are looking for if you want to contribute to LibreGroupHelp
+
+## Ask a question
+
+If you have any questions about LibreGroupHelp, feel free to open an issue or ask directly in our telegram group [@LGHChat](https://t.me/LGHChat).
diff --git a/docs/plugins/antiflood.md b/docs/plugins/antiflood.md
new file mode 100644
index 0000000..bf14a0e
--- /dev/null
+++ b/docs/plugins/antiflood.md
@@ -0,0 +1,12 @@
+# Anti Flood
+
+**File**: `antiflood.js`
+
+**Description**: Plugin to punish users who send messages on a group too fast, configuration accessible on [settings](settings.md)
+
+
+## Objects implemented
+
+- **[LGHFlood](../documentation/GHBot.md/#LGHFlood)**
+**Use cases**:
+[LGHChat](../documentation/GHBot.md#LGHChat).flood
diff --git a/docs/plugins/antispam.md b/docs/plugins/antispam.md
new file mode 100644
index 0000000..c349e14
--- /dev/null
+++ b/docs/plugins/antispam.md
@@ -0,0 +1,12 @@
+# Anti Spam
+
+**File**: `antispam.js`
+
+**Description**: Plugin to punish users who send spam messages on a group, this may include `quotes`, `forward`, `external links`, and `telegram links`, configuration accessible on [settings](settings.md)
+
+
+## Objects implemented
+
+- **[LGHSpam](../documentation/GHBot.md/#LGHSpam)**
+**Use cases**:
+[LGHChat](../documentation/GHBot.md#LGHChat).spam
diff --git a/docs/plugins/captcha.md b/docs/plugins/captcha.md
new file mode 100644
index 0000000..d091fd7
--- /dev/null
+++ b/docs/plugins/captcha.md
@@ -0,0 +1,12 @@
+# Captcha
+
+**File**: `captcha.js`
+
+**Description**: Plugin to prevent bot fake users from joining the group asking a captcha process to be not punished, configuration accessible on [settings](settings.md)
+
+
+## Objects implemented
+
+- **[LGHCaptcha](../documentation/GHBot.md/#LGHCaptcha)**
+**Use cases**:
+[LGHChat](../documentation/GHBot.md#LGHChat).captcha
diff --git a/docs/plugins/command-perms.md b/docs/plugins/command-perms.md
new file mode 100644
index 0000000..a7dfd14
--- /dev/null
+++ b/docs/plugins/command-perms.md
@@ -0,0 +1,7 @@
+# Command permissions
+
+**File**: `api/editors/CommandsPerms.js`
+
+**Description**: Implements an [editor](../documentation/editors.md) menu to change commands on a [permissions](../documentation/GHBot.md/#lghperms-object) Object,
+
+Allows also to set up both permissions for user with private/group reply, and admin with private/group reply, in future it may be used to change perms for roles
\ No newline at end of file
diff --git a/docs/plugins/goodbye.md b/docs/plugins/goodbye.md
new file mode 100644
index 0000000..192fbb9
--- /dev/null
+++ b/docs/plugins/goodbye.md
@@ -0,0 +1,12 @@
+# Goodbye
+
+**File**: `goodbye.js`
+
+**Description**: Plugin to send a goodbye on private user chat and in the group when an user leaves, you can edit both trough [settings](settings.md) with [MessageMaker](message-maker.md)
+
+
+## Objects implemented
+
+- **[LGHGoodbye](../documentation/GHBot.md/#LGHGoodbye)**
+**Use cases**:
+[LGHChat](../documentation/GHBot.md#LGHChat).goodbye
diff --git a/docs/plugins/index.md b/docs/plugins/index.md
new file mode 100644
index 0000000..4f965da
--- /dev/null
+++ b/docs/plugins/index.md
@@ -0,0 +1,5 @@
+# Plugins documentation
+
+Here you can find every documentation about any [plugin](../documentation/plugins.md) and [editors](../documentation/editors.md)
+
+Use left side panel to navigate
\ No newline at end of file
diff --git a/docs/plugins/message-maker.md b/docs/plugins/message-maker.md
new file mode 100644
index 0000000..47546fb
--- /dev/null
+++ b/docs/plugins/message-maker.md
@@ -0,0 +1,90 @@
+# Message maker
+
+## Informations
+
+**File**: `api/editors/MessageMaker.js`
+
+**Description**: This is an [editor](../documentation/editors.md) who adds a panel to allow an user to configurate easly a message with `text`, `media` and `buttons`, then, using `MessageMaker.sendMessage` function you can send it anywhere
+
+### Substitutions
+
+It implements also a text substitution system extended optionally trough `config.allowExternalApi`, the substitutions are as follows:
+
+ • {ID} = user ID
+
+ • {NAME} = first name of user
+
+ • {SURNAME} = user surname
+
+ • {NAMESURNAME} = name and surname
+
+ • {GHNAME} = name in LGH format ( [userId] name/surname )
+
+ • {USERNAME} = user @username
+
+ • {MENTION} = link to the user profile
+
+ • {LANG} = user language
+
+ • {FLAG} = user language flag
+
+ • {GROUPNAME} = group name
+
+ • {GROUPUSERNAME} = group username
+
+ • {GROUPID} = group id
+
+ ---
+
+ config.allowExternalApi substitutions:
+
+ Syntax: FIAT{SYMBOL:OPTION}
+
+ • {BTC} {ETH} {BNB} {SOL} {XRP} {DOGE} {TON} {ADA} ... {XMR} = crypto price, avaiable any top2000 crypto symbol
+
+ • {TOP1} {TOP2} ... {TOP2000} = get crypto symbol at specific classific height (max 2000) ({TOP1} will translate to "BTC", so {{TOP1}} is the same of {BTC} and will give you the crypto price)
+
+ • Options: CAP(capitalization), VOL(24h volume), SUPPLY, RANK(cap classific), NAME, EXPLORER. (example: {BTC:CAP})
+
+ • Convert from default to specific currency: ${number}, €{number}, £{number}, CHF{number} or ₣{number}.
+
+ • Examples: {BNB}, €{BTC}, CHF{ETH}, £{BTC:CAP}, {XMR:SUPPLY}, €{{TOP15}} £{{TOP3}:NAME}
+
+ • Api: https://api.coincap.io/v2/assets (https://docs.coincap.io/)
+
+
+ ---
+
+ NOT IMPLEMENTED:
+
+ • {RULES} = group regulation text
+
+ • {DATE} = current date
+
+ • {TIME} = current time
+
+ • {WEEKDAY} = week day
+
+ • {MONTH} = current month
+
+ • {YEAR} = current year
+
+ • {UNIX} = seconds since 1970/1/1
+
+
+
+
+## Objects implemented
+
+- **[customMessage](../documentation/GHBot.md/#custommessage-object)**
+**Use cases**:
+[LGHChat](../documentation/GHBot.md/#LGHChat).rules
+[LGHWelcome](../documentation/GHBot.md/#lghwelcome-object).message
+[LGHGoodbye](../documentation/GHBot.md/#LGHGoodbye).gMsg
+[LGHGoodbye](../documentation/GHBot.md/#LGHGoodbye).pMsg
+
+
+
+- **[simpleMedia](../documentation/GHBot.md/#simplemedia-object)**
+**Use cases**:
+[customMessage](../documentation/GHBot.md/#LGHChat).media
\ No newline at end of file
diff --git a/docs/plugins/pin.md b/docs/plugins/pin.md
new file mode 100644
index 0000000..f13681e
--- /dev/null
+++ b/docs/plugins/pin.md
@@ -0,0 +1,7 @@
+# Pin
+
+**File**: `pin.js`
+
+**Description**: Plugin to add pin messages commands
+
+**Commands**: `/pin`
\ No newline at end of file
diff --git a/docs/plugins/promote.md b/docs/plugins/promote.md
new file mode 100644
index 0000000..e06347b
--- /dev/null
+++ b/docs/plugins/promote.md
@@ -0,0 +1,7 @@
+# Promotions
+
+**File**: `promotions.js`
+
+**Description**: This plugin add commands to promote users to any pre-made role by [Roles manager](roles-manager.md)
+
+**Commands**: `/free`, `/unfree`, `/helper`, `/unhelper`, `/cleaner`, `/uncleaner`, `/muter`, `/unmuter`, `/mod`, `/unmod`, `/cofounder`, `/uncofounder`, `/admin`, `/unadmin`, `/title`, `/untitle`
\ No newline at end of file
diff --git a/docs/plugins/punish.md b/docs/plugins/punish.md
new file mode 100644
index 0000000..6fcfc03
--- /dev/null
+++ b/docs/plugins/punish.md
@@ -0,0 +1,7 @@
+# Punishments
+
+**File**: `punish.js`
+
+**Description**: Implement punishent and unpunishent commands using the utility of `api/utils/punishment.js`
+
+**Commands**: `/delete`, `/warn`, `/unwarn`, `/kick`, `/mute`, `/unmute`, `/ban`, `/unban`
\ No newline at end of file
diff --git a/docs/plugins/roles-manager.md b/docs/plugins/roles-manager.md
new file mode 100644
index 0000000..ef38c82
--- /dev/null
+++ b/docs/plugins/roles-manager.md
@@ -0,0 +1,35 @@
+# Roles Manager
+
+## Informations
+
+**File**: `usersHandler.js`
+
+**Description**: This plugin manage users data and roles in the group, implements also `api/utils/rolesManager.js` to give an external interface to deal with roles
+
+Adds on `global.roles[roleName]` data about these pre-made roles: `founder`, `moderator`, `muter`, `cleaner`, `helper`, `free`.
+
+**Commands**: `/reload`, `/staff`, `/info`, `/perms`, `/forgot`
+
+
+## Objects implemented
+
+- **[LGHRole](../documentation/GHBot.md/#lghrole-object)**
+**Use cases**:
+[LGHChat](../documentation/GHBot.md#LGHChat).roles
+
+
+
+- **[LGHPerms](../documentation/GHBot.md/#lghperms-object)**
+**Use cases**:
+[LGHChat](../documentation/GHBot.md#LGHChat).basePerms
+[LGHChat](../documentation/GHBot.md#LGHChat).adminPerms
+[LGHUser](../documentation/GHBot.md#LGHUser).perms
+[LGHRole](../documentation/GHBot.md#LGHRole).perms
+
+
+
+- **[userStatus](../documentation/GHBot.md/#userstatus-object)**
+**Use cases**:
+[LGHChat](../documentation/GHBot.md#LGHChat).users
+
+
diff --git a/docs/plugins/rules.md b/docs/plugins/rules.md
new file mode 100644
index 0000000..8ed47bf
--- /dev/null
+++ b/docs/plugins/rules.md
@@ -0,0 +1,7 @@
+# Rules
+
+**File**: `rules.js`
+
+**Description**: Plugin to add rules of the group and allow to edit these trough [settings](settings.md) with [MessageMaker](message-maker.md)
+
+**Commands**: `/rules`
\ No newline at end of file
diff --git a/docs/plugins/set-chat-based-punish.md b/docs/plugins/set-chat-based-punish.md
new file mode 100644
index 0000000..ec8c2a5
--- /dev/null
+++ b/docs/plugins/set-chat-based-punish.md
@@ -0,0 +1,17 @@
+# Set chat based punishment
+
+## Informations
+
+**File**: `api/editors/setChatBasedPunish.js`
+
+**Description**: This is an [editor](../documentation/editors.md) who adds a panel to allow an user to configurate easly a different punishment based on various chat types `private`, `bot`, `group`, `channel`
+
+
+## Objects implemented
+
+- **[LGHChatBasedPunish](../documentation/GHBot.md/#lghrole-object)**
+**Use cases**:
+[LGHSpam](../documentation/GHBot.md/#lghspam-object).forward
+[LGHSpam](../documentation/GHBot.md/#lghspam-object).quote
+
+
\ No newline at end of file
diff --git a/docs/plugins/settings.md b/docs/plugins/settings.md
new file mode 100644
index 0000000..6d01a33
--- /dev/null
+++ b/docs/plugins/settings.md
@@ -0,0 +1,7 @@
+# Settings
+
+**File**: `settings.js`
+
+**Description**: This plugin manages settings for single users and settings panel for groups, lang settings are included
+
+**Commands**: `/settings`
\ No newline at end of file
diff --git a/docs/plugins/warns.md b/docs/plugins/warns.md
new file mode 100644
index 0000000..dfcdcfc
--- /dev/null
+++ b/docs/plugins/warns.md
@@ -0,0 +1,12 @@
+# Warns
+
+**File**: `warns.js`
+
+**Description**: Plugin to implement warn configuration [settings](settings.md) on a group
+
+
+## Objects implemented
+
+- **[LGHWarns](../documentation/GHBot.md/#LGHWarns)**
+**Use cases**:
+[LGHChat](../documentation/GHBot.md#LGHChat).warns
diff --git a/docs/plugins/welcome.md b/docs/plugins/welcome.md
new file mode 100644
index 0000000..5496b78
--- /dev/null
+++ b/docs/plugins/welcome.md
@@ -0,0 +1,12 @@
+# Welcome
+
+**File**: `welcome.js`
+
+**Description**: Plugin to allow to set up trough [settings](settings.md) with [MessageMaker](message-maker.md) a welcome message for new users in the group
+
+
+## Objects implemented
+
+- **[LGHWelcome](../documentation/GHBot.md/#lghwelcome-object)**
+**Use cases**:
+[LGHChat](../documentation/GHBot.md#LGHChat).welcome
diff --git a/docs/wiki/commands.md b/docs/wiki/commands.md
new file mode 100644
index 0000000..d1f641e
--- /dev/null
+++ b/docs/wiki/commands.md
@@ -0,0 +1,172 @@
+# 📋 Commands
+
+> ### Note for devs:
+> - **`COMMAND_`** code prefix means that the command is to be resolved on languages.
+> - **`COMMAND`** codes is also used to define permitted commands on [perms](../documentation/GHBot.md/#LGHPerms) object.
+> - **`@`** prefix on a command code/name means that user has permission to get the reply within private chat only (e.g., `@COMMAND_RULES`).
+
+---
+
+Some commands can use the **`*`** prefix (e.g., `/*rules`, `/*perms`) to force a reply on private chat, only if you have the right permissions inside the group
+
+### General Commands
+
+- **/settings**
+ Opens the group settings.
+ **Code:** `COMMAND_SETTINGS`
+
+- **/rules**
+ Shows the group rules.
+ **Code:** `COMMAND_RULES`
+ **Note:** **`*`** Allowed
+
+- **/perms**
+ Shows bot permissions of a user.
+ **Code:** `COMMAND_PERMS`
+ **Note:** **`*`** Allowed
+
+- **/staff**
+ Shows group staff with default and custom roles.
+ **Code:** `COMMAND_STAFF`
+ **Note:** **`*`** Allowed
+
+- **/info**
+ Shows information about a group user and allows editing.
+ **Code:** `COMMAND_INFO`
+ **Note:** **`*`** Allowed
+
+- **/me**
+ Shows information about yourself.
+ **Code:** `COMMAND_ME`
+ **Note:** **`*`** Allowed
+
+- **/pin**
+ Pins a chat message with or without a notification.
+ **Code:** `COMMAND_PIN`
+ **Note:** **`*`** Allowed
+
+### Punishment Commands
+
+- **/del**
+ Deletes a message.
+ **Code:** `COMMAND_DELETE`
+
+- **/warn**
+ Warns a user and punishes them if they reach the group warning limit.
+ **Code:** `COMMAND_WARN`
+
+- **/unwarn**
+ Removes a warning from a user.
+ **Code:** `COMMAND_UNWARN`
+
+- **/delwarn**
+ Warns a user and deletes a message.
+ **Code:** `COMMAND_DELWARN`
+
+- **/kick**
+ Kicks a user out of the group.
+ **Code:** `COMMAND_KICK`
+
+- **/delkick**
+ Kicks a user and deletes a message.
+ **Code:** `COMMAND_DELKICK`
+
+- **/mute**
+ Disables messaging for a user.
+ **Code:** `COMMAND_MUTE`
+
+- **/unmute**
+ Re-enables messaging for a user.
+ **Code:** `COMMAND_UNMUTE`
+
+- **/delmute**
+ Mutes a user and deletes a message.
+ **Code:** `COMMAND_DELMUTE`
+
+- **/ban**
+ Permanently removes a user from the group.
+ **Code:** `COMMAND_BAN`
+
+- **/unban**
+ Unbans a user from the group.
+ **Code:** `COMMAND_UNBAN`
+
+- **/delban**
+ Bans a user and deletes a message.
+ **Code:** `COMMAND_DELBAN`
+
+### Role Management Commands
+
+- **/free**
+ Assigns the free role to a user.
+ **Code:** `COMMAND_FREE`
+
+- **/unfree**
+ Removes the free role from a user.
+ **Code:** `COMMAND_UNFREE`
+
+- **/helper**
+ Assigns the helper role to a user.
+ **Code:** `COMMAND_HELPER`
+
+- **/unhelper**
+ Removes the helper role from a user.
+ **Code:** `COMMAND_UNHELPER`
+
+- **/cleaner**
+ Assigns the cleaner role to a user.
+ **Code:** `COMMAND_CLEANER`
+
+- **/uncleaner**
+ Removes the cleaner role from a user.
+ **Code:** `COMMAND_UNCLEANER`
+
+- **/muter**
+ Assigns the muter role to a user.
+ **Code:** `COMMAND_MUTER`
+
+- **/unmuter**
+ Removes the muter role from a user.
+ **Code:** `COMMAND_UNMUTER`
+
+- **/mod**
+ Assigns the moderator role to a user.
+ **Code:** `COMMAND_MODERATOR`
+
+- **/unmod**
+ Removes the moderator role from a user.
+ **Code:** `COMMAND_UNMODERATOR`
+
+- **/cofounder**
+ Assigns the cofounder role to a user.
+ **Code:** `COMMAND_COFOUNDER`
+
+- **/uncofounder**
+ Removes the cofounder role from a user.
+ **Code:** `COMMAND_UNCOFOUNDER`
+
+### Admin Commands
+
+- **/admin**
+ Grants admin status to a user.
+ **Code:** `COMMAND_ADMINISTRATOR`
+
+- **/unadmin**
+ Removes admin status from a user.
+ **Code:** `COMMAND_UNADMINISTRATOR`
+
+- **/title**
+ Sets an administrator group title.
+ **Code:** `COMMAND_TITLE`
+
+- **/untitle**
+ Removes an administrator group title.
+ **Code:** `COMMAND_UNTITLE`
+
+### Privacy Commands
+
+- **/forgot**
+ Removes all data about an user from your group.
+ **Code:** `COMMAND_FORGOT`
+
+
\ No newline at end of file
diff --git a/docs/wiki/configuration.md b/docs/wiki/configuration.md
new file mode 100644
index 0000000..7712724
--- /dev/null
+++ b/docs/wiki/configuration.md
@@ -0,0 +1,71 @@
+# Configuration guide (config.json)
+
+## Essential settings
+
+**botToken**: `String`
+Your bot token gaven from [@BotFather](https://t.me/BotFather) (ex. `4839574812:AAFD39kkdpWt3ywyRZergyOLMaJhac60qc`)
+
+**botStaff**: `ArrayTelegramBot
", "[TelegramBot
](https://github.com/yagop/node-telegram-bot-api/blob/master/doc/api.md)")
+.replaceAll(`TelegramBot.`, `TelegramBot.`)
+
+const head =
+`## TelegramBot api
+
+You can finnd documentation about TelegramBot Objects on [telegram-bot-api](https://github.com/yagop/node-telegram-bot-api/blob/master/doc/api.md) github
+
+---
+
+The down below lines are generated with [jsdoc2md](https://github.com/jsdoc2md/jsdoc-to-markdown)
+
+
+`
+
+fs.writeFileSync("./docs/documentation/GHBot.md", head+docs)
+
+console.log("JSDoc to Markdown successfull, now run `mkdocs serve`\n"+
+ "Install guide for mkdocs: https://www.mkdocs.org/user-guide/installation/")