@@ -243,13 +243,13 @@ def get_all_guild_webhooks(self) -> list[dict[str, Any]]:
243243 def create_webhook (self , name : str , channel_id_ : int ) -> str :
244244 """Creates a new webhook for a particular channel."""
245245 payload = {"name" : name }
246-
247246 response = self .post (
248247 f"/channels/{ channel_id_ } /webhooks" ,
249248 json = payload ,
250249 headers = {"X-Audit-Log-Reason" : "Creating webhook as part of PyDis botstrap" },
251250 )
252251 new_webhook = response .json ()
252+ log .info ("Creating webhook: %s has been successfully created." , name )
253253 return new_webhook ["id" ]
254254
255255 def list_emojis (self ) -> list [dict [str , Any ]]:
@@ -259,7 +259,7 @@ def list_emojis(self) -> list[dict[str, Any]]:
259259
260260 def get_emoji_contents (self , id_ : str | int ) -> bytes | None :
261261 """Fetches the image data for an emoji by ID."""
262- # emojis are located at https://cdn.discordapp.com/emojis/{emoji_id}.{ext}
262+ # Emojis are located at https://cdn.discordapp.com/emojis/{emoji_id}.{ext}
263263 response = self .get (f"{ self .CDN_BASE_URL } /emojis/{ id_ !s} .webp" )
264264 return response .content
265265
@@ -270,16 +270,19 @@ def clone_emoji(self, *, new_name: str, original_emoji_id: str | int) -> str:
270270 log .warning ("Couldn't find emoji with ID %s." , original_emoji_id )
271271 return ""
272272
273+ image_data = base64 .b64encode (emoji_data ).decode ("utf-8" )
274+
273275 payload = {
274276 "name" : new_name ,
275- "image" : f"data:image/png;base64,{ base64 . b64encode ( emoji_data ). decode ( 'utf-8' ) } " ,
277+ "image" : f"data:image/png;base64,{ image_data } " ,
276278 }
277279
278280 response = self .post (
279281 f"/guilds/{ self .guild_id } /emojis" ,
280282 json = payload ,
281- headers = {"X-Audit-Log-Reason" : f "Creating { new_name } emoji as part of PyDis botstrap" },
283+ headers = {"X-Audit-Log-Reason" : "Creating emoji as part of PyDis botstrap" },
282284 )
285+
283286 new_emoji = response .json ()
284287 return new_emoji ["id" ]
285288
@@ -462,12 +465,13 @@ def run(self) -> None:
462465 config : dict [str , dict [str , Any ]] = {}
463466 self .upgrade_client ()
464467 self .check_guild_membership ()
465- config ["categories" ] = self .get_categories ()
466- config ["channels" ] = self .get_channels ()
467- config ["roles" ] = self .get_roles ()
468-
469- config ["webhooks" ] = self .sync_webhooks ()
470- config ["emojis" ] = self .sync_emojis ()
468+ config = {
469+ "categories" : self .get_categories (),
470+ "channels" : self .get_channels (),
471+ "roles" : self .get_roles (),
472+ "webhooks" : self .sync_webhooks (),
473+ "emojis" : self .sync_emojis (),
474+ }
471475
472476 self .write_config_env (config , self .env_file )
473477
0 commit comments