Skip to content
This repository was archived by the owner on Jan 17, 2023. It is now read-only.

Commit 7401304

Browse files
author
Benjamin O'Brien
committed
rPi Update
1 parent 405dd77 commit 7401304

File tree

5 files changed

+98
-4
lines changed

5 files changed

+98
-4
lines changed

commands/currency/work.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ async def work(self, ctx):
2222

2323
return await ctx.send(embed = Cooldowns.cooldown_text(ctx, "work"))
2424

25-
n1 = randint(1, 100)
25+
n1 = randint(1, 20)
2626

27-
n2 = randint(1, 100)
27+
n2 = randint(1, 20)
2828

2929
answer = n1 + n2
3030

commands/developer/eval.py

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
import os
55
import ast
66

7+
import string
8+
import random
9+
710
import discord
811

912
from assets.prism import Tools
@@ -109,14 +112,51 @@ async def _eval(self, ctx, *, cmd: str = None):
109112

110113
return await ctx.send(embed = self._eval_(output, ctx.author, "js"))
111114

115+
class prism:
116+
117+
def generateToken(author):
118+
119+
token = ""
120+
121+
upper = string.ascii_uppercase
122+
123+
lower = string.ascii_lowercase
124+
125+
for char in str(author.id):
126+
127+
if random.randint(0, 1):
128+
129+
token += upper[int(char)]
130+
131+
else:
132+
133+
token += lower[int(char)]
134+
135+
c = 1
136+
137+
while c != random.randint(50, 75):
138+
139+
if random.randint(0, 1):
140+
141+
token = token + random.choice(upper)
142+
143+
else:
144+
145+
token = token + random.choice(lower)
146+
147+
c += 1
148+
149+
return token
150+
112151
env = {
113152
"bot": ctx.bot,
114153
"discord": discord,
115154
"commands": commands,
116155
"ctx": ctx,
117156
"__import__": __import__,
118157
"Tools": Tools,
119-
"os": os
158+
"os": os,
159+
"prism": prism
120160
}
121161

122162
fn_name = "_eval_expr"

commands/entertainment/corn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def __init__(self, bot):
1212
@commands.command()
1313
async def corn(self, ctx):
1414

15-
return await ctx.send("corn")
15+
return await ctx.send(":corn:")
1616

1717
# Link to bot
1818
def setup(bot):

commands/music/play.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Modules
2+
import discord
3+
import youtube_dl
4+
5+
from assets.prism import Tools
6+
from discord.ext import commands
7+
8+
# Main Command Class
9+
class Play(commands.Cog):
10+
11+
def __init__(self, bot):
12+
self.bot = bot
13+
self.desc = "Streams YouTube music to discord"
14+
self.usage = "play [url]"
15+
16+
@commands.command()
17+
async def play(self, ctx, url: str = None):
18+
19+
if not url:
20+
21+
return await ctx.send(embed = Tools.error("No URL specified to play."))
22+
23+
elif not ctx.author.voice:
24+
25+
return await ctx.send(embed = Tools.error("You aren't in a voice channel."))
26+
27+
voice = discord.utils.get(self.bot.voice_clients, guild = ctx.guild)
28+
29+
if not voice:
30+
31+
try:
32+
33+
voice = await ctx.author.voice.channel.connect()
34+
35+
except:
36+
37+
return await ctx.send(embed = Tools.error("Missing permission(s) to join you're voice channel."))
38+
39+
with youtube_dl.YoutubeDL({}) as ytdl:
40+
41+
info = ytdl.extract_info(url, download = False)
42+
43+
await ctx.send(info["title"])
44+
45+
voice.play(discord.FFmpegPCMAudio(info["formats"][0]["url"]))
46+
47+
voice.source = discord.PCMVolumeTransformer(voice.source)
48+
49+
voice.source.volume = 1
50+
51+
# Link to bot
52+
def setup(bot):
53+
bot.add_cog(Play(bot))

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
wmi
12
dblpy
23
psutil
34
requests

0 commit comments

Comments
 (0)