Skip to content

Instantly share code, notes, and snippets.

@Kaleidosium
Created June 17, 2019 13:34
Show Gist options
  • Save Kaleidosium/8e3f830812ff9c16ecdcae18ce31ae53 to your computer and use it in GitHub Desktop.
Save Kaleidosium/8e3f830812ff9c16ecdcae18ce31ae53 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 discord.utils import get
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('------')
await bot.change_presence(activity=discord.Game(name="$"))
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
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()
@commands.cooldown(1, 10, commands.BucketType.user)
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()
@commands.cooldown(1, 10, commands.BucketType.user)
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()
@commands.cooldown(1, 10, commands.BucketType.user)
async def hackelections(ctx):
"""Hack the Indonesian elections"""
await ctx.send("Hacking Elections...")
time.sleep(50)
await ctx.send("Elections are hacked")
@bot.command()
@commands.cooldown(1, 10, commands.BucketType.user)
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.command()
@commands.cooldown(1, 10, commands.BucketType.user)
async def randomcase(ctx, *, arg):
"""Randomize Capitalization"""
await ctx.send(''.join(random.choice((str.upper, str.lower))(c) for c in arg))
@bot.command(pass_context=True)
@commands.cooldown(1, 10, commands.BucketType.user)
async def setpronouns(ctx, *, arg):
"""Sets your pronouns"""
userargument = arg.lower()
if userargument == "he":
user = ctx.message.author
role = ctx.guild.get_role(583896997082431518)
await user.add_roles(role)
await ctx.send("Role set!")
elif userargument == "she":
user = ctx.message.author
role = ctx.guild.get_role(583897195716018176)
await user.add_roles(role)
await ctx.send("Role set!")
elif userargument == "they":
user = ctx.message.author
role = ctx.guild.get_role(536059250154274816)
await user.add_roles(role)
await ctx.send("Role set!")
else:
await ctx.send("""
```
Help Commands:
He : Sets your role to He/Him
She : Sets your role to She/Her
They: Sets your role to They/Them```""")
bot.run(DISCORDTOKEN)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment