├── .github └── workflows │ └── update-license.yml ├── Files ├── rickroll.gif ├── rickroll.mp3 └── rickroll.mp4 ├── LICENSE ├── README.md ├── main.py ├── rickroll.py └── tokens.py /.github/workflows/update-license.yml: -------------------------------------------------------------------------------- 1 | name: Update copyright year in license file 2 | 3 | on: 4 | schedule: 5 | - cron: "0 3 1 1 *" # 03:00 AM on January 1 6 | 7 | jobs: 8 | update-license-year: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v2 12 | with: 13 | fetch-depth: 0 14 | - uses: FantasticFiasco/action-update-license-year@v2 15 | with: 16 | token: ${{ secrets.GITHUB_TOKEN }} 17 | commitTitle: 'Updated Copyright Date on License' 18 | prTitle: "It's now {{currentYear}} :tada:" 19 | assignees: 'duckmasteral' 20 | -------------------------------------------------------------------------------- /Files/rickroll.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuckMasterAl/rickroll-bot/8038d2db13ddb0cac33e72d8710bd40428737e3b/Files/rickroll.gif -------------------------------------------------------------------------------- /Files/rickroll.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuckMasterAl/rickroll-bot/8038d2db13ddb0cac33e72d8710bd40428737e3b/Files/rickroll.mp3 -------------------------------------------------------------------------------- /Files/rickroll.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuckMasterAl/rickroll-bot/8038d2db13ddb0cac33e72d8710bd40428737e3b/Files/rickroll.mp4 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021-2022 DuckMasterAl 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # rickroll-bot 2 | Rickroll your friends when they join a voice channel and every 5 messages! 3 | 4 | ![](https://github.com/DuckMasterAl/rickroll-bot/blob/main/Files/rickroll.gif?raw=true) 5 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import discord, tokens 2 | from discord.ext import commands 3 | 4 | bot = commands.Bot( 5 | command_prefix=commands.when_mentioned, 6 | status=discord.Status.dnd, 7 | activity=discord.Activity(type=discord.ActivityType.watching, name='rickroll.com'), 8 | 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", 9 | case_insensitive=True, 10 | allowed_mentions=discord.AllowedMentions.none(), 11 | intents=discord.Intents.default() 12 | ) 13 | 14 | if __name__ == "__main__": 15 | bot.load_extension('jishaku') 16 | bot.load_extension('rickroll') 17 | bot.rickroll = {} 18 | bot.run(tokens.bot) 19 | -------------------------------------------------------------------------------- /rickroll.py: -------------------------------------------------------------------------------- 1 | import discord, random, asyncio 2 | from discord.ext import commands 3 | 4 | class Misc(commands.Cog): 5 | def __init__(self, bot): 6 | self.bot = bot 7 | 8 | @commands.Cog.listener('on_voice_state_update') 9 | async def rickroll_voice(self, member, before, after): 10 | if before.channel != after.channel and after.channel is not None and member.bot is False: 11 | bot_member = member.guild.get_member(self.bot.user.id) 12 | if bot_member.permissions_in(after.channel).speak is False or bot_member.permissions_in(after.channel).connect is False: 13 | return 14 | source = discord.PCMVolumeTransformer(discord.FFmpegPCMAudio('Files/rickroll.mp3')) 15 | try: 16 | await member.voice.channel.connect() 17 | except discord.errors.ClientException: 18 | pass 19 | try: 20 | await member.guild.voice_client.play(source) 21 | except TypeError: 22 | pass 23 | await asyncio.sleep(10) 24 | await member.guild.voice_client.disconnect() 25 | 26 | @commands.Cog.listener('on_message') 27 | async def rickroll_text(self, message): 28 | if message.guild is None or message.author.bot is True: 29 | return 30 | rickroll = False 31 | try: 32 | self.bot.rickroll[str(message.channel.id)] += 1 33 | except KeyError: 34 | self.bot.rickroll[str(message.channel.id)] = 1 35 | else: 36 | if self.bot.rickroll[str(message.channel.id)] >= 5: 37 | rickroll = True 38 | if rickroll is True: 39 | del self.bot.rickroll[str(message.channel.id)] 40 | option = random.choice(['video', 'gif', 'emoji', 'lyrics', 'youtube']) 41 | if option == 'video': 42 | file = discord.File("Files/rickroll.mp4") 43 | await message.reply(file=file, delete_after=45.0) 44 | elif option == 'gif': 45 | file = discord.File("Files/rickroll.gif") 46 | await message.reply(file=file, delete_after=45.0) 47 | elif option == 'emoji': 48 | await message.reply('', delete_after=45.0) 49 | elif option == 'lyrics': 50 | 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) 51 | elif option == 'youtube': 52 | await message.reply('https://youtu.be/dQw4w9WgXcQ', delete_after=45.0) 53 | 54 | def setup(bot): 55 | bot.add_cog(Misc(bot)) 56 | -------------------------------------------------------------------------------- /tokens.py: -------------------------------------------------------------------------------- 1 | bot = "" 2 | --------------------------------------------------------------------------------