2022-10-03 21:09:32 -04:00
|
|
|
motd ='''
|
|
|
|
_ _ ____ ___ _
|
|
|
|
| | _ _| | ___| __ ) / _ \| |_
|
|
|
|
| | | | | | | |_ / _ \| | | | __|
|
|
|
|
| |__| |_| | |___ / /| |_) | |_| | |_
|
|
|
|
|_____\__,_|_____/___|____/ \___/ \__|
|
|
|
|
'''
|
2022-10-07 23:12:23 -04:00
|
|
|
menu ='''```
|
2022-10-03 21:09:32 -04:00
|
|
|
Commands:
|
|
|
|
fortune: tell a fortune
|
|
|
|
chuck: give a Chuck Norris quote
|
|
|
|
ligma: LIGMA BALLS
|
|
|
|
bofa: deez
|
|
|
|
deez: nutz
|
|
|
|
limerick: tell a limerick
|
|
|
|
prost!: prost!
|
|
|
|
|
|
|
|
Contribute!
|
|
|
|
https://github.com/adoyle0/lulzbot```'''
|
|
|
|
|
2022-10-07 18:51:58 -04:00
|
|
|
import discord, datetime
|
|
|
|
import numpy as np
|
|
|
|
from fortune import fortune
|
2022-10-07 23:12:23 -04:00
|
|
|
from src.twitter import get_tweet
|
|
|
|
from src.cartman import cartman_speak
|
|
|
|
|
2022-10-09 18:25:06 -04:00
|
|
|
chuck_quotes = open('data/chuck_quotes').read().split('\n%\n')
|
|
|
|
ligma_list = open('data/ligma_list').read().split('\n')
|
|
|
|
limericks = open('data/limericks').read().split('\n%\n')
|
2022-10-07 23:12:23 -04:00
|
|
|
|
|
|
|
def show_menu():
|
|
|
|
return menu
|
|
|
|
|
|
|
|
def musk():
|
|
|
|
return get_tweet(44196397)
|
|
|
|
|
|
|
|
def ligma():
|
|
|
|
return np.random.choice(ligma_list)
|
|
|
|
|
2022-10-09 18:25:06 -04:00
|
|
|
def limerick():
|
|
|
|
return np.random.choice(limericks)
|
|
|
|
|
2022-10-07 23:12:23 -04:00
|
|
|
def prost():
|
|
|
|
return 'https://tenor.com/view/prost-christoph-waltz-django-bier-zum-wohle-gif-11041516'
|
|
|
|
|
|
|
|
def chuck():
|
|
|
|
return np.random.choice(chuck_quotes)
|
|
|
|
|
|
|
|
message_handler = {'lulzbot': show_menu, # these need to be functions
|
|
|
|
'musk': musk,
|
|
|
|
'deez': ligma,
|
|
|
|
'ligma': ligma,
|
|
|
|
'bofa': ligma,
|
|
|
|
'bopha': ligma,
|
|
|
|
'limerick': limerick,
|
|
|
|
'limrick': limerick,
|
|
|
|
'prost!': prost,
|
|
|
|
'fortune': fortune,
|
|
|
|
'chuck': chuck,
|
|
|
|
}
|
2022-10-07 18:51:58 -04:00
|
|
|
|
|
|
|
TOKEN = open('.sekrit/discord_token').read()
|
|
|
|
client = discord.Client(activity=discord.Game(name='with myself'))
|
|
|
|
|
2022-09-29 00:24:13 -04:00
|
|
|
@client.event
|
|
|
|
async def on_ready():
|
2022-10-03 20:45:37 -04:00
|
|
|
print(motd+'\n'+datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+'\nLogged in as {0.user}'.format(client))
|
2022-10-07 18:51:58 -04:00
|
|
|
return
|
2022-09-29 00:24:13 -04:00
|
|
|
|
|
|
|
@client.event
|
|
|
|
async def on_message(message):
|
|
|
|
username = str(message.author).split('#')[0]
|
|
|
|
user_message = str(message.content)
|
|
|
|
channel = str(message.channel.name)
|
2022-10-07 23:12:23 -04:00
|
|
|
print(f'{datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")} ({channel}) {username}: {user_message}')
|
2022-09-29 00:24:13 -04:00
|
|
|
|
|
|
|
if message.author == client.user:
|
|
|
|
return
|
|
|
|
|
2022-10-07 23:12:23 -04:00
|
|
|
elif message.channel.name == 'cartman':
|
2022-09-29 00:39:28 -04:00
|
|
|
async with message.channel.typing():
|
2022-10-03 21:09:32 -04:00
|
|
|
await message.channel.send(cartman_speak(user_message))
|
2022-09-29 00:39:28 -04:00
|
|
|
|
2022-10-07 23:12:23 -04:00
|
|
|
elif message.channel.name == 'shitposting':
|
|
|
|
if user_message in message_handler:
|
|
|
|
await message.channel.send(message_handler[user_message]())
|
|
|
|
return
|
2022-09-29 00:24:13 -04:00
|
|
|
|
|
|
|
client.run(TOKEN)
|