Watch this talk. It'll probably the best 20 minutes you invested ever. "I have nothing to hide"
I do stuff on the internet. You may also read some smart comments about VPNs.
Imagine a README with more content than this ✨
Simple Python Discord modlog-bot sourced from auditlogs without database
License: GNU General Public License v3.0
I do stuff on the internet. You may also read some smart comments about VPNs.
Imagine a README with more content than this ✨
Problem code:
@client.event
async def on_member_ban(gld, usr):
await asyncio.sleep(0.5)
found_entry = None
async for entry in gld.audit_logs(limit = 50, action = discord.AuditLogAction.ban, after = datetime.datetime.utcnow() - datetime.timedelta(seconds = 15), oldest_first = False):
if entry.created_at < datetime.datetime.utcnow() - datetime.timedelta(seconds = 10):
continue
if entry.target.id == usr.id:
found_entry = entry
break
if not found_entry:
return
await post_modlog(guild = gld, type = "BAN", user = found_entry.user, target = usr, reason = found_entry.reason)
@client.event
async def on_member_unban(gld, usr):
await asyncio.sleep(0.5)
found_entry = None
async for entry in gld.audit_logs(limit = 50, action = discord.AuditLogAction.unban, after = datetime.datetime.utcnow() - datetime.timedelta(seconds = 15), oldest_first = False):
if entry.created_at < datetime.datetime.utcnow() - datetime.timedelta(seconds = 10):
continue
if entry.target.id == usr.id:
found_entry = entry
break
if not found_entry:
return
await post_modlog(guild = gld, type = "UNBAN", user = found_entry.user, target = usr, reason = found_entry.reason)
`
Error:
2022-06-23 14:12:56 ERROR discord.client Ignoring exception in on_member_ban
Traceback (most recent call last):
File "/home/darkness/Рабочий стол/discord-bot/discord.py/discord/client.py", line 456, in _run_event
await coro(*args, **kwargs)
File "/home/darkness/Рабочий стол/discord-bot/python/MCPL - System/src/bot/core.py", line 671, in on_member_ban
if entry.created_at < datetime.datetime.utcnow() - datetime.timedelta(seconds = 10):
TypeError: can't compare offset-naive and offset-aware datetimes
2022-06-23 14:13:24 ERROR discord.client Ignoring exception in on_member_unban
Traceback (most recent call last):
File "/home/darkness/Рабочий стол/discord-bot/discord.py/discord/client.py", line 456, in _run_event
await coro(*args, **kwargs)
File "/home/darkness/Рабочий стол/discord-bot/python/MCPL - System/src/bot/core.py", line 685, in on_member_unban
if entry.created_at < datetime.datetime.utcnow() - datetime.timedelta(seconds = 10):
TypeError: can't compare offset-naive and offset-aware datetimes
Dynamite#8582 is started.
Ignoring exception in on_member_unban
Traceback (most recent call last):
File "F:\Users\pc\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "E:\Download\simple-modlogs-master\bot.py", line 38, in on_member_unban
await post_modlog(guild = gld, type = "UNBAN", user = found_entry.user, target = usr, reason = found_entry.reason)
File "E:\Download\simple-modlogs-master\bot.py", line 97, in post_modlog
caseid = str(int(s.embeds[0].author.name.split(" | Case ")[1]) + 1)
AttributeError: '_EmptyEmbed' object has no attribute 'split'
Ignoring exception in on_member_ban
Traceback (most recent call last):
File "F:\Users\pc\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "E:\Download\simple-modlogs-master\bot.py", line 25, in on_member_ban
await post_modlog(guild = gld, type = "BAN", user = found_entry.user, target = usr, reason = found_entry.reason)
File "E:\Download\simple-modlogs-master\bot.py", line 97, in post_modlog
caseid = str(int(s.embeds[0].author.name.split(" | Case ")[1]) + 1)
AttributeError: '_EmptyEmbed' object has no attribute 'split'
f
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aiohttp/connector.py", line 969, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore # noqa
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 1081, in create_connection
transport, protocol = await self._create_connection_transport(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 1111, in _create_connection_transport
await waiter
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/sslproto.py", line 528, in data_received
ssldata, appdata = self._sslpipe.feed_ssldata(data)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/sslproto.py", line 188, in feed_ssldata
self._sslobj.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 944, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/root1/simple-modlogs/bot.py", line 135, in
client.run(configs.DISCORD_BOT_TOKEN)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/client.py", line 718, in run
return future.result()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/client.py", line 697, in runner
await self.start(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/client.py", line 660, in start
await self.login(*args, bot=bot)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/client.py", line 509, in login
await self.http.static_login(token.strip(), bot=bot)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/http.py", line 293, in static_login
data = await self.request(Route('GET', '/users/@me'))
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/http.py", line 185, in request
async with self.__session.request(method, url, **kwargs) as r:
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aiohttp/client.py", line 1117, in aenter
self._resp = await self._coro
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aiohttp/client.py", line 520, in _request
conn = await self._connector.connect(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aiohttp/connector.py", line 535, in connect
proto = await self._create_connection(req, traces, timeout)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aiohttp/connector.py", line 892, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aiohttp/connector.py", line 1051, in _create_direct_connection
raise last_exc
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aiohttp/connector.py", line 1020, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aiohttp/connector.py", line 971, in _wrap_create_connection
raise ClientConnectorCertificateError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)')]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.