33namespace Ourted \Interfaces ;
44
55use Ourted \Bot ;
6+ use Ourted \Model \Guild \Integration ;
67use Ourted \Model \Role \Role ;
78
8- class Guild{
9+ class Guild
10+ {
911
1012 /** @var Bot */
1113 private $ bot ;
@@ -29,7 +31,8 @@ public function get_guilds_properties()
2931 "" , "GET " ));
3032 }
3133
32- public function getGuild ($ id ){
34+ public function getGuild ($ id )
35+ {
3336 return new \Ourted \Model \Guild \Guild ($ this ->bot , $ id );
3437 }
3538
@@ -39,7 +42,8 @@ public function getGuild($id){
3942 * @param $role_id int|string
4043 * @return Role
4144 */
42- public function getRole ($ guild , $ role_id ){
45+ public function getRole ($ guild , $ role_id )
46+ {
4347 return new Role ($ this ->bot , $ guild , $ role_id );
4448 }
4549
@@ -48,7 +52,8 @@ public function getRole($guild, $role_id){
4852 * @param $guild \Ourted\Model\Guild\Guild
4953 * @return Role
5054 */
51- public function getRoles ($ guild ){
55+ public function getRoles ($ guild )
56+ {
5257 return new Role ($ this ->bot , $ guild );
5358 }
5459
@@ -58,10 +63,41 @@ public function getRoles($guild){
5863 * @param $guild \Ourted\Model\Guild\Guild
5964 * @return mixed
6065 */
61- public function getChannels ($ guild ){
62- return json_decode ($ this ->bot ->api ->init_curl_with_header ("guilds/ {$ guild ->id }/channels " ,"" , "GET " ));
66+ public function getChannels ($ guild )
67+ {
68+ return json_decode ($ this ->bot ->api ->init_curl_with_header ("guilds/ {$ guild ->id }/channels " , "" , "GET " ));
6369 }
6470
71+ /**
72+ *
73+ * @param $guild \Ourted\Model\Guild\Guild
74+ * @return mixed
75+ */
76+ public function getPrune ($ guild )
77+ {
78+ return json_decode ($ this ->bot ->api ->init_curl_with_header ("guilds/ {$ guild ->id }/prunes " , "" , "GET " ));
79+ }
80+
81+ /**
82+ *
83+ * @param $guild \Ourted\Model\Guild\Guild
84+ * @return mixed
85+ */
86+ public function getInvites ($ guild )
87+ {
88+ return json_decode ($ this ->bot ->api ->init_curl_with_header ("guilds/ {$ guild ->id }/invites " , "" , "GET " ));
89+ }
90+
91+
92+ /**
93+ *
94+ * @param $guild \Ourted\Model\Guild\Guild
95+ * @return mixed
96+ */
97+ public function getIntegrations ($ guild )
98+ {
99+ return new Integration ($ this ->bot , $ guild ->id );
100+ }
65101
66102
67103 /**
@@ -73,8 +109,68 @@ public function getChannels($guild){
73109 * @param bool $hoist
74110 * @return Role
75111 */
76- public function addRole ($ guild , $ role_name , $ color , $ mentionable , $ hoist ){
77- $ result = json_decode ($ this ->bot ->api ->init_curl_with_header ("guilds/ {$ guild ->id }/roles " ,"{ \"name \": \"{$ role_name }\", \"color \": \"{$ color }\", \"hoist \": {$ hoist }, \"mentionable \": {$ mentionable }} " , "POST " ));
112+ public function addRole ($ guild , $ role_name , $ color , $ mentionable , $ hoist )
113+ {
114+ $ result = json_decode ($ this ->bot ->api ->init_curl_with_header ("guilds/ {$ guild ->id }/roles " , "{ \"name \": \"{$ role_name }\", \"color \": \"{$ color }\", \"hoist \": {$ hoist }, \"mentionable \": {$ mentionable }} " , "POST " ));
78115 return new Role ($ this ->bot , $ guild , $ result ->id );
79116 }
117+
118+ /**
119+ *
120+ * @param \Ourted\Model\Guild\Guild $guild
121+ * @param string $role_name
122+ * @param int|string $color
123+ * @param bool $mentionable
124+ * @param bool $hoist
125+ * @return Role
126+ */
127+ public function modifyRole ($ guild , $ role_name = null , $ color = null , $ mentionable = null , $ hoist = null )
128+ {
129+ $ result = json_decode ($ this ->bot ->api ->init_curl_with_header ("guilds/ {$ guild ->id }/roles " , "{ \"name \": \"{$ role_name }\", \"color \": \"{$ color }\", \"hoist \": {$ hoist }, \"mentionable \": {$ mentionable }} " , "PATCH " ));
130+ return new Role ($ this ->bot , $ guild , $ result ->id );
131+ }
132+
133+ /**
134+ *
135+ * @param \Ourted\Model\Guild\Guild $guild
136+ * @param string|int $role_id
137+ * @return Role
138+ */
139+ public function deleteRole ($ guild , $ role_id )
140+ {
141+ $ result = json_decode ($ this ->bot ->api ->init_curl_with_header ("guilds/ {$ guild ->id }/roles/ {$ role_id }" , "" , "DELETE " ));
142+ return new Role ($ this ->bot , $ guild , $ result ->id );
143+ }
144+
145+ /**
146+ *
147+ * @param \Ourted\Model\Guild\Guild $guild
148+ * @param string
149+ * @param int
150+ * @param string
151+ * @param int
152+ * @param int
153+ * @param int
154+ * @param int
155+ * @param int
156+ * @param bool
157+ * @return \Ourted\Model\Channel\Channel
158+ */
159+ public function createChannel ($ guild , $ channel_name , $ type = 0 , $ topic = "" , $ bitrate = 0 , $ user_limit = 0 , $ rate_limit_per_user = 0 , $ position = 0 , $ parent_id = 0 , $ nsfw = false )
160+ {
161+ $ result = json_decode ($ this ->bot ->api ->init_curl_with_header ("guilds/ {$ guild ->id }/channels " , "{ \"name \": \"{$ channel_name }\", \"type \": {$ type }, \"topic \", \"{$ topic }\", \"bitrate \": {$ bitrate }, \"user_limit \": {$ user_limit }, \"rate_limit_per_user \": {$ rate_limit_per_user }, \"position \": {$ position }, \"parent_id \": {$ parent_id }, \"nsfw \": {$ nsfw }} " , "POST " ));
162+ return new \Ourted \Model \Channel \Channel ($ this ->bot , $ result ->id );
163+ }
164+
165+ /**
166+ *
167+ * @param \Ourted\Model\Guild\Guild $guild
168+ * @param \Ourted\Model\Channel\Channel
169+ * @param int
170+ */
171+ public function changeChannelPosition ($ guild , $ channel , $ position )
172+ {
173+ $ result = json_decode ($ this ->bot ->api ->init_curl_with_header ("guilds/ {$ guild ->id }/channels " , "{ \"id \": {$ channel ->id }, \"position \": {$ position }} " , "PATCH " ));
174+ return new \Ourted \Model \Channel \Channel ($ this ->bot , $ result ->id );
175+ }
80176}
0 commit comments