Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Adam Molnar commited on
massively increase cache limits (10000)
Browse files23 unmodified lines2425262727282930420 unmodified lines45145245345445445545645723 unmodified lines
DISCORD_TOKEN = os.environ.get("DISCORD_TOKEN", None)intents = discord.Intents.all()bot = commands.Bot(command_prefix='!', intents=intents)bot = commands.Bot(command_prefix='!', intents=intents, max_messages=100000)
logger = logging.getLogger(__name__)logging.basicConfig(level=logging.DEBUG)420 unmodified lines guild = bot.get_guild(879548962464493619) for channel in guild.text_channels: # helps with more accurate logging across restarts try: message_cache.update({m.id: m async for m in channel.history(limit=100)}) message_cache.update({m.id: m async for m in channel.history(limit=10000)}) print(f"Finished caching messages for channel: {channel.name}") except Exception as e: print(f"An error occurred while fetching messages from {channel.name}: {e}")app.py+2-2