-
Notifications
You must be signed in to change notification settings - Fork 0
/
Archibald.py
108 lines (87 loc) · 3.48 KB
/
Archibald.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Archibald bot, Archivist for the Library of Zebulax
import os
import discord
import asyncio
import random
from dotenv import load_dotenv
from CatchPhrases import catchPhrases
from ArchibaldPlays import archibaldPlaying
from ArchibaldQuotes import archibaldQuotes
from ArchibaldAnswers import archibaldAnswers
from ArchibaldDoubt import archibaldDoubt
from ArchibaldPayRespects import archibaldPayRespects
from AutoGnome import limb_loss
from AutoGnome import autoGnome_malfunction
#from libraryPoints import get_name
#from libraryPoints import award_points
#from libraryPoints import revoke_points
load_dotenv()
token = os.getenv('DISCORD_TOKEN')
client = discord.Client()
players = [
'BARTAVIOUS',
'JAKESKHAKIS247',
'PIGEONANON',
'RANDOMAN',
'QUINNSKY',
'CROWBARSDENY',
'AIRLESSWING'
]
@client.event
async def on_ready():
print(f'{client.user} has connected to Discord!')
game = discord.Game(archibaldPlaying())
await client.change_presence(status = discord.Status.online, activity = game);
@client.event
async def on_message(message):
message_upper = (message.content).upper()
if message.author == client.user:
return
#WIP
'''
if 'LIBRARY POINTS' in message_upper:
if any(a in message_upper for a in players): #got it!
print(a)
member = message.author
#print(member.name)
#await message.channel.send(f' {member.name} has a few library points ')
get_name(member.name)
'''
if message_upper.startswith('BDE'):
bde_item = message.content
bde_response = "In my experiences as an Archivist, %s is approximately %d%% 'Big Dick Energy', as you say." %(bde_item[4:], random.randint(0, 100))
await message.channel.send(bde_response)
elif message_upper.startswith('XYZ'):
numbers = message.content.replace('XYZ ','')
height,distance = numbers.split(',')
hypotenuse = math.sqrt(int(height)**2 + int(distance)**2)
hypnotenuse_answer = 'The target is %d feet away.' %hypotenuse
await message.channel.send(hypnotenuse_answer)
elif 'ANIME' in message_upper:
anime_response = "Uhg, please remove that swill from the library."
await message.channel.send(anime_response)
elif 'AUTOGNOME MALFUNCTION' in message_upper:
#autoGnome_malfunction()
await message.channel.send(autoGnome_malfunction())
if message_upper.endswith('?') and any(x in message_upper for x in catchPhrases):
answer = random.choice(archibaldAnswers)
await message.channel.send(answer)
elif any(x in message_upper for x in catchPhrases):
response = random.choice(archibaldQuotes)
await message.channel.send(response)
elif 'F' == message_upper:
f_response = random.choice(archibaldPayRespects)
await message.channel.send(f_response)
elif 'X' == message_upper:
x_response = random.choice(archibaldDoubt)
await message.channel.send(x_response)
elif message.content == 'raise-exception':
raise discord.DiscordException
async def my_background_task():
await client.wait_until_ready()
while not client.is_closed():
game = discord.Game(archibaldPlaying())
await client.change_presence(status = discord.Status.online, activity = game);
await asyncio.sleep(14400) #4 hours
client.loop.create_task(my_background_task())
client.run(token)