Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -100,26 +100,94 @@ async def count(ctx):
|
|
100 |
|
101 |
|
102 |
@bot.command()
|
103 |
-
async def
|
104 |
if ctx.author.id == 811235357663297546:
|
105 |
-
# Calculate the start and end dates for the desired time frame
|
106 |
end_date = datetime.datetime.utcnow() # Current date and time
|
107 |
start_date = end_date - datetime.timedelta(days=1)
|
108 |
-
|
109 |
-
# Counter for messages within the time frame
|
110 |
message_count = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
for channel in ctx.guild.text_channels:
|
114 |
try:
|
115 |
async for message in channel.history(limit=None, after=start_date, before=end_date):
|
116 |
message_count += 1
|
|
|
|
|
|
|
117 |
|
118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
except discord.Forbidden:
|
120 |
print(f"Missing access to read messages in {channel.name}")
|
|
|
|
|
121 |
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
|
125 |
""""""
|
|
|
100 |
|
101 |
|
102 |
@bot.command()
|
103 |
+
async def count_messages1(ctx):
|
104 |
if ctx.author.id == 811235357663297546:
|
|
|
105 |
end_date = datetime.datetime.utcnow() # Current date and time
|
106 |
start_date = end_date - datetime.timedelta(days=1)
|
|
|
|
|
107 |
message_count = 0
|
108 |
+
for channel in ctx.guild.text_channels:
|
109 |
+
try:
|
110 |
+
async for message in channel.history(limit=None, after=start_date, before=end_date):
|
111 |
+
message_count += 1
|
112 |
+
except discord.Forbidden:
|
113 |
+
print(f"Missing access to read messages in {channel.name}")
|
114 |
+
print(f'Total messages between {start_date} and {end_date}: {message_count}')
|
115 |
+
|
116 |
+
|
117 |
+
@bot.command()
|
118 |
+
async def count_messages7(ctx):
|
119 |
+
if ctx.author.id == 811235357663297546:
|
120 |
+
end_date = datetime.datetime.utcnow() # Current date and time
|
121 |
+
start_date = end_date - datetime.timedelta(days=7)
|
122 |
+
message_count = 0
|
123 |
+
for channel in ctx.guild.text_channels:
|
124 |
+
try:
|
125 |
+
async for message in channel.history(limit=None, after=start_date, before=end_date):
|
126 |
+
message_count += 1
|
127 |
+
except discord.Forbidden:
|
128 |
+
print(f"Missing access to read messages in {channel.name}")
|
129 |
+
print(f'Total messages between {start_date} and {end_date}: {message_count}')
|
130 |
+
|
131 |
+
|
132 |
+
@bot.command()
|
133 |
+
async def count_messages14(ctx):
|
134 |
+
if ctx.author.id == 811235357663297546:
|
135 |
+
end_date = datetime.datetime.utcnow() # Current date and time
|
136 |
+
start_date = end_date - datetime.timedelta(days=14)
|
137 |
+
message_count = 0
|
138 |
+
for channel in ctx.guild.text_channels:
|
139 |
+
try:
|
140 |
+
async for message in channel.history(limit=None, after=start_date, before=end_date):
|
141 |
+
message_count += 1
|
142 |
+
except discord.Forbidden:
|
143 |
+
print(f"Missing access to read messages in {channel.name}")
|
144 |
+
print(f'Total messages between {start_date} and {end_date}: {message_count}')
|
145 |
|
146 |
|
147 |
+
@bot.command()
|
148 |
+
async def count_messages130(ctx):
|
149 |
+
if ctx.author.id == 811235357663297546:
|
150 |
+
end_date = datetime.datetime.utcnow() # Current date and time
|
151 |
+
start_date = end_date - datetime.timedelta(days=30)
|
152 |
+
message_count = 0
|
153 |
for channel in ctx.guild.text_channels:
|
154 |
try:
|
155 |
async for message in channel.history(limit=None, after=start_date, before=end_date):
|
156 |
message_count += 1
|
157 |
+
except discord.Forbidden:
|
158 |
+
print(f"Missing access to read messages in {channel.name}")
|
159 |
+
print(f'Total messages between {start_date} and {end_date}: {message_count}')
|
160 |
|
161 |
+
|
162 |
+
|
163 |
+
@bot.command()
|
164 |
+
async def count_messages60(ctx):
|
165 |
+
if ctx.author.id == 811235357663297546:
|
166 |
+
end_date = datetime.datetime.utcnow() # Current date and time
|
167 |
+
start_date = end_date - datetime.timedelta(days=60)
|
168 |
+
message_count = 0
|
169 |
+
for channel in ctx.guild.text_channels:
|
170 |
+
try:
|
171 |
+
async for message in channel.history(limit=None, after=start_date, before=end_date):
|
172 |
+
message_count += 1
|
173 |
except discord.Forbidden:
|
174 |
print(f"Missing access to read messages in {channel.name}")
|
175 |
+
print(f'Total messages between {start_date} and {end_date}: {message_count}')
|
176 |
+
|
177 |
|
178 |
+
@bot.command()
|
179 |
+
async def count_messages90(ctx):
|
180 |
+
if ctx.author.id == 811235357663297546:
|
181 |
+
end_date = datetime.datetime.utcnow() # Current date and time
|
182 |
+
start_date = end_date - datetime.timedelta(days=90)
|
183 |
+
message_count = 0
|
184 |
+
for channel in ctx.guild.text_channels:
|
185 |
+
try:
|
186 |
+
async for message in channel.history(limit=None, after=start_date, before=end_date):
|
187 |
+
message_count += 1
|
188 |
+
except discord.Forbidden:
|
189 |
+
print(f"Missing access to read messages in {channel.name}")
|
190 |
+
print(f'Total messages between {start_date} and {end_date}: {message_count}')
|
191 |
|
192 |
|
193 |
""""""
|