@@ -85,6 +85,96 @@ public function broadcast(array $userList, $msg)
85
85
. $ this ->escapeStringArgument ($ msg ));
86
86
}
87
87
88
+ /**
89
+ * Creates a new group chat with the users in $userList.
90
+ *
91
+ * @param string $chatTitle The title of the new chat
92
+ * @param array $userList The users you want to add to the chat. Gets formatted with formatPeerList().
93
+ * The current telgram-user (who creates the chat) will be added automatically.
94
+ *
95
+ * @return boolean true on success, false otherwise
96
+ *
97
+ * @uses exec()
98
+ * @uses escapeStringArgument()
99
+ * @uses formatPeerList()
100
+ */
101
+ public function createGroupChat ($ chatTitle , $ userList )
102
+ {
103
+ if (count ($ userList ) <= 0 ) {
104
+ return false ;
105
+ }
106
+
107
+ return $ this ->exec ('create_group_chat ' , $ this ->escapeStringArgument ($ chatTitle ),
108
+ $ this ->formatPeerList ($ userList ));
109
+ }
110
+
111
+ /**
112
+ * Returns an info-object about a chat (title, name, members, admin, etc.).
113
+ *
114
+ * @param string $chat The name of the chat (not the title). Gets escaped with escapePeer().
115
+ *
116
+ * @return object|boolean A chat-object; false if somethings goes wrong
117
+ *
118
+ * @uses exec()
119
+ * @uses escapePeer()
120
+ */
121
+ public function chatInfo ($ chat )
122
+ {
123
+ return $ this ->exec ('chat_info ' , $ this ->escapePeer ($ chat ));
124
+ }
125
+
126
+ /**
127
+ * Renames a chat. Both, the chat title and the print-name will change.
128
+ *
129
+ * @param string $chat The name of the chat (not the title). Gets escaped with escapePeer().
130
+ * @param string $chatTitle The new title of the chat.
131
+ *
132
+ * @return boolean true on success, false otherwise
133
+ *
134
+ * @uses exec()
135
+ * @uses escapePeer()
136
+ * @uses escapeStringArgument()
137
+ */
138
+ public function renameChat ($ chat , $ newChatTitle )
139
+ {
140
+ return $ this ->exec ('rename_chat ' , $ this ->escapePeer ($ chat ), $ this ->escapeStringArgument ($ newChatTitle ));
141
+ }
142
+
143
+ /**
144
+ * Adds a user to a chat.
145
+ *
146
+ * @param string $chat The chat you want the user to add to. Gets escaped with escapePeer().
147
+ * @param string $user The user you want to add. Gets escaped with escapePeer().
148
+ * @param int $numberOfMessagesToFoward The number of last messages of the chat, the new user should see.
149
+ * Default is 100.
150
+ *
151
+ * @return boolean true on success, false otherwise
152
+ *
153
+ * @uses exec()
154
+ * @uses escapePeer()
155
+ */
156
+ public function chatAddUser ($ chat , $ user , $ numberOfMessagesToFoward = 100 )
157
+ {
158
+ return $ this ->exec ('chat_add_user ' , $ this ->escapePeer ($ chat ), $ this ->escapePeer ($ user ),
159
+ (int ) $ numberOfMessagesToFoward );
160
+ }
161
+
162
+ /**
163
+ * Deletes a user from a chat.
164
+ *
165
+ * @param string $chat The chat you want the user to delete from. Gets escaped with escapePeer().
166
+ * @param string $user The user you want to delete. Gets escaped with escapePeer().
167
+ *
168
+ * @return boolean true on success, false otherwise
169
+ *
170
+ * @uses exec()
171
+ * @uses escapePeer()
172
+ */
173
+ public function chatDeleteUser ($ chat , $ user )
174
+ {
175
+ return $ this ->exec ('chat_delete_user ' , $ this ->escapePeer ($ chat ), $ this ->escapePeer ($ user ));
176
+ }
177
+
88
178
/**
89
179
* Sets the profile name
90
180
*
0 commit comments