Skip to content

Instantly share code, notes, and snippets.

View Kakarot-2000's full-sized avatar
💭
studying graphql

Rohan Krishna Ullas Kakarot-2000

💭
studying graphql
  • India
View GitHub Profile
@Kakarot-2000
Kakarot-2000 / flask_setup_heroku.md
Created January 30, 2021 10:44 — forked from mayukh18/flask_setup_heroku.md
How to setup flask app with database on heroku

Setting up flask app in heroku with a database

The below article will cover the intricacies of setting up databases and heroku in respect to a flask app. This is more like a memo and will have out of sequence instructions or solutions to errors so read thoroughly.

Setting up a database

You'll need the packages

string fun1(string s,int k){
if(k>1){
sort(s.begin(),s.end());
return s;
}
string res=s;
for(int i=0;i<s.length();i++){
char ch=s[0];
s.erase(s.begin(),s.begin()+1);
s+=ch;
string fun1(string s,int k){
if(k>1){
sort(s.begin(),s.end());
return s;
}
string res=s;
for(int i=0;i<s.length();i++){
char ch=s[0];
s.erase(s.begin(),s.begin()+1);
s+=ch;
@Kakarot-2000
Kakarot-2000 / .env
Created February 26, 2021 08:58
We can keep all our environment variables here
discord_token = "copy_paste_your_bot_token_here"
@Kakarot-2000
Kakarot-2000 / app.py
Created February 26, 2021 09:02
import statements
import discord
from discord.ext import commands,tasks
import os
from dotenv import load_dotenv
import youtube_dl
load_dotenv()
# Get the API token from the .env file.
DISCORD_TOKEN = os.getenv("discord_token")
intents = discord.Intents().all()
client = discord.Client(intents=intents)
bot = commands.Bot(command_prefix='!',intents=intents)
youtube_dl.utils.bug_reports_message = lambda: ''
ytdl_format_options = {
'format': 'bestaudio/best',
'restrictfilenames': True,
'noplaylist': True,
'nocheckcertificate': True,
'ignoreerrors': False,
'logtostderr': False,
'quiet': True,
youtube_dl.utils.bug_reports_message = lambda: ''
ytdl_format_options = {
'format': 'bestaudio/best',
'restrictfilenames': True,
'noplaylist': True,
'nocheckcertificate': True,
'ignoreerrors': False,
'logtostderr': False,
'quiet': True,
youtube_dl.utils.bug_reports_message = lambda: ''
ytdl_format_options = {
'format': 'bestaudio/best',
'restrictfilenames': True,
'noplaylist': True,
'nocheckcertificate': True,
'ignoreerrors': False,
'logtostderr': False,
'quiet': True,
@bot.command(name='join', help='Tells the bot to join the voice channel')
async def join(ctx):
if not ctx.message.author.voice:
await ctx.send("{} is not connected to a voice channel".format(ctx.message.author.name))
return
else:
channel = ctx.message.author.voice.channel
await channel.connect()
@bot.command(name='leave', help='To make the bot leave the voice channel')