mirror of
https://github.com/alterware/aw-bot.git
synced 2025-11-18 09:02:07 +00:00
feat: hate me
This commit is contained in:
@@ -15,6 +15,10 @@ CRAZY_USER_ID = 1319364607487512658
|
|||||||
CRAZY_URL = "https://cdn.discordapp.com/attachments/1119371841711112314/1329770453744746559/download.png"
|
CRAZY_URL = "https://cdn.discordapp.com/attachments/1119371841711112314/1329770453744746559/download.png"
|
||||||
crazy_last_response_time = None
|
crazy_last_response_time = None
|
||||||
|
|
||||||
|
HATE_ME_USER_ID = 748201351665680438
|
||||||
|
HATE_ME_URL = "https://cdn.discordapp.com/attachments/1160511084143312959/1361051561400205524/download_1.png"
|
||||||
|
hate_me_last_response_time = None
|
||||||
|
|
||||||
ALLOWED_CHANNELS = [
|
ALLOWED_CHANNELS = [
|
||||||
GENERAL_CHANNEL,
|
GENERAL_CHANNEL,
|
||||||
1112048063448617142, # off-topic
|
1112048063448617142, # off-topic
|
||||||
@@ -38,6 +42,38 @@ async def handle_dm(message):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def handle_crazy(message):
|
||||||
|
global crazy_last_response_time
|
||||||
|
|
||||||
|
if message.author.id == CRAZY_USER_ID:
|
||||||
|
now = aware_utcnow()
|
||||||
|
if (
|
||||||
|
crazy_last_response_time is None
|
||||||
|
or now - crazy_last_response_time >= timedelta(hours=8)
|
||||||
|
):
|
||||||
|
crazy_last_response_time = now
|
||||||
|
await message.channel.send(f"{CRAZY_URL}")
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
async def handle_hate_me(message):
|
||||||
|
global hate_me_last_response_time
|
||||||
|
|
||||||
|
if message.author.id == HATE_ME_USER_ID:
|
||||||
|
now = aware_utcnow()
|
||||||
|
if (
|
||||||
|
hate_me_last_response_time is None
|
||||||
|
or now - hate_me_last_response_time >= timedelta(hours=8)
|
||||||
|
):
|
||||||
|
hate_me_last_response_time = now
|
||||||
|
await message.channel.send(f"{HATE_ME_URL}")
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
async def is_message_a_duplicate(message):
|
async def is_message_a_duplicate(message):
|
||||||
guild = message.guild
|
guild = message.guild
|
||||||
for channel in guild.text_channels:
|
for channel in guild.text_channels:
|
||||||
@@ -267,8 +303,6 @@ async def handle_message_delete(message, bot):
|
|||||||
|
|
||||||
|
|
||||||
async def handle_message(message, bot):
|
async def handle_message(message, bot):
|
||||||
global crazy_last_response_time
|
|
||||||
|
|
||||||
if message.author == bot.user:
|
if message.author == bot.user:
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -311,14 +345,10 @@ async def handle_message(message, bot):
|
|||||||
await message.delete()
|
await message.delete()
|
||||||
return
|
return
|
||||||
|
|
||||||
if message.author.id == CRAZY_USER_ID:
|
if await handle_crazy(message):
|
||||||
now = aware_utcnow()
|
return
|
||||||
if (
|
|
||||||
crazy_last_response_time is None
|
if await handle_hate_me(message):
|
||||||
or now - crazy_last_response_time >= timedelta(hours=8)
|
|
||||||
):
|
|
||||||
crazy_last_response_time = now
|
|
||||||
await message.channel.send(f"{CRAZY_URL}")
|
|
||||||
return
|
return
|
||||||
|
|
||||||
await is_message_a_duplicate(message)
|
await is_message_a_duplicate(message)
|
||||||
|
|||||||
Reference in New Issue
Block a user