Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
chatbot/rias.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
504 lines (336 sloc)
22.5 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import discord | |
import youtube_dl | |
from random import shuffle, randint | |
client = discord.Client() | |
@client.event | |
#-----------------------------------------------------------------------------------------------------------# | |
async def on_ready(): | |
print("[------------------------------------]") | |
print(" Hi, I'm @" + client.user.name + "#" + client.user.discriminator + " nice to meet you!") | |
print("[------------------------------------]") | |
await client.change_presence(game = discord.Game(name = " with your feelings | -help")) | |
#-----------------------------------------------------------------------------------------------------------# | |
# # | |
# https://discordapp.com/api/oauth2/authorize?client_id=460525910073016320&scope=bot&permissions=8 # | |
# # | |
# Joining link # | |
# # | |
# # | |
# FFmpeg for YouTube Integration # | |
# # | |
# sudo add-apt-repository ppa:mc3man/trusty-media # | |
# sudo apt-get update # | |
# sudo apt-get install ffmpeg # | |
# sudo python3.5 -m pip install -U youtube_dl # | |
# # | |
#-----------------------------------------------------------------------------------------------------------# | |
queue = [] | |
@client.event | |
async def on_message(message): | |
#-----------------------------------------------------------------------------------------------------------# | |
# userID = message.author.id | |
# userMention = message.author.mention | |
# userDisplayName = message.author.display_name | |
# userDiscrim = message.author.discriminator | |
#-----------------------------------------------------------------------------------------------------------# | |
#Help section | |
if message.content.lower().startswith("-help"): | |
kappa = message.content.lower().split(" ") | |
if message.content.lower() != "-help": page = kappa[1] | |
else: page = "1" | |
#-----------------------------------------------------------------------------------------------------------# | |
# | |
# Dev Cheat Sheet | |
# | |
# -annoy <number> <msg> - spams <message> <number> times | |
# -say <msg> - says <msg> and deletes the command | |
# -del <number> - delete <number> messages | |
# 42 - mass reaction to any text containing '42' | |
# | |
#-----------------------------------------------------------------------------------------------------------# | |
if page == "dev": | |
await client.send_message(message.channel, """```[=========================================================][Devs Section][=========================================================] | |
-annoy <number> <msg> - spams <message> <number> times | |
-say <msg> - Make the bot say <msg> while deleting your message | |
-del <number> - delete <number> messages | |
42 - mass reaction to any text containing '42' | |
[===========================================================][Page DEV][===========================================================]```""") | |
elif page == "1": | |
await client.send_message(message.channel, """```[=========================================================][Help Section][=========================================================] | |
-help <page> - Displays corresponding help page. | |
-ping - Pong! Classic. | |
-avatar <name> - Check out someone's profile picture without having to download it and zoom in. | |
-roll <dice> - Roll a D4 / D6 / D8 / D10 / D100 / D12 / D20 / D∞ dice. | |
-joke - Tell a joke! | |
@random - Mention a random person. | |
[===========================================================][Page 1/3][===========================================================]```""") | |
elif page == "2": | |
await client.send_message(message.channel, """```[=========================================================][Help Section][=========================================================] | |
-role <role> - Make your name colorful by self-assigning a role with the desired color's name. | |
#Supported Colors: (dark_)green, (dark_)blue, (dark_)purple, (dark_)pink, (dark_)yellow, (dark_)orange, (dark_)red, | |
(dark_)gray, black, white | |
-lfg - Looking for group feature. | |
#Subcommands of -lfg: | |
-lfg <game> - Find a party for <game>. When there are enough people to form a full party or the start command has been | |
issued, yourself and the party members will automatically join a temporary voice channel which will be deleted once the | |
party has been disbanded or once every member has left the channel. | |
-lfg start - Mark the party as ready and get right into it. | |
-lfg disband - Disband the party immediately. | |
-lfg list - List all active parties. | |
[===========================================================][Page 2/3][===========================================================]```""") | |
elif page == "3": | |
await client.send_message(message.channel, """```[=========================================================][Help Section][=========================================================] | |
-music - Play music straight from YouTube. | |
Subcommands of -music: | |
-music add <link> - Add a youtube song link to the Queue. | |
-music remove <link> - Remove a certain song from the Queue. | |
-music list - View the current Queue. | |
-music clear - Clear the current Queue. | |
-music join - Tell the bot to join your channel in order to play music | |
-music leave - Tell the bot to leave your channel. | |
-music play - Play music from the current Queue. | |
-music shuffle - Shuffle the current Queue. | |
-music skip - Skip the current song. | |
[===========================================================][Page 3/3][===========================================================]```""") | |
userDisplayName = message.author.display_name | |
userDiscrim = message.author.discriminator | |
print("@" + userDisplayName + "#" + userDiscrim, "executed -help " + page + ".") | |
#-----------------------------------------------------------------------------------------------------------# | |
#ping | |
elif message.content.lower().startswith("-ping"): | |
await client.send_message(message.channel, "Pong! haha") | |
userDisplayName = message.author.display_name | |
userDiscrim = message.author.discriminator | |
print("@" + userDisplayName + "#" + userDiscrim, "executed -ping.") | |
#-----------------------------------------------------------------------------------------------------------# | |
#jokes | |
elif message.content.lower().startswith("-joke"): | |
rand = randint(0,9); | |
if rand == 0: # | |
await client.send_message(message.channel, """Why did the chicken cross the road? | |
To get to the other side.""") | |
elif rand == 1: # | |
await client.send_message(message.channel, """Why do keyboards work 24/7? | |
Because they have two shifts.""") | |
elif rand == 2: # | |
await client.send_message(message.channel, """What days do fish dislike the most? | |
Fry-Days!.""") | |
elif rand == 3: # | |
await client.send_message(message.channel, "I don't know. You tell me.") | |
elif rand == 4: # | |
await client.send_message(message.channel, """What kind of music is a balloon scared of? | |
Pop music.""") | |
elif rand == 5: # | |
await client.send_message(message.channel, """What do you call the security outside of a Samsung Store? | |
Guardians of the Galaxy.""") | |
elif rand == 6: # | |
await client.send_message(message.channel, """Want a bad joke? | |
Look in the mirror.""") | |
elif rand == 7: # | |
await client.send_message(message.channel, """What do you call a bee that was born is the United States? | |
A USB.""") | |
elif rand == 8: # | |
await client.send_message(message.channel, """What do you call a cow in an earthquake? | |
A milkshake.""") | |
elif rand == 9: # | |
await client.send_message(message.channel, """Where do animals go when their tails fall off? | |
The retail store.""") | |
userDisplayName = message.author.display_name | |
userDiscrim = message.author.discriminator | |
print("@" + userDisplayName + "#" + userDiscrim, "executed -joke.") | |
#-----------------------------------------------------------------------------------------------------------# | |
#keep for future reference on mentions | |
#elif message.content.startswith("-ur bad"): | |
#await client.send_message(message.channel, "{} no u".format(userMention)) | |
#-----------------------------------------------------------------------------------------------------------# | |
#@random | |
elif message.content.startswith('@random'): | |
mem = [""] | |
for i in message.channel.server.members: | |
mem.append(i) | |
shuffle(mem) | |
usr = mem[1] | |
await client.send_message(message.channel, "{}".format(usr.mention)) | |
#x = message.server.members | |
#shuffle(x) | |
#print(x) | |
#await client.send_message(message.channel, "{}".format(message.x[0].mention)) | |
userDisplayName = message.author.display_name | |
userDiscrim = message.author.discriminator | |
print("@" + userDisplayName + "#" + userDiscrim, "executed @random.") | |
#-----------------------------------------------------------------------------------------------------------# | |
#Display Avatar | |
elif message.content.lower().startswith("-avatar"): | |
#kappa = message.content.lower().split(" ") | |
#await client.send_message(message.channel, kappa[1]) | |
#remember, the mention is kappa[1] | |
for member in message.mentions: | |
avatar_pic = member.avatar_url | |
await client.send_message(message.channel, member.avatar_url) | |
userDisplayName = message.author.display_name | |
userDiscrim = message.author.discriminator | |
print("@" + userDisplayName + "#" + userDiscrim, "executed -avatar.") | |
#-----------------------------------------------------------------------------------------------------------# | |
#YEET | |
elif "42" in message.content.lower() and "devs section" not in message.content.lower(): | |
yeets = ["a:Yeet:499769892388470794", ":yasuo:499769893349228553", ":yandere:499769884209709062", ":whut:499769897811836939", ":vayne:499769893915197440", ":uganda:499769873417895937", ":thonk:499769874143248404", "a:squidward:499769896343830538", ":soraka:499769895236534282", "a:patrick:499769897711173633", ":pandaJuice:499769894779355156", ":pandaHappy:499769892652974081", ":owocry:499773139522289670", ":noose:499769879231201280", ":lmfao:499769893793562626", ":kata2:499769895911948289", ":isaac:499769873702846464", ":fuckYou:499769873526816778", ":eggplantThink:499769897413378058", ":diamond2:499769874898354186", "a:bowing:499769874784976896", "a:boi:499769897275097088", "a:banana:499769874243911681", ":androidKiss:499769873547919380", ":ahri:499769892690722816", ":diamond:499769888907198482"] | |
shuffle(yeets) | |
for i in range(0,20): | |
await client.add_reaction(message, yeets[i]) | |
userDisplayName = message.author.display_name | |
userDiscrim = message.author.discriminator | |
print("@" + userDisplayName + "#" + userDiscrim, "knows The answer to life the universe and everything.") | |
#-----------------------------------------------------------------------------------------------------------# | |
#role | |
elif message.content.lower().startswith("-role"): | |
args = message.content.lower().split(' ') | |
role = "" | |
if len(args) > 1: | |
role = args[1] | |
matches = [x for x in message.server.roles if x.name.lower() == role.lower()] | |
if matches: | |
await client.add_roles(message.author, matches[0]) | |
await client.send_message(message.channel, "You are now " + matches[0]) | |
userDisplayName = message.author.display_name | |
userDiscrim = message.author.discriminator | |
print("@" + userDisplayName + "#" + userDiscrim, "executed -role.") | |
#-----------------------------------------------------------------------------------------------------------# | |
#roll | |
elif message.content.lower().startswith("-roll") or message.content.lower().startswith("-dice"): | |
dice = message.content.lower().split(' ') | |
#D4 / D6 / D8 / D10 / D00 / D12 / D20 / D∞ | |
if dice[1] == "d4": | |
roll = randint(1, 4) | |
await client.send_message(message.channel, "You've just rolled a " + str(roll) + "!") | |
elif dice[1] == "d6": | |
roll = randint(1, 6) | |
await client.send_message(message.channel, "You've just rolled a " + str(roll) + "!") | |
elif dice[1] == "d8": | |
roll = randint(1, 8) | |
await client.send_message(message.channel, "You've just rolled a " + str(roll) + "!") | |
elif dice[1] == "d10": | |
roll = randint(1, 10) | |
await client.send_message(message.channel, "You've just rolled a " + str(roll) + "!") | |
elif dice[1] == "d100": | |
roll = randint(1, 10) | |
roll *= 10 | |
await client.send_message(message.channel, "You've just rolled a " + str(roll) + "!") | |
elif dice[1] == "d12": | |
roll = randint(1, 12) | |
await client.send_message(message.channel, "You've just rolled a " + str(roll) + "!") | |
elif dice[1] == "d20": | |
roll = randint(1, 20) | |
await client.send_message(message.channel, "You've just rolled a " + str(roll) + "!") | |
elif dice[1] == "d∞": | |
await client.send_message(message.channel, "You've just rolled ∞. And got away with it.") | |
userDisplayName = message.author.display_name | |
userDiscrim = message.author.discriminator | |
print("@" + userDisplayName + "#" + userDiscrim, "executed -roll with a " + dice[1].upper() + " and got " + str(rand) + "." ) | |
#-----------------------------------------------------------------------------------------------------------# | |
#annoy | |
elif message.content.lower().startswith("-annoy"): | |
userMention = message.content.split(' ') | |
msg = "" | |
nr = userMention[1] | |
for i in range(0, int(nr) ): | |
for c in range(2, len(userMention)): | |
msg += userMention[c] | |
msg += " " | |
await client.send_message(message.channel, "{} ".format(userMention[1]) + msg) | |
await asyncio.sleep(0.4) | |
msg = "" | |
userDisplayName = message.author.display_name | |
userDiscrim = message.author.discriminator | |
print("@" + userDisplayName + "#" + userDiscrim, "executed -annoy.") | |
#-----------------------------------------------------------------------------------------------------------# | |
#say bot -- credits to @MyStackOverflows for idea | |
elif message.content.lower().startswith("-say"): | |
userMention = message.content.split(' ') | |
msg = "" | |
await client.delete_message(message) | |
for c in range(1, len(userMention)): | |
msg += userMention[c] | |
msg += " " | |
await client.send_message(message.channel, msg) | |
msg = "" | |
userDisplayName = message.author.display_name | |
userDiscrim = message.author.discriminator | |
print("@" + userDisplayName + "#" + userDiscrim, "executed -say") | |
#-----------------------------------------------------------------------------------------------------------# | |
#Looking For Group | |
elif message.content.lower().startswith("-lfg"): | |
game = message.content.lower().split(' ') | |
parties = {} | |
key = randing(255,1337) | |
#-----------------------------------------------------------------------------------------------------------# | |
#Talk to the bot (briefly) | |
elif client.user in message.mentions: | |
greet = ["heyyy", "hola", "hello", "hi", "hyia", "hey"] | |
sup = ["sup", "wassup", "what's up", "whats up", "what is up"] | |
sup_response = ["I'm fine", "Good, you?", "nm", "nothin much", "yknow.. chillin", "chillin"] | |
moods = ["im good", "fine", "doin fine", "doing fine", "I'm good", "im doing fine", "im fine", "im doin fine", "im doing great", "im great", "awesome", "im alright", "alright", "its alright", "everythings good", "everything's good", "good", "ok"] | |
moods_response = ["cool!", "that's lovely", "great", "nice", "that's fine", "that's alright", "sweet"] | |
if greet[0] in message.content.lower() or greet[1] in message.content.lower() or greet[2] in message.content.lower() or greet[3] in message.content.lower() or greet[4] in message.content.lower() or greet[5] in message.content.lower(): | |
r = randint(0,6) | |
await client.send_message(message.channel, greet[r]) | |
elif sup[0] in message.content.lower() or sup[1] in message.content.lower() or sup[2] in message.content.lower() or sup[3] in message.content.lower() or sup[4] in message.content.lower(): | |
r = randint(0,6) | |
await client.send_message(message.channel, sup_response[r]) | |
elif moods[0] in message.content.lower() or moods[1] in message.content.lower() or moods[2] in message.content.lower() or moods[3] in message.content.lower() or moods[4] in message.content.lower() or moods[3] in message.content.lower() or moods[3] in message.content.lower() or moods[3] in message.content.lower() or moods[3] in message.content.lower() or moods[3] in message.content.lower() or moods[3] in message.content.lower() or moods[3] in message.content.lower() or moods[3] in message.content.lower() or moods[3] in message.content.lower() or moods[3] in message.content.lower() or moods[3] in message.content.lower() or moods[3] in message.content.lower() or moods[3] in message.content.lower() or moods[3] in message.content.lower(): | |
r = randint(0,6) | |
await client.send_message(message.channel, sup_response[r]) | |
userDisplayName = message.author.display_name | |
userDiscrim = message.author.discriminator | |
print("@" + userDisplayName + "#" + userDiscrim, "talked to me!") | |
#-----------------------------------------------------------------------------------------------------------# | |
#Delete | |
elif message.content.lower().startswith("-del"): | |
nr = message.content.lower().split(' ') | |
async for msg in client.logs_from(message.channel, limit = int(nr[1]) + 1): | |
await client.delete_message(msg) | |
await asyncio.sleep(0.4) | |
#-----------------------------------------------------------------------------------------------------------# | |
#YouTube Integration using youtube_dl | |
elif message.content.lower().startswith("-music"): | |
global queue | |
args = message.content.lower().split(' ') | |
arg = args[1] | |
if arg == "add": | |
link = args[2] | |
queue.append(link) | |
elif arg == "remove": | |
link = args[2] | |
queue.remove(link) | |
elif arg == "list": | |
if not queue: | |
await client.send_message(message.channel, "- The Queue is empty -") | |
else: | |
await client.send_message(message.channel, queue) | |
elif arg == "clear": | |
queue = [] | |
elif arg == "join": | |
await client.join_voice_channel(message.author.voice.voice_channel) | |
elif arg == "leave": | |
server = message.server | |
voice_client = client.voice_client_in(server) | |
await voice_client.disconnect() | |
elif arg == "play": #SOLO PLAYER - NO QUEUE FUNCTIONALITY ADDED - USE -music play <link> | |
link = args[2] | |
server = message.server | |
voice_client = client.voice_client_in(server) | |
player = await voice_client.create_ytdl_player(link) | |
player.start() | |
elif arg == "shuffle": | |
shuffle(queue) | |
elif arg == "skip": | |
pass | |
#-----------------------------------------------------------------------------------------------------------# | |
#Logout | |
elif message.content.lower().startswith("-leave"): | |
#await client.send_message(message.channel, "Nyaa~ I have to leave-desu nya~") | |
userDisplayName = message.author.display_name | |
userDiscrim = message.author.discriminator | |
print("@" + userDisplayName + "#" + userDiscrim, "executed -leave.") | |
await client.logout() | |
#-----------------------------------------------------------------------------------------------------------# |