Skip to content
This repository has been archived by the owner on Nov 27, 2022. It is now read-only.

Commit

Permalink
Never gonna give you up
Browse files Browse the repository at this point in the history
  • Loading branch information
DuckMasterAl committed Apr 2, 2021
0 parents commit feddaa6
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 0 deletions.
Binary file added Files/rickroll.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Files/rickroll.mp3
Binary file not shown.
Binary file added Files/rickroll.mp4
Binary file not shown.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021-Present DuckMasterAl

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# rickroll-bot
Rickroll your friends when they join a voice channel and every 5 messages!
19 changes: 19 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import discord, os, json, tokens
from discord.ext import commands
Client = discord.Client()

client = commands.Bot(
command_prefix=commands.when_mentioned,
status=discord.Status.dnd,
activity=discord.Activity(type=discord.ActivityType.watching, name='rickroll.com'),
description="We're no strangers to love\nYou know the rules and so do I\nA full commitment's what I'm thinking of\nYou wouldn't get this from any other guy\n\nI just wanna tell you how I'm feeling\nGotta make you understand",
case_insensitive=True,
allowed_mentions=discord.AllowedMentions.none(),
intents=discord.Intents.default()
)

client.load_extension('jishaku')
client.load_extension('rickroll')
client.rickroll = {}

client.run(tokens.bot)
55 changes: 55 additions & 0 deletions rickroll.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import discord, random, asyncio
from discord.ext import commands

class Misc(commands.Cog):
def __init__(self, bot):
self.bot = bot

@commands.Cog.listener('on_voice_state_update')
async def rickroll_voice(self, member, before, after):
if before.channel != after.channel and after.channel is not None and member.bot is False:
bot_member = member.guild.get_member(self.bot.user.id)
if bot_member.permissions_in(after.channel).speak is False or bot_member.permissions_in(after.channel).connect is False:
return
source = discord.PCMVolumeTransformer(discord.FFmpegPCMAudio('Files/rickroll.mp3'))
try:
await member.voice.channel.connect()
except discord.errors.ClientException:
pass
try:
await member.guild.voice_client.play(source)
except TypeError:
pass
await asyncio.sleep(10)
await member.guild.voice_client.disconnect()

@commands.Cog.listener('on_message')
async def rickroll_text(self, message):
if message.guild is None or message.author.bot is True:
return
rickroll = False
try:
self.bot.rickroll[str(message.channel.id)] += 1
except KeyError:
self.bot.rickroll[str(message.channel.id)] = 1
else:
if self.bot.rickroll[str(message.channel.id)] >= 5:
rickroll = True
if rickroll is True:
del self.bot.rickroll[str(message.channel.id)]
option = random.choice(['video', 'gif', 'emoji', 'lyrics', 'youtube'])
if option == 'video':
file = discord.File("Files/rickroll.mp4")
await message.reply(file=file, delete_after=45.0)
elif option == 'gif':
file = discord.File("Files/rickroll.gif")
await message.reply(file=file, delete_after=45.0)
elif option == 'emoji':
await message.reply('<a:just_a_normal_blob_emoji:808436599330177024>', delete_after=45.0)
elif option == 'lyrics':
await message.reply("We're no strangers to love\nYou know the rules and so do I\nA full commitment's what I'm thinking of\nYou wouldn't get this from any other guy\nI just wanna tell you how I'm feeling\nGotta make you understand", delete_after=45.0)
elif option == 'youtube':
await message.reply('https://youtu.be/dQw4w9WgXcQ', delete_after=45.0)

def setup(bot):
bot.add_cog(Misc(bot))
1 change: 1 addition & 0 deletions tokens.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bot = ""

0 comments on commit feddaa6

Please sign in to comment.