new cleanup a new era for doge

This commit is contained in:
RustyRaptor committed 2020-10-11 23:34:45 -06:00
1 parent 33baa8d097
commit 881cb7e49f
10 files changed
+738 -119

No files matched your search

+2 -3
View File
@@ -1,4 +1,3 @@
# .env
DISCORD_TOKEN=NjYyMzQ1OTg3Mzg5NTIxOTcw.Xg5kVQ.P1KdU_x8gJeN5gXw1hYSCos1mlM
DISCORD_TOKEN=NjYyMzQ1OTg3Mzg5NTIxOTcw.Xim4EA.D9cUJAFHx1EAk6m3SCm2H2wA3b0
MEME=[A, B, C]
+4 -4
View File
@@ -1,8 +1,8 @@
# Project exclude paths
/venv/
.env
/memes/
/images/
/sounds/
/memerand/
/dorimepic/
/cheems/
/.idea/
/PokeDoges/
PokeDoges.csv
+6
View File
@@ -0,0 +1,6 @@
Young Kabosu,https://i.imgur.com/ARYCyAH.jpg,100,100,100,wow,such,meme,bork,Neutral Good,original doge: Kabosu copies the opponents ability
Ancient Kabosu,https://i.imgur.com/J4t66yC.jpg,150,150,150,wow,wisdom,hyper meme,howl,Neutral Good,Wisdom Of A Decade: Old Kabosu's wisdom attack ignores enemy defense stats.
Smart Doge,https://i.imgur.com/JiU9XMp.png,70,90,50,thonk,meme,bork,howl,Lawful Good,Smort: Smart Doge studies very hard and gains double the usual xp in battle
Cheems,https://i.imgur.com/6oVqW7u.jpg,90,100,80,cheemsburger,meme,bork,howl,Neutral Evil,Speemch Impemdiment: Cheems confuses his foe with distorted speech lowering the foe's accuracy
King Cheems,https://i.imgur.com/tJydAdk.jpg,100,90,120,Cheems Army,meme,bork,howl,Lawful Evil,Dorime Chants: King Cheems is immune to all chaotic type attacks.
Dzhem,https://i.imgur.com/FGwHvE2.jpg,120,60,110,Intimidating Selfie,Party Hard,Master Chef,meme,Chaotic Neutral,Turkish Coffee: Dzhem is immune to sleep moves.
1 Young Kabosu https://i.imgur.com/ARYCyAH.jpg 100 100 100 wow such meme bork Neutral Good original doge: Kabosu copies the opponents ability
2 Ancient Kabosu https://i.imgur.com/J4t66yC.jpg 150 150 150 wow wisdom hyper meme howl Neutral Good Wisdom Of A Decade: Old Kabosu's wisdom attack ignores enemy defense stats.
3 Smart Doge https://i.imgur.com/JiU9XMp.png 70 90 50 thonk meme bork howl Lawful Good Smort: Smart Doge studies very hard and gains double the usual xp in battle
4 Cheems https://i.imgur.com/6oVqW7u.jpg 90 100 80 cheemsburger meme bork howl Neutral Evil Speemch Impemdiment: Cheems confuses his foe with distorted speech lowering the foe's accuracy
5 King Cheems https://i.imgur.com/tJydAdk.jpg 100 90 120 Cheems Army meme bork howl Lawful Evil Dorime Chants: King Cheems is immune to all chaotic type attacks.
6 Dzhem https://i.imgur.com/FGwHvE2.jpg 120 60 110 Intimidating Selfie Party Hard Master Chef meme Chaotic Neutral Turkish Coffee: Dzhem is immune to sleep moves.
+3
View File
@@ -0,0 +1,3 @@
a,a,a,a,a,a,a,a,a
a,a,a,a,a,a,a,a,a
v,v,v,v,v,v,v,v,v,v
1 a,a,a,a,a,a,a,a,a
2 a,a,a,a,a,a,a,a,a
3 v,v,v,v,v,v,v,v,v,v
+234
View File
@@ -0,0 +1,234 @@
from tweepy import OAuthHandler
from tweepy import API
from tweepy import Cursor
from datetime import datetime, date, time, timedelta
from collections import Counter
import sys
import csv
import asyncio
import os
import random
import requests
import discord
import youtube_dl
from discord.ext import commands
from discord.ext.commands import bot
from dotenv import load_dotenv
# consumer_key=""
# consumer_secret=""
# access_token=""
# access_token_secret=""
#
# auth = OAuthHandler(consumer_key, consumer_secret)
# auth.set_access_token(access_token, access_token_secret)
# auth_api = API(auth)
# Suppress noise about console usage from errors
# with open('memes.csv', newline="\n" as csvfile):
# spamreader = csv.reader(csvfile, delimiter=",")
# for row in spamreader:
# print(', '.join(row))
load_dotenv(verbose=True)
youtube_dl.utils.bug_reports_message = lambda: ''
ytdl_format_options = {
'format': 'bestaudio/best',
'outtmpl': '%(extractor)s-%(id)s-%(title)s.%(ext)s',
'restrictfilenames': True,
'noplaylist': True,
'nocheckcertificate': True,
'ignoreerrors': False,
'logtostderr': False,
'quiet': True,
'no_warnings': True,
'default_search': 'auto',
'source_address': '0.0.0.0' # bind to ipv4 since ipv6 addresses cause issues sometimes
}
ffmpeg_options = {
'options': '-vn'
}
ytdl = youtube_dl.YoutubeDL(ytdl_format_options)
class YTDLSource(discord.PCMVolumeTransformer):
def __init__(self, source, *, data, volume=0.5):
super().__init__(source, volume)
self.data = data
self.title = data.get('title')
self.url = data.get('url')
@classmethod
async def from_url(cls, url, *, loop=None, stream=False):
loop = loop or asyncio.get_event_loop()
data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=not stream))
if 'entries' in data:
# take first item from a playlist
data = data['entries'][0]
filename = data['url'] if stream else ytdl.prepare_filename(data)
return cls(discord.FFmpegPCMAudio(filename, **ffmpeg_options), data=data)
def get_sound(key):
# sounds = {
# "eggs": "eggs.ogg",
# "semx": "moan.ogg",
# "crabrave": random.choice([
# "crab.opus",
# "crabrave_smb.opus",
# "crabmetal.opus",
# "crabali.opus",
# "crabsans.opus",
# "crabgod.opus"])
# }
path = random.choice(os.listdir("sounds/" + key)) # change dir name to whatever
return "sounds/" + key + "/" + path
dorimes = [
"https://youtu.be/f6jvnmyYpl8",
"https://www.youtube.com/watch?v=hCzfzeobeNM",
"https://www.youtube.com/watch?v=kLaaJ_aeoyM",
"https://www.youtube.com/watch?v=zQ4LiyFF8RU",
"https://www.youtube.com/watch?v=6xUnSVTh8fI"
]
def get_video(source):
cheemses = [
"https://www.youtube.com/channel/UChZWowQd_y6usuF7vSL4jmA"
]
channels = [
"https://www.youtube.com/channel/UCYd6CmhFvvq6yruUBmGXjuA/videos",
"https://www.youtube.com/channel/UCX2laRqGQhqoChYmlaUgOiw/videos",
"https://www.youtube.com/user/wettitab/videos",
"https://www.youtube.com/channel/UC38r7_x7oMPAZweB2fvGDXQ/videos",
"https://www.youtube.com/channel/UC-xjitW_J39_Q1ure2HlJew/videos",
"https://www.youtube.com/channel/UCHh-cQr-viOcimjPhxr3xRQ/videos",
"https://www.youtube.com/channel/UCAJI1a4L0R5HkvTHTxZOd6g/videos",
"https://www.youtube.com/user/shibainusaki/videos",
"https://www.youtube.com/channel/UCOE2s_EwBM0es4TfC6ce7Fg/videos",
"https://www.youtube.com/channel/UCkEdaRw8w0daEvGgzKff8TA",
"https://www.youtube.com/channel/UC_WUkVnPROmHC1qnGHQAMDA",
"https://www.youtube.com/channel/UChZWowQd_y6usuF7vSL4jmA"
]
sources = {
"shibes": channels,
"cheems": cheemses
}
all_vids = []
for i in sources[source]:
url = i
page = requests.get(url).content
data = str(page).split(' ')
item = 'href="/watch?'
vids = [line.replace('href="', 'youtube.com') for line in data if
item in line] # list of all videos listed twice
all_vids.extend(vids)
return random.choice(all_vids)
class Music(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def help(self, ctx):
await ctx.send("Something big is coming...")
@commands.command()
async def join(self, ctx, *, channel: discord.VoiceChannel):
await ctx.send("Something big is coming...")
@commands.command()
async def shibe(self, ctx):
await ctx.send("Something big is coming...")
@commands.command()
async def cbt(self, ctx):
await ctx.send("Something big is coming...")
@commands.command()
async def cheems(self, ctx):
await ctx.send("Something big is coming...")
@commands.command(aliases=['EGGS', 'eggs', 'Eggs'])
async def play(self, ctx, args="eggs"):
await ctx.send("Something big is coming...")
@commands.command()
async def yt(self, ctx, *, url):
await ctx.send("Something big is coming...")
@commands.command()
async def stream(self, ctx, *, url):
await ctx.send("Something big is coming...")
@commands.command()
async def volume(self, ctx, volume: int):
await ctx.send("Something big is coming...")
@commands.command()
async def stop(self, ctx):
await ctx.send("Something big is coming...")
@commands.command()
async def emote(self, ctx, arg):
await ctx.send("Something big is coming...")
@commands.command()
async def meme(self, ctx):
await ctx.send("Something big is coming...")
@commands.command()
async def memerand(self, ctx):
await ctx.send("Something big is coming...")
@play.before_invoke
@yt.before_invoke
@stream.before_invoke
async def ensure_voice(self, ctx):
if ctx.voice_client is None:
if ctx.author.voice:
await ctx.author.voice.channel.connect()
else:
await ctx.send("You are not connected to a voice channel.")
raise commands.CommandError("Author not connected to a voice channel.")
elif ctx.voice_client.is_playing():
ctx.voice_client.stop()
bot = commands.Bot(command_prefix=commands.when_mentioned_or("doge!"),
description='Karen, release me from this discord bot immediately!')
bot.remove_command('help')
@bot.event
async def on_ready():
print('Logged in as {0} ({0.id})'.format(bot.user))
print('------')
bot.add_cog(Music(bot))
bot.run(os.getenv("DISCORD_TOKEN"))
+6
View File
@@ -0,0 +1,6 @@
import csv
with open("PokeDoges.csv", newline='\n') as csvfile:
spamreader = csv.reader(csvfile, delimiter=',')
for row in spamreader:
print(', '.join(row))
+83
View File
@@ -0,0 +1,83 @@
import discord
from discord.ext import commands
import random
description = '''An example bot to showcase the discord.ext.commands extension
module.
There are a number of utility commands being showcased here.'''
bot = commands.Bot(command_prefix='?', description=description)
@bot.event
async def on_ready():
print('Logged in as')
print(bot.user.name)
print(bot.user.id)
print('------')
@bot.event
async def on_message(message):
if not message.author.bot:
await message.delete()
await message.channel.send('Horny post neutralized. Awaiting your command, master')
@bot.command()
async def add(ctx, left: int, right: int):
"""Adds two numbers together."""
await ctx.send(left + right)
@bot.command()
async def roll(ctx, dice: str):
"""Rolls a dice in NdN format."""
try:
rolls, limit = map(int, dice.split('d'))
except Exception:
await ctx.send('Format has to be in NdN!')
return
result = ', '.join(str(random.randint(1, limit)) for r in range(rolls))
await ctx.send(result)
@bot.command(description='For when you wanna settle the score some other way')
async def choose(ctx, *choices: str):
"""Chooses between multiple choices."""
await ctx.send(random.choice(choices))
@bot.command()
async def repeat(ctx, times: int, content='repeating...'):
"""Repeats a message multiple times."""
for i in range(times):
await ctx.send(content)
@bot.command()
async def joined(ctx, member: discord.Member):
"""Says when a member joined."""
await ctx.send('{0.name} joined in {0.joined_at}'.format(member))
@bot.group()
async def cool(ctx):
"""Says if a user is cool.
In reality this just checks if a subcommand is being invoked.
"""
if ctx.invoked_subcommand is None:
await ctx.send('No, {0.subcommand_passed} is not cool'.format(ctx))
@cool.command(name='bot')
async def _bot(ctx):
"""Is the bot cool?"""
await ctx.send('Yes, the bot is cool.')
bot.run('NjYyMzQ1OTg3Mzg5NTIxOTcw.Xim4EA.D9cUJAFHx1EAk6m3SCm2H2wA3b0')
File renamed without changes.
View File
File renamed without changes.
+400 -112
View File
@@ -1,105 +1,131 @@
from tweepy import OAuthHandler
from tweepy import API
from tweepy import Cursor
from datetime import datetime, date, time, timedelta
from collections import Counter
import sys
import mimetypes
import asyncio
import time
import aiofiles
import argparse
import os
import random
import requests
import discord
import youtube_dl
from discord.ext import commands
from os.path import join, getsize
# Example posting a local image file:
from aiohttp_requests import requests
from PIL import Image
from discord.ext.commands import bot
from dotenv import load_dotenv
# consumer_key=""
# consumer_secret=""
# access_token=""
# access_token_secret=""
#
# auth = OAuthHandler(consumer_key, consumer_secret)
# auth.set_access_token(access_token, access_token_secret)
# auth_api = API(auth)
# Suppress noise about console usage from errors
youtube_dl.utils.bug_reports_message = lambda: ''
load_dotenv(verbose=True)
youtube_dl.utils.bug_reports_message = lambda: ""
ytdl_format_options = {
'format': 'bestaudio/best',
'outtmpl': '%(extractor)s-%(id)s-%(title)s.%(ext)s',
'restrictfilenames': True,
'noplaylist': True,
'nocheckcertificate': True,
'ignoreerrors': False,
'logtostderr': False,
'quiet': True,
'no_warnings': True,
'default_search': 'auto',
'source_address': '0.0.0.0' # bind to ipv4 since ipv6 addresses cause issues sometimes
"format": "bestaudio/best",
"outtmpl": "%(extractor)s-%(id)s-%(title)s.%(ext)s",
"restrictfilenames": True,
"noplaylist": False,
"nocheckcertificate": True,
"ignoreerrors": True,
"logtostderr": True,
"quiet": False,
"no_warnings": False,
"default_search": "auto",
"source_address": "0.0.0.0"
# bind to ipv4 since ipv6 addresses cause issues sometimes
}
ffmpeg_options = {
'options': '-vn'
}
ffmpeg_options = {"options": "-vn"}
ytdl = youtube_dl.YoutubeDL(ytdl_format_options)
# check if a string is an int
def RepresentsInt(s):
try:
int(s)
return True
except ValueError:
return False
# [START tts_synthesize_text]
def synthesize_text(text):
"""Synthesizes speech from the input string of text."""
from google.cloud import texttospeech
client = texttospeech.TextToSpeechClient()
input_text = texttospeech.SynthesisInput(text=text)
# Note: the voice can also be specified by name.
# Names of voices can be retrieved with client.list_voices().
voice = texttospeech.VoiceSelectionParams(
language_code="en-US",
name="en-US-Standard-C",
ssml_gender=texttospeech.SsmlVoiceGender.FEMALE,
)
audio_config = texttospeech.AudioConfig(
audio_encoding=texttospeech.AudioEncoding.MP3
)
response = client.synthesize_speech(
request={"input": input_text, "voice": voice,
"audio_config": audio_config}
)
# The response's audio_content is binary.
with open("output.mp3", "wb") as out:
out.write(response.audio_content)
print('Audio content written to file "output.mp3"')
# [END tts_synthesize_text]
class YTDLSource(discord.PCMVolumeTransformer):
def __init__(self, source, *, data, volume=0.5):
super().__init__(source, volume)
self.data = data
self.title = data.get('title')
self.url = data.get('url')
self.title = data.get("title")
self.url = data.get("url")
@classmethod
async def from_url(cls, url, *, loop=None, stream=False):
loop = loop or asyncio.get_event_loop()
data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=not stream))
data = await loop.run_in_executor(
None, lambda: ytdl.extract_info(url, download=not stream)
)
if 'entries' in data:
if "entries" in data:
# take first item from a playlist
data = data['entries'][0]
data = data["entries"][0]
filename = data['url'] if stream else ytdl.prepare_filename(data)
return cls(discord.FFmpegPCMAudio(filename, **ffmpeg_options), data=data)
filename = data["url"] if stream else ytdl.prepare_filename(data)
return cls(discord.FFmpegPCMAudio(filename, **ffmpeg_options),
data=data)
def get_sound(key):
# sounds = {
# "eggs": "eggs.ogg",
# "semx": "moan.ogg",
# "crabrave": random.choice([
# "crab.opus",
# "crabrave_smb.opus",
# "crabmetal.opus",
# "crabali.opus",
# "crabsans.opus",
# "crabgod.opus"])
# }
path = random.choice(os.listdir("sounds/" + key)) # change dir name to whatever
path = random.choice(
os.listdir("sounds/" + key)) # change dir name to whatever
return "sounds/" + key + "/" + path
dorimes = [
"https://youtu.be/f6jvnmyYpl8",
"https://www.youtube.com/watch?v=hCzfzeobeNM",
"https://www.youtube.com/watch?v=kLaaJ_aeoyM",
"https://www.youtube.com/watch?v=zQ4LiyFF8RU",
"https://www.youtube.com/watch?v=6xUnSVTh8fI"
"https://www.youtube.com/watch?v=6xUnSVTh8fI",
]
def get_video(source):
cheemses = [
"https://www.youtube.com/channel/UChZWowQd_y6usuF7vSL4jmA"
]
cheemses = ["https://www.youtube.com/channel/UChZWowQd_y6usuF7vSL4jmA"]
channels = [
"https://www.youtube.com/channel/UCYd6CmhFvvq6yruUBmGXjuA/videos",
"https://www.youtube.com/channel/UCX2laRqGQhqoChYmlaUgOiw/videos",
@@ -112,46 +138,77 @@ def get_video(source):
"https://www.youtube.com/channel/UCOE2s_EwBM0es4TfC6ce7Fg/videos",
"https://www.youtube.com/channel/UCkEdaRw8w0daEvGgzKff8TA",
"https://www.youtube.com/channel/UC_WUkVnPROmHC1qnGHQAMDA",
"https://www.youtube.com/channel/UChZWowQd_y6usuF7vSL4jmA"
"https://www.youtube.com/channel/UChZWowQd_y6usuF7vSL4jmA",
]
sources = {
"shibes": channels,
"cheems": cheemses
}
sources = {"shibes": channels, "cheems": cheemses}
all_vids = []
for i in sources[source]:
url = i
page = requests.get(url).content
data = str(page).split(' ')
data = str(page).split(" ")
item = 'href="/watch?'
vids = [line.replace('href="', 'youtube.com') for line in data if
item in line] # list of all videos listed twice
vids = [
line.replace('href="', "youtube.com") for line in data if
item in line
] # list of all videos listed twice
all_vids.extend(vids)
return random.choice(all_vids)
def get_emote(name):
emote = ""
for i in bot.emojis:
if i.name == str(name):
emote = str(i)
return emote
class Music(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def help(self, ctx):
embed = discord.Embed(title="DOGE BOT COMMANDS", description="command prefix is doge! e.g. doge!meme",
color=0xe8e361)
embed.set_author(name="GodEmperorDoge", url="https://www.github.com/rustyraptor")
embed = discord.Embed(
title="DOGE BOT COMMANDS",
description="command prefix is doge! e.g. " "doge!meme",
color=0xE8E361,
)
embed.set_author(
name="GodEmperorDoge", url="https://www.github.com/rustyraptor"
)
embed.set_thumbnail(url="https://i.imgur.com/ddy9MGr.jpg")
embed.add_field(name="meme", value="fetch a random doge meme or template", inline=False)
embed.add_field(name="memerand", value="fetch a random image", inline=False)
embed.add_field(name="shibe", value="get a cute or funny shibe video", inline=False)
embed.add_field(name="play", value="play a sound (for list of sounds type doge!playlist", inline=False)
embed.add_field(name="yt", value="play a youtube video link", inline=False)
embed.add_field(name="volume", value="adjust volume to n%", inline=False)
embed.add_field(
name="meme", value="fetch a random doge meme or template",
inline=False
)
embed.add_field(name="memerand", value="fetch a random image",
inline=False)
embed.add_field(
name="shibe", value="get a cute or funny shibe video", inline=False
)
embed.add_field(
name="play",
value="play a sound (for list of sounds type " "doge!playlist",
inline=False,
)
embed.add_field(name="yt", value="play a youtube video link",
inline=False)
embed.add_field(name="volume", value="adjust volume to n%",
inline=False)
embed.add_field(name="eggs", value="eggs", inline=False)
embed.add_field(name="emote", value="doge will send an emote he has access to. ", inline=False)
embed.add_field(name="stop", value="stops playback and disconnects", inline=False)
embed.set_footer(text="If you want more content or features ask me to add them. ")
embed.add_field(
name="emote",
value="doge will send an emote he has access to. ",
inline=False,
)
embed.add_field(
name="stop", value="stops playback and disconnects", inline=False
)
embed.set_footer(
text="If you want more content or features ask me to add them. "
)
await ctx.send(embed=embed)
@commands.command()
@@ -164,45 +221,258 @@ class Music(commands.Cog):
@commands.command()
async def shibe(self, ctx):
await ctx.send("https://www." + str(get_video("shibes")).replace("\"", ""))
await ctx.send(
"https://www." + str(get_video("shibes")).replace('"', ""))
@commands.command()
async def dogedream(self, ctx, arg):
"""
Doge Dream command for helping Ziad
"""
try:
url = ctx.message.attachments[0].url
except Exception:
ctx.send("Error! please use attachments")
# Note: you can pass url from message.content,
# I suggest using mimetypes to indentify if URL has image.
return ()
# Used aiohttp-requests for simplicity rather than aiohttp
r = await requests.post(
"https://api.deepai.org/api/deepdream",
data={"image": url},
headers={"api-key": self.apikey},
)
json = await r.json()
print(json)
try:
await ctx.send(json["output_url"])
except Exception as e:
await ctx.send("%s\n%s" % (e, json))
@commands.command()
async def dogeapi(self, ctx, api: str):
"""
Sets API Key
"""
self.apikey = api
await ctx.send("set API key to: %s" % api)
@commands.command()
async def kobe(self, ctx):
emote1 = ":helicopter:"
emote2 = ":fire:"
await ctx.send(emote1 + " " + emote2)
@commands.command()
async def cbt(self, ctx):
await ctx.send("I require immediate cock and ball torture")
@commands.command()
async def sounds(self, ctx, args=1):
embedlist = []
foldernames = []
for root, dirs, files in os.walk("sounds"):
foldernames.extend(dirs)
print(dirs)
pagecnt = len(foldernames) / 20
pagecnt = int(pagecnt)
if len(foldernames) % 20 > 0:
pagecnt += 1
embedlist.append(
discord.Embed(
title="🔊🔊🔊LIST OF SOUNDS Page 1" + "/" + str(
pagecnt) + " 🔊🔊🔊",
description="do doge!sounds pagenumber for another page. example: "
"doge!sounds 2",
color=0xE8E361,
)
)
embedlist[0].set_author(
name="GodEmperorDoge", url="https://www.github.com/rustyraptor"
)
embedlist[0].set_thumbnail(url="https://i.imgur.com/ddy9MGr.jpg")
num_fields = 0
pageno = 0
print(foldernames)
for num, name in enumerate(foldernames):
num_fields += 1
if num_fields > 20:
num_fields = 0
pageno += 1
embedlist.append(
discord.Embed(
title="🔊🔊🔊LIST OF SOUNDS Page "
+ str(pageno + 1)
+ "/"
+ str(pagecnt)
+ " 🔊🔊🔊",
description="Command format is doge!play " "nameofsound",
color=0xE8E361,
)
)
embedlist[pageno].set_author(
name="GodEmperorDoge",
url="https://www.github.com" "/rustyraptor"
)
embedlist[pageno].set_thumbnail(
url="https://i.imgur.com/ddy9MGr.jpg")
inln = True
if len(name) > 10:
inln = False
embedlist[pageno].add_field(name=name, value="======", inline=inln)
try:
await ctx.send(embed=embedlist[int(args) - 1])
except IndexError:
await ctx.send(
"Wtf, there are only " + str(pagecnt) + " pages you dumbass!"
)
await ctx.send(get_emote("dogeannoy"))
@commands.command()
async def cheems(self, ctx):
await ctx.send("https://www." + str(get_video("cheems")).replace("\"", ""))
path = random.choice(os.listdir("cheems/")) # change dir name to whatever
await ctx.send(
"https://www." + str(get_video("cheems")).replace('"', ""))
path = random.choice(os.listdir("cheems/"))
await ctx.send(file=discord.File("cheems/" + path))
@commands.command(aliases=['EGGS', 'eggs', 'Eggs'])
async def play(self, ctx, args="eggs"):
source = discord.PCMVolumeTransformer(discord.FFmpegPCMAudio(get_sound(args)))
@commands.command()
async def vibecheck(self, ctx, args=-1):
ignoredkeys = [
"doge!",
]
ignored = ["", " "]
messages = []
if args == -1:
user = ctx.author.id
else:
user = args
counter = 0
async for message in ctx.history(limit=100000):
textcheck = True
# print("it executed at least")
for key in ignoredkeys:
if key in message.content:
print(message.content, "THIS ONE HAD A BAD WOW")
textcheck = False
if message.content in ignored:
textcheck = False
if message.author.id == user and textcheck:
messages.append(message.content)
print(message.content)
counter += 1
if counter > 10:
break
score = 0
for i in messages:
r = requests.post(
"https://api.deepai.org/api/sentiment-analysis",
data={"text": i, },
headers={"api-key": "485f6ea6-1175-428f-9bff-43e04ee8fa09"},
)
print(r.json())
points = {
"Negative": -1,
"Verynegative": -5,
"Positive": 1,
"Verypositive": 5,
"Neutral": 0,
}
for j in r.json()["output"]:
score += points[j]
if score <= 0:
embed = discord.Embed(
title="You failed the vibecheck",
description="Fix your vibe please",
color=0xFBFF00,
)
embed.set_author(name="Doge Bot")
embed.set_image(url="https://i.imgur.com/tzKsULA.png")
await ctx.channel.send(embed=embed)
else:
embed = discord.Embed(
title="You passed the vibecheck", description="Hooray",
color=0xFBFF00
)
embed.set_author(name="Doge Bot")
embed.set_image(url="https://i.imgur.com/l3FplOj.jpg")
await ctx.channel.send(embed=embed)
@commands.command(aliases=["EGGS", "eggs", "Eggs"])
async def play(self, ctx, folder="eggs", cut="full"):
source = discord.PCMVolumeTransformer(
discord.FFmpegPCMAudio(get_sound(folder)))
emote = "ERROR: EMOTE NOT FOUND"
for i in bot.emojis:
if i.name == "cooldoge":
emote = str(i)
await ctx.send(emote)
ctx.voice_client.play(source, after=lambda e: print('Player error: %s' % e) if e else None)
if args == "dorime":
path = random.choice(os.listdir("dorimepic/")) # change dir name to whatever
await ctx.send(file=discord.File("dorimepic/" + path))
ctx.voice_client.play(
source, after=lambda e: print("Player error: %s" % e) if e else None
)
if cut != "full":
if cut == "short":
time.sleep(6)
elif cut == "medium":
time.sleep(15)
elif cut == "long":
time.sleep(30)
elif RepresentsInt(cut):
time.sleep(int(cut))
ctx.voice_client.stop()
if folder == "dorime":
path = random.choice(
os.listdir("images/dorime/")
) # change dir name to whatever
await ctx.send(file=discord.File("images/dorime/" + path))
await ctx.send(random.choice(dorimes))
await ctx.send("We need more prayers! Say DORIME")
@commands.command()
async def say(self, ctx, args="You need to specify what you want me to "
"say, retard!"):
synthesize_text(args)
source = discord.PCMVolumeTransformer(
discord.FFmpegPCMAudio("output.mp3")
)
ctx.voice_client.play(
source, after=lambda e: print("Player error: %s" % e) if e else None
)
@commands.command()
async def yt(self, ctx, *, url):
async with ctx.typing():
player = await YTDLSource.from_url(url, loop=self.bot.loop)
ctx.voice_client.play(player, after=lambda e: print('Player error: %s' % e) if e else None)
ctx.voice_client.play(
player,
after=lambda e: print("Player error: %s" % e) if e else None
)
await ctx.send('Now playing: {}'.format(player.title))
await ctx.send("Now playing: {}".format(player.title))
@commands.command()
async def stream(self, ctx, *, url):
async with ctx.typing():
player = await YTDLSource.from_url(url, loop=self.bot.loop, stream=True)
ctx.voice_client.play(player, after=lambda e: print('Player error: %s' % e) if e else None)
player = await YTDLSource.from_url(url, loop=self.bot.loop,
stream=True)
ctx.voice_client.play(
player,
after=lambda e: print("Player error: %s" % e) if e else None
)
await ctx.send('Now playing: {}'.format(player.title))
await ctx.send("Now playing: {}".format(player.title))
@commands.command()
async def volume(self, ctx, volume: int):
@@ -221,20 +491,12 @@ class Music(commands.Cog):
@commands.command()
async def emote(self, ctx, arg):
emote = "ERROR: EMOTE NOT FOUND"
for i in bot.emojis:
if i.name == str(arg):
emote = str(i)
await ctx.send(emote)
await ctx.send(get_emote(arg))
@commands.command()
async def meme(self, ctx):
path = random.choice(os.listdir("memes/")) # change dir name to whatever
await ctx.send(file=discord.File("memes/" + path))
@commands.command()
async def memerand(self, ctx):
path = random.choice(os.listdir("memerand/")) # change dir name to whatever
await ctx.send(file=discord.File("memerand/" + path))
async def meme(self, ctx, arg="memes"):
path = random.choice(os.listdir("images/" + arg))
await ctx.send(file=discord.File("images" + arg + path))
@play.before_invoke
@yt.before_invoke
@@ -245,20 +507,46 @@ class Music(commands.Cog):
await ctx.author.voice.channel.connect()
else:
await ctx.send("You are not connected to a voice channel.")
raise commands.CommandError("Author not connected to a voice channel.")
raise commands.CommandError(
"Author not connected to a voice channel.")
elif ctx.voice_client.is_playing():
ctx.voice_client.stop()
bot = commands.Bot(command_prefix=commands.when_mentioned_or("doge!"),
description='Karen, release me from this discord bot immediately!')
bot.remove_command('help')
bot = commands.Bot(
command_prefix=commands.when_mentioned_or("doge!"),
description="Karen, release me from this discord bot immediately!",
)
bot.remove_command("help")
@bot.event
async def on_ready():
print('Logged in as {0} ({0.id})'.format(bot.user))
print('------')
print("Logged in as {0} ({0.id})".format(bot.user))
print("------")
bot.add_cog(Music(bot))
bot.run('yourtoken')
bot.run(os.getenv("DISCORD_TOKEN"))
# !/usr/bin/env python
# Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Google Cloud Text-To-Speech API sample application .
Example usage:
python synthesize_text.py --text "hello"
python synthesize_text.py --ssml "<speak>Hello there.</speak>"
"""