1+ import logging
12import os
23
34import nextcord
@@ -52,23 +53,21 @@ def get_channels():
5253async def broadcast_stats ():
5354 channel_list = get_channels ()
5455 client = BotObjectHolder .get_bot ()
55- print (client )
5656
5757 for el in channel_list :
5858 channel_id = el ["ChannelId" ]
5959 channel = client .get_channel (channel_id )
60- print (channel )
60+ server_id = get_guild_id_by_channel_id (channel_id )
61+
62+ print (f'{ datetime .datetime .now ()} : Broadcast stats to #{ channel } , channelId={ channel_id } serverId { server_id } ' )
6163
6264 forecast_image = nextcord .File ('./assets/generated_images/image.png' )
6365
64- if get_guild_id_by_channel_id (channel_id ) == str (OUR_SERVER_ID ):
65- embed = await message_templates .daily_stats_embed (forecast_image .filename , our_server = True )
66- await channel .send (embed = embed ,
67- files = [forecast_image ])
68- else :
69- embed = await message_templates .daily_stats_embed (forecast_image .filename )
70- await channel .send (embed = embed ,
71- files = [forecast_image ])
66+ embed = await message_templates .daily_stats_embed (
67+ forecast_image .filename ,
68+ our_server = (server_id == OUR_SERVER_ID ))
69+
70+ await channel .send (embed = embed , files = [forecast_image ])
7271
7372
7473@tasks .loop (minutes = 30 )
@@ -78,8 +77,6 @@ async def send_stats():
7877 minute = now .minute
7978 if 4 <= hour < 5 :
8079 if 15 <= minute < 45 :
81- print (f"{ hour } :{ minute } -> wysyłam pobrane statystyki" )
82-
8380 generate_forecast_image ()
8481 generate_graphs_image ()
8582
0 commit comments