Skip to content

Instantly share code, notes, and snippets.

@Kaleidosium
Created May 23, 2019 09:51
Show Gist options
  • Save Kaleidosium/a1d31a25c6695b6533e360d8b3a68db7 to your computer and use it in GitHub Desktop.
Save Kaleidosium/a1d31a25c6695b6533e360d8b3a68db7 to your computer and use it in GitHub Desktop.
import os
import random
import time
import praw
import discord
from discord.ext import commands
from ebaysdk.exception import ConnectionError
from ebaysdk.finding import Connection as Finding
description = '''TheMcalelBot
Created by alt, Contact them if there's a bug.'''
bot = commands.Bot(command_prefix='$', description=description)
DISCORDTOKEN = ""
EBAYAPPID = ""
reddit = praw.Reddit(client_id='',
client_secret='',
user_agent='',
username='',
password='')
@bot.event
async def on_ready():
print('Logged in as')
print(bot.user.name)
print(bot.user.id)
print('------')
@bot.command()
async def dumbshit(ctx):
"""Prints out screnshots of discord conversations that are dumb"""
# Creates a list of filenames from your folder
imgList = os.listdir("images/")
# Selects a random element from the list
imgString = random.choice(imgList)
path = "images/" + \
imgString # Creates a string for the path to the file
# Sends the image in the channel the command was used
await ctx.send(file=discord.File(path))
@bot.command()
async def mcalel(ctx):
"""Mcalel is gay"""
await ctx.send('Mcalel is gay')
@bot.command()
async def cash(ctx):
"""Cash Money!"""
await ctx.send('Cash Money Baebey!')
@bot.command()
async def quotes(ctx):
"""Random Mcalel quotes"""
quotesdict = [
"I wanna fuck Shulk",
"Alex is a weeaboo",
"Shut up you're gay",
"Hey sexy",
"I'm so tired",
"Nathaniel Bandy is a man child",
"Petch is gay, and mono fucks him",
"Hi"
]
await ctx.send(random.choice(quotesdict))
@bot.command()
async def dankmemes(ctx):
"""Sends dank maymays"""
async def maymays():
submission = reddit.subreddit('dankmemes').random()
return submission
submission = await maymays()
await ctx.send(submission.url)
@bot.command()
async def hackelections(ctx):
"""Hack the Indonesian elections"""
await ctx.send("Hacking Elections...")
time.sleep(50)
await ctx.send("Elections are hacked")
@bot.command()
async def ebay(ctx):
"""Returns a random eBay listing"""
try:
api = Finding(
appid=EBAYAPPID, config_file=None)
my_dict = {
"values": ("computers", "vintage macs", "ibooks", "retro video games", "iphones", "ipads", "macbooks", "nintendo", "nintendo games", "retro games", "video games")
}
x = random.choice(my_dict["values"])
response = api.execute('findItemsAdvanced', {'keywords': x})
print(response.dict())
if int(response.reply.paginationOutput.totalEntries) > 0:
choice = random.choice(response.reply.searchResult.item)
await ctx.send(choice.viewItemURL)
except ConnectionError as e:
print(e)
print(e.response.dict())
bot.run(DISCORDTOKEN)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment