This commit is contained in:
JP
2018-11-18 11:56:58 +01:00
parent 13d31dccd1
commit 044e0733d2
13 changed files with 5 additions and 477 deletions
+3 -1
View File
@@ -4,6 +4,8 @@ tijd/
.vs/
test.png
password.txt
stroopwafel.token
UpgradeLog\.htm
markov_dict.npy
stroopwafel.ini
Stroopwafel.sln
Stroopwafel.pyproj
-59
View File
@@ -1,59 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>6f25512f-caba-45b1-9b6a-d2d28b32494a</ProjectGuid>
<ProjectHome>.</ProjectHome>
<StartupFile>Stroopwafel.py</StartupFile>
<SearchPath>
</SearchPath>
<WorkingDirectory>.</WorkingDirectory>
<OutputPath>.</OutputPath>
<Name>Stroopwafel</Name>
<RootNamespace>Stroopwafel</RootNamespace>
<IsWindowsApplication>False</IsWindowsApplication>
<InterpreterId>{257fd04c-048c-4bcb-bc47-024b035ececc}</InterpreterId>
<InterpreterVersion>3.5</InterpreterVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugSymbols>true</DebugSymbols>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
</PropertyGroup>
<ItemGroup>
<Compile Include="General.py">
<SubType>Code</SubType>
</Compile>
<Compile Include="Porno.py">
<SubType>Code</SubType>
</Compile>
<Compile Include="Shitpost.py">
<SubType>Code</SubType>
</Compile>
<Compile Include="Stroopwafel.py" />
<Compile Include="Music.py">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<InterpreterReference Include="{257fd04c-048c-4bcb-bc47-024b035ececc}\3.5" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<PtvsTargetsFile>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets</PtvsTargetsFile>
</PropertyGroup>
<Import Condition="Exists($(PtvsTargetsFile))" Project="$(PtvsTargetsFile)" />
<Import Condition="!Exists($(PtvsTargetsFile))" Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
<!-- Uncomment the CoreCompile target to enable the Build command in
Visual Studio and specify your pre- and post-build commands in
the BeforeBuild and AfterBuild targets below. -->
<!--<Target Name="CoreCompile" />-->
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
</Project>
-20
View File
@@ -1,20 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "Stroopwafel", "Stroopwafel.pyproj", "{6F25512F-CABA-45B1-9B6A-D2D28B32494A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6F25512F-CABA-45B1-9B6A-D2D28B32494A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6F25512F-CABA-45B1-9B6A-D2D28B32494A}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
-27
View File
@@ -1,27 +0,0 @@
import asyncio
import discord
from discord.ext import commands
from sympy import latex, symbols, preview, Symbol #for LaTeX images
class General(object):
"""Overal toegestaan."""
def __init__(self, bot):
self.bot = bot
self.voice_states = {}
def __check(self, ctx): #Todo: Is dit het porno kanaal?
return True
@commands.command(pass_context=True)
-240
View File
@@ -1,240 +0,0 @@
import asyncio
import discord
from discord.ext import commands
class VoiceEntry:
def __init__(self, message, player):
self.requester = message.author
self.channel = message.channel
self.player = player
def __str__(self):
fmt = '*{0.title}* verzocht door {1.display_name}'
duration = self.player.duration
if duration:
fmt = fmt + ' [{0[0]}m {0[1]}s]'.format(divmod(duration, 60))
return fmt.format(self.player, self.requester)
class VoiceState:
def __init__(self, bot):
self.current = None
self.voice = None
self.bot = bot
self.play_next_song = asyncio.Event()
self.songs = asyncio.Queue()
self.skip_votes = set() # a set of user_ids that voted
self.audio_player = self.bot.loop.create_task(self.audio_player_task())
def is_playing(self):
if self.voice is None or self.current is None:
return False
player = self.current.player
return not player.is_done()
@property
def player(self):
return self.current.player
def skip(self):
self.skip_votes.clear()
if self.is_playing():
self.player.stop()
def toggle_next(self):
self.bot.loop.call_soon_threadsafe(self.play_next_song.set)
@asyncio.coroutine
def audio_player_task(self):
while True:
self.play_next_song.clear()
self.current = yield from self.songs.get()
yield from self.bot.send_message(self.current.channel, 'U luistert naar: ' + str(self.current))
self.current.player.start()
yield from self.play_next_song.wait()
if not discord.opus.is_loaded():
# the 'opus' library here is opus.dll on windows
# or libopus.so on linux in the current directory
# you should replace this with the location the
# opus library is located in and with the proper filename.
# note that on windows this DLL is automatically provided for you
discord.opus.load_opus('opus')
class Music:
"""Play that funky music white boy.
"""
def __init__(self, bot):
self.bot = bot
self.voice_states = {}
def __check(self, ctx):
return True
def get_voice_state(self, server):
state = self.voice_states.get(server.id)
if state is None:
state = VoiceState(self.bot)
self.voice_states[server.id] = state
return state
@asyncio.coroutine
def create_voice_client(self, channel):
voice = yield from self.bot.join_voice_channel(channel)
state = self.get_voice_state(channel.server)
state.voice = voice
def __unload(self):
for state in self.voice_states.values():
try:
state.audio_player.cancel()
if state.voice:
self.bot.loop.create_task(state.voice.disconnect())
except:
pass
@commands.command(pass_context=True, no_pm=True)
@asyncio.coroutine
def join(self, ctx, *, channel : discord.Channel):
"""Verplaats stroopie naar een bepaald kanaal."""
try:
yield from self.create_voice_client(channel)
except discord.ClientException:
yield from self.bot.say('Already in a voice channel...')
except discord.InvalidArgument:
yield from self.bot.say('This is not a voice channel...')
else:
yield from self.bot.say('Ready to play audio in ' + channel.name)
@commands.command(pass_context=True, no_pm=True)
@asyncio.coroutine
def summon(self, ctx):
"""Roep stroopie naar jouw kanaal toe.."""
summoned_channel = ctx.message.author.voice_channel
if summoned_channel is None:
yield from self.bot.say('You are not in a voice channel.')
return False
state = self.get_voice_state(ctx.message.server)
-36
View File
@@ -1,36 +0,0 @@
import asyncio
import discord
from discord.ext import commands
import os
from random import randint
class Porno(object):
"""Porno commando's. Jij weet wat er aan is."""
def __init__(self, bot):
self.bot = bot
self.voice_states = {}
self.fileIndex = {}
def __check(self, ctx): #Todo: Is dit het porno kanaal?
return True
def randomJpgFromFolder(self, dir):
if dir not in self.fileIndex.keys():
-72
View File
@@ -1,72 +0,0 @@
import asyncio
import discord
from discord.ext import commands
from urllib import request
import json, requests
from datetime import datetime
import sys
import os
class Shitpost(object):
"""Schijtpaal commando's. Alleen bruikbaar in de daarvoor toegewezen schijtpaal kanalen."""
def __init__(self, bot):
self.bot = bot
self.voice_states = {}
def __check(self, ctx): #Todo: Is dit het shitpost kanaal?
return True
@commands.command(pass_context=True)
@asyncio.coroutine
def eriku(self, ctx, boven: str, onder: str):
"""Maakt een erik meem.
Bijvoorbeeld:
@Stroopwafel eriku \"je moeder\" \"is een hoer\"
"""
params = dict(
template_id = '93296473', #de eriku
username = 'Stroopwafel',
password = 'ruyter118',
text0 = boven,
text1 = onder
)
self.bot.say("deed ik het ding?")
resp = requests.get(url='https://api.imgflip.com/caption_image', params=params)
#todo check for success
photourl = resp.json()['data']['url']
-20
View File
@@ -1,20 +0,0 @@
import asyncio
import discord
import Music
import Porno
import Shitpost
import General
from discord.ext import commands
bot = commands.Bot(command_prefix=commands.when_mentioned_or('!'), description='Stroopwafel. Shitpost bot extraordinaire.', pm_help=True)
bot.add_cog(Music.Music(bot))
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB