counter -= 1
                    await post.delete()
                    try:
                        await top(ctx, username, counter, likes, comments)
                        return
                    except:
                        counter += 1
                        await top(ctx, username, counter, likes, comments)
                        return

            except asyncio.TimeoutError:
                print(f'removing {username} directory')
                try:
                    gathered_posts.remove((username, 'top'))
                    shutil.rmtree(username)
                    return
                except:
                    pass
    try:
        shutil.rmtree(username)
        gathered_posts.remove((username, 'top'))
    except:
        pass


keep_alive()  #you should comment this out if you are hosting locally
client = discord.Client()
bot.run(os.getenv('TOKEN'))

#This uses symbolism. The split tail means that the democracy is divided. It also shows Lincoln splitting it, showing that Lincoln is splitting the democracy
#I honestly can't even tell what is happening except the chair is labeled "Presidental Chairman 1866", a bowl labeled "PAP", and a stool labeled "IVZAZ." I don't understand anything else
Пример #2
0
  if notes.startswith("-clear"):
    db["cuecards"]= start
    await message.channel.send('```Cleared All Notes```')

  if message.content.startswith('-notes'):
    if "cuecards" in db.keys():
      await message.channel.send('```%s```' % '\n-'.join(map(str, options)))
      
  if message.content.startswith('-flip'):
    await message.channel.send(message.author.mention + " You got..." + "```" + random.choice(flip_coin) + "```")
    emoji = '✅'
    await message.add_reaction(emoji)

  if message.content.startswith('-coin'):
    await message.channel.send(message.author.mention + " You got..." + "```" + random.choice(flip_coin) + "```")
    emoji = '✅'
    await message.add_reaction(emoji)

  if message.content.startswith('-motiv'):
    quote = get_quote()
    await message.channel.send(quote)
    emoji = '✅'
    await message.add_reaction(emoji)
  
  if message.content == "-users":
    await message.channel.send(f"""There are {id.member_count} Members in the server""")

keep_alive() #Up keep
client.run(os.getenv('TOKEN'))

Пример #3
0
            await send_connect(message, RED_VC, BLU_VC)
        elif message.content.startswith(
                '!bconnect'):  # sends connect for B Pugs
            await send_connect(message, RED_VC_2, BLU_VC_2)
        elif message.content.startswith('!endpug'):  # ends A pugs
            await teams_to_picking(message, RED_VC, BLU_VC, PICKING_VC)
        elif message.content.startswith('!endbpug'):  # ends B pugs
            await teams_to_picking(message, RED_VC_2, BLU_VC_2, PICKING_VC_2)
        elif message.content.startswith('!consolidate'):
            await consolidate_pugs(message, PICKING_VC, PICKING_VC_2)
        elif message.content.startswith(
                '!fatkids') or message.content.startswith(
                    '!fk'):  # sends fatkids msg
            await post_fatkids(message, PICKING_VC, ANNOUNCE, GUILD)
        elif message.content.startswith('!timeout'):
            pass
    elif isinstance(message.channel, discord.DMChannel):
        if message.content.startswith('!clear'):
            history = message.channel.history(limit=1000)
            async for message in history:
                if message.author.id == client.user.id:
                    await message.delete()
        else:
            await message.channel.send('Report Submitted.', delete_after=30)
            await REPORT_CHANNEL.send(
                f'{message.author.name}: {message.content}')


keep_alive()  # abuses free system for gain
client.run(os.getenv('TOKEN'))
	    inline=False)
	embed.add_field(
	    name='!info[Information]',
	    value='Gives information about the bot, its developer and gives an invite link which you can use to invite Ultimate bot to your own server!',
	    inline=False)
    
  
     

	await ctx.send(embed=embed)




token = 'MY_BOT_TOKEN'
keep_alive.keep_alive()
bot.run(token)

#notice !join and !dm not working properly but there is an output from the bot
#!join
#!dm
#Commands to be fixed and added to the bot
#!unban[user]
#!leave[VC]
#!mute[user]
#!unmute[user]

#to be fixed and added to the !help command

#embed.add_field(name = '!unban[user]',  value = 'Unbans a member' , inline = False )
#embed.add_field(name = '!leave[VC]',  value = 'bot leaves the voice channel' , inline = False )
Пример #5
0
            await channel.send(t[:limit])
            t = t[limit:]
        await channel.send(t)
      else:
        await channel.send(t)

  if not message.content.startswith(prefix):
    return    
  author:str = message.author
  channel:str = message.channel
  input = message.content[len(prefix):]
  args = input.split(" ")
  for a in range(len(args)):
    args[a] = args[a].lower().strip()
  if args[0] == '':
    args.remove(args[0])
  print("args",args)
  # respond to the pong command
  if args[0] == "ping":
    await say_to_channel("pong")  
  elif args[0] == "collatz":
    await say_to_channel(commands.collatz(args))
  elif args[0] == "pig":
    await say_to_channel(commands.pig(args))
  elif args[0] == "multimod":
    await say_to_channel(commands.multimod(args))
  elif args[0] == "oddinity":
    await say_to_channel(commands.oddinity(args))
      
life = keep_alive()
bot.run(os.getenv('TOKEN')) 
Пример #6
0
@client.event
async def on_member_join(member):
    await member.create_dm()
    await member.dm_channel.send(
        f'Hi {member.name}, welcome to my Discord server!')


@client.event
async def on_message(message):
    if message.author == client.user:
        return

    if message.content[:
                       7] == '!showme':  #Slices string and checks for the command term
        searchKey = message.content[7:]
        r = requests.get("https://g.tenor.com/v1/search?q=%s&key=%s&limit=%s" %
                         (searchKey, apikey, lmt))
        if r.status_code == 200:
            # load the GIFs using the urls
            gif = json.loads(r.content)
            i = random.randint(0, lmt - 1)
            url = gif['results'][i]['media'][0]['gif']['url']
            await message.channel.send(url)
        else:
            gif = None


keep_alive(
)  #Calling keep_alive(), allows another bot to ping the webpage every 5min and keep it online
client.run(TOKEN)
Пример #7
0
@commands.guild_only()
async def set_prefix(ctx, *prefix):
    id = ctx.guild.id
    if not prefix:
        await ctx.send("""
Please add an additional argument. For example: 
> !prefix ?   
to change the prefix to ?
		""")
    else:
        current_prefix = prefix_db.find_one({"guild_id": id})
        if current_prefix:
            prefix_db.update_one({"guild_id": id},
                                 {"$set": {
                                     "prefix": prefix
                                 }})
        else:
            new_entry = {"guild_id": id, "prefix": prefix}
            prefix_db.insert_one(new_entry)
        await ctx.send("Prefix changed!")


@bot.command(name='ping')
async def ping_pong(ctx):
    await ctx.send('pong!')


# keep the server alive 24/7
alive.keep_alive()
bot.run(TOKEN)
Пример #8
0
import discord
from discord.ext import commands
from dotenv import load_dotenv
import os
from keep_alive import keep_alive

load_dotenv()

TOKEN = os.environ.get('TOKEN')
client = commands.Bot(command_prefix='!')


@client.event
async def on_ready():
    print('We have logged in as {0.user}'.format(client))


keep_alive()  # starts the webserver so we can keep the bot up and running

client.load_extension("modules.general_cmds")

client.run(TOKEN)
Пример #9
0
def run_server():
    iu.init_tesseract()
    keep_alive()
    client.run(os.environ['token'])
Пример #10
0
    print(f"Logged in as {client.user.name} - {client.user.id}")


@client.event
async def on_command_error(
    ctx, error
):  #this is to check whether or not a command is on cooldown, to be used if any command ever needs to have a cooldown
    if isinstance(error, commands.CommandOnCooldown):
        message = f"This command is cooldown! Please try again in {str(error.retry_after)[0]}"  #checks if message is on cooldown
        await ctx.send(message)  #notifies user that the command is on cooldown


status_list = cycle(["being the best bot", "being the worst bot"])


#Background task:
@tasks.loop(seconds=60)
async def change_status():
    await client.change_presence(activity=discord.Activity(
        name=next(status_list), type=discord.ActivityType.competing))


#Loads in all the required cogs
for filename in os.listdir("./cogs"):
    if filename.endswith(".py"):
        client.load_extension(f"cogs.{filename[:-3]}")

keep_alive.keep_alive()  #Keeping bot alive
key = os.environ["BOT_TOKEN"]
client.run(key)
Пример #11
0
async def on_message(message):
  if message.author == client.user:
    return

  msg = message.content
#ALINTI MESAJLARINI APIDEN ÇEKİP !alıntı YAZINCA ATMASINI SAĞLIYORUZ
  if msg.startswith('!alıntı'):
    quote = get_quote()
    await message.channel.send(quote)

#BU KISIMDA ARRAY ŞEKLİNDE DEĞİŞTİRİLEBİLİR VE DEĞİŞTİRİLEMEZ 1 TANE KELİMEYE CEVAP VEREN SA-AS KOMUDU YAPTIK
#NAPİM YAZINCA BİR YAZI ATAN DÜZ BİR PİNG PONG
  if msg.startswith('napim'):
      await message.channel.send("yalnız napim demenin modası geçmedi mi")
#YUKARIDA BELİRLEDİĞİMİZ YEY WORDSLER GELİNCE STARTER WORDSLERİ ATAR
  if any(word in msg for word in yey_words):
        await message.channel.send(random.choice(starter_yey))
#EĞER SUNUCUNUZ BUNLARA İZİN VERMİYORSA YEY WORDS,STARTER YEYS VE BU KOMUTLARI SİLEBİLİRSİNİZ


#CEVAP VERMEYİ KONTROL EDEREK MOTİVASYON MESAJI EKLEME VE SİLMENİN KOMTLARINI YAZIYORUZ
  if db["responding"]:
    options = starter_encouragements
    if "encouragements" in db.keys():
      options = options + db["encouragements"]

    if any(word in msg for word in sad_words):
      await message.channel.send(random.choice(options))
#YENİ MORAL EKLEME KOMUDU
  if msg.startswith("!yeni-moral"):
    encouraging_message = msg.split("!yeni-moral ",1)[1]
    update_encouragements(encouraging_message)
    await message.channel.send("Yeni Motive Edici Mesaj Eklendi.")
#MORAL CEVAPLARINDAN BİRİNİ !sil __ YAZARAK SİLME KOMUDU
  if msg.startswith("!sil-moral"):
    encouragements = []
    if "encouragements" in db.keys():
      index = int(msg.split("!sil-moral",1)[1])
      delete_encouragment(index)
      encouragements = db["encouragements"]
    await message.channel.send(encouragements)
#MORAL CEVAPLARINI LİSTELEME KOMUDU
  if msg.startswith("!liste-moral"):
    encouragements = []
    if "encouragements" in db.keys():
      encouragements = db["encouragements"]
    await message.channel.send(encouragements)

#CEVAP VERMEYİ AÇIP KAPATMA KOMUDU
  if msg.startswith("!cevap-verme"):
    value = msg.split("!cevap-verme ",1)[1]

    if value.lower() == "aç":
      db["responding"] = True
      await message.channel.send("Cevap Verme Açıldı.")
    if value.lower() == "kapat":
      db["responding"] = False
      await message.channel.send("Cevap Verme Kapatıldı.")


#YARDIM KOMUDU
    if msg.startswith("!yardım"):
    embed=discord.Embed(title="PRASTY CODE", url="https://discord.gg/UruBEetE", description="Githubımı kullandığınız için teşekkür ederim :) umarım eğlenirsiniz", color=0x992d22)

    embed.set_author(name="-- ད ⁸⁷¹imamㄠ --", url="http://theias.xyz/", icon_url="https://cdn.discordapp.com/attachments/806112454470795267/808345984731578379/1664606672481286_c5_720x720.jpeg")

    embed.add_field(name="`!yardım`", value="cavalleria.py'nin yapabileceklerini atar", inline=True)

    embed.add_field(name="`!alıntı`", value="size rastgele bir motivasyon alıntısı atar(İngilizce)", inline=True)

    embed.add_field(name="`üzgünüm/!yeni-moral/!sil-moral/!liste-moral`", value="en iyi kısmı ise bota kod kullanmadan ekleme yapabilmenizdir botun size üzgün olmanız durumunda söylediği sözlere ekleme yapmak istiyorsanız tek yazmanız gereken !yeni .... şeklinde motive edici sözünüzü yazmaktır eğer yazdığınız sözü iptal etmek istiyorsanız !sil ... şeklinde ... kısmına silmek istediğiniz motive edici sözün listedeki numarasını yazmaktır yani !sil 1 gibi (Moral ekleme çıkarma veya listeleme işlemleri sadece yetkililer tarafından kullanılabilir)", inline=False)

    embed.add_field(name="`!cevap-verme kapat/!cevap-verme aç`", value="eğer botun size motive edici cevaplar veya duyurular atması sizi sinir ettiyse tek yazmanız gereken !cevap-verme kapat'dır eğer bot size motive edici sözleri söylemiyorsa birisi bu komutu kapatmıştır tek yapmanız gereken !cevap-verme aç yazarak açmaktır :) (Bu Komut Sadece Yetkililer Tarafından Kullanılabilir)", inline=False)


    embed.set_footer(text="İYİ EĞLENCELER / PRASTY / THEİA")
    await message.channel.send(embed=embed)


#SADECE YETKİLİLERİN KULLANMASINI İSTEDİĞİNİZ KOMUTLAR İÇİN BU KOD YAPISINDA YETKİSİNİ KONTROL ETME KOMUTU KULLANILAMADIĞI İÇİN SUNUCUNUZUN KÜFÜR ENGELLEYİCİ BOTUNA KULLANILMASINI 
#İSTEMEDİĞİNİZ KOMUTLARI EKLEYİN VE BU SAYEDE İNSANLAR BU KOMUTLARI KULLANAMAYACAKTIR EĞER KÜFÜR ENGELLEYİCİ BOTUNUZ YOKSA O ZAAN PİNG PONG TÜRÜNDE BU KOMUTLAR YAZILDIĞINDA YETKİLİ
#DEĞİLSEN VE BİR DAHA KULLANIRSAN BANLANIRSIN VEYA KİCKLENİRSİN ŞEKLİNDE BİR YAZI ÇIKARTTIRABİLİRSİNİZ BU DURUMDA KULLANAYACAKLARDIR

keep_alive()
client.run(os.getenv('TOKEN'))
Пример #12
0
def main():
    keep_alive()
    client.run(os.getenv("TOKEN"))
Пример #13
0
        lyricQuote = await quote_lyric(userInput)
        await message.channel.send(lyricQuote)

    if msg.startswith('$karaoke'):
        rng_song = await random_song_name()
        await message.channel.send(rng_song)
        songString = await get_song(rng_song)
        await message.channel.send(songString)
        lyricString = await get_lyrics(rng_song)
        await message.channel.send(lyricString)
    '''
  if msg.startswith('$karaoke'):
    userInput = msg.split("$quote ", 1)[1]
    rng_song = await random_song_name()
    songString = await get_song(rng_song)
    await message.channel.send(songString)
    lyricQuote = await quote_lyric(rng_song)
    await message.channel.send(lyricQuote)
  '''

    if msg.startswith('$help'):
        helpString = await help_command()
        await message.channel.send(helpString)

    if any(word in msg for word in sing_words):
        await message.channel.send(random.choice(starter_singing))


keep_alive()  #keeps the bot running and not sleep
client.run(os.getenv('TOKEN'))  # password for bot.
Пример #14
0
    await channel.trigger_typing()
    await asyncio.sleep(random.randint(0,10))
    await channel.send('beep boop waiting')


# @bot.event
# async def on_ready():
#     print("I'm ready.")
#     global target_channel
#     target_channel = bot.get_channel("608815074622046211")
# @bot.command()
# async def send(*, message):
#     global target_channel
#     await bot.send_message(channel, message)

@bot.command()
async def test(ctx):
    await ctx.send('I heard you! {0}'.format(ctx.author))

# @bot.command()
# async def ping(ctx):
#     await ctx.send('pong')


keep_alive() #web server that keeps bot alive until an hour of inactivity, use uptimerobot if desire 24/7 active

token = os.environ.get("DISCORD_BOT_SECRET")
bot.run(token)
#client.run(token) #archaic

Пример #15
0
    if message.content.startswith('/testmod') and str(
            message.author) in mod_users:
        await message.channel.send(MEOW)
    else:  # checks if a user uses a / command
        channel = client.get_channel(826049329755586592)
    if message.content.startswith('/'):
        await channel.send(
            f"""```User:{message.author} tried {message.content} in #{message.channel}```"""
        )
    if message.content.startswith('!'):
        await channel.send(
            f"""```User:{message.author} tried {message.content} in #{message.channel}```"""
        )
    if message.content.startswith('?'):
        await channel.send(
            f"""```User:{message.author} tried {message.content} in #{message.channel}```"""
        )


# welcome users
@client.event
async def on_member_join(member):
    guild = client.get_guild(753325735137116362)
    channel = guild.get_channel(753325735795490929)
    await channel.send(f'Welcome! {member.mention}')


keep_alive()  # for backup only

client.run(token)
Пример #16
0
 def run(self, *args, **kwargs):
     keep_alive()
     super().run(*args, **kwargs)
            for c in (65, 97):
                for i in range(26):
                    d[chr(i + c)] = chr(
                        (i + num) % 26 + c
                    )  #all is the same code except this is i+num to decode...
            outputstr = ("".join([d.get(c, c) for c in inputstr]))

            msg = f"your rot{num} decoded is --->"
            await ctx.send(f"{msg} `{outputstr}`")

        if outputstr == None and inputstr == None:
            print(f"{inputstr} and {outputstr}")
            await ctx.send("pls check the tag and try again (-e/-d)"
                           )  #these are the two backup stuff if shit happens

        else:
            print('')
            print(f"{inputstr} and {outputstr}")

    except Exception:
        traceback.print_exc()
        print(f"{inputstr} and {outputstr} and {tag}")


keep_alive()  #this si the replit code i explained above at import
bot.run(os.getenv("BOTTOKEN")
        )  #using this method so that noone can see my precious bot tokken..and

#thats all folks.. hope yall liked this and understood its mechanism if you really like it pls star this project at my gihub.. love yall for all! thank you!

#cmon.. i had to get it to hundered.. so yea.. #100linecode yaay!
Пример #18
0
async def on_ready():
    keep_alive.keep_alive()
    print("bot online")
    game = discord.Game("a!help")
    await client.change_presence(status=discord.Status.online, activity=game)
Пример #19
0
            if ' ' in usermute[1]:
                usermute = message.content.split(maxsplit=2)
                timemuted = usermute[2].replace('m', '')
            else:
                mutedrole = discord.utils.get(message.server.roles,
                                              name='Muted')
                await client.add_roles(usermute[1], mutedrole)
        else:
            await client.send_message(
                message.channel,
                "Please *mention* who you want to be muted after the command.")

    #disable envoy and reminder
    if message.conent.startswith("$toggle envoy"):
        if tenvoy == True:
            tenvoy = False


#client.loop.create_task(chat())
client.loop.create_task(reminder())
client.loop.create_task(envoy())

keep_alive()  #keep the bot running after the window closes, use
#UptimeRobot to ping the website at least every <60min. to prevent the website from going to sleep, turning off the bot

#make a file named (.env) and write "DISCORD_BOT_SECRET=" with no spaces then paste your discord bot token after it
TOKEN = os.environ.get("DISCORD_BOT_SECRET")
#Admin-logs id
adminID = os.environ.get("adminID")
#run the bot using the token
client.run(TOKEN)
Пример #20
0
            # space is optional because we are converting to int
            index = (msg.split("$del", 1)[1])
            delete_encouragements(index)
            await message.channel.send("deleted encourage message!!")
            #encouragements = db["encouragements"]
        except:
            await message.channel.send("db server down")

    if msg.startswith("$list"):  # to show all encour. messages
        encouragements = []  # if list is empty
        coll = mydb.encouragements
        temp = list(coll.find())
        messages = []
        for i in temp:
            messages.append(i['message'])
        await message.channel.send(messages)
    if msg.startswith('$responding'):  # switch to respond to sad words
        value = msg.split("$responding ", 1)[1]
        try:
            myclient.discordbot()
            await message.channel.send("responding on")
        except:
            await message.channel.send("responding off")
    '''else:
        message.channel.send("wrong message child")'''


keep_alive()  # web server
my_secret = os.getenv('mkey')
client.run(my_secret)
Пример #21
0
import os
from keep_alive import keep_alive
from discord.ext import commands

bot = commands.Bot(
    command_prefix="!",  # Change to desired prefix
    case_insensitive=True  # Commands aren't case-sensitive
)

bot.author_id = 496984249044566018  # Change to your discord id!!!


@bot.event
async def on_ready():  # When the bot is ready
    print("I'm in")
    print(bot.user)  # Prints the bot's username and identifier


extensions = [
    'cogs.cog_example',  # Same name as it would be if you were importing it
    'cogs.greet',  # Load our greeting cog.
    'cogs.toolbox',  # Load out toolbox cog
]

if __name__ == '__main__':  # Ensures this is the file being ran
    for extension in extensions:
        bot.load_extension(extension)  # Loades every extension.

keep_alive()  # Starts a webserver to be pinged.
token = os.environ.get("DISCORD_BOT_SECRET")
bot.run(token)  # Starts the bot
Пример #22
0
    else:
        self.log= f'{message}\n'
    self.log  =self.log[:1000]
bot.test=False
    
commands.Bot.print = _print

@bot.event
async def on_ready():
    await ready(bot)
@bot.event
async def on_command(ctx):
    await command(bot,ctx)
@bot.event
async def on_command_completion(ctx):
    print(ctx)
@bot.event
async def on_message(ctx):
    await message(bot,ctx)
@bot.event
async def on_command_error(ctx,error):
    await command_error(bot, ctx, error)


keep_alive.keep_alive()# Start the server
replit.clear()
bot.tests = asyncio.run(run_tests())
bot.print(bot.tests)
bot.run(os.environ.get('DISCORD_BOT_SECRET'), bot=True, reconnect=True)# Finally, login the bo

 
Пример #23
0
async def hourly(guild):
    while hourlyBool == 1:
      await guild.text_channels[0].send("I have joined the server")
      await asyncio.sleep(3)

'''   


@client.command()
async def info(ctx):
    await ctx.send("Server ID: {}".format(ctx.guild.id))

    

@client.command()                         # decorator for commands
async def randomword(random):             # function name will be used as commands along with bot prefix
    rand = ud.random()
    for w in rand[:3]:
        await random.send(w.word)
        await random.send(w.definition)
        await random.send('-------------------------------------------------------------------------------------------------------------------------------------------------------------------')

@client.command()
async def define(ctx, *, word):           # define words and phrases
    defs = uClient.get_definition(word)
    for d in defs[:2]:
        await ctx.send(d.definition)

keep_alive()                             # thread to keep running
client.run(token)
Пример #24
0

from keep_alive import keep_alive
from data.responses import quotes

client = discord.Client()

@client.event
async def on_ready():
    print("I'm in")
    print(client.user)

@client.event
async def on_message(message):
    # check if client is in mentions
    if not find(lambda m: m.name == client.user.name, message.mentions):
        return
    # check if client is not talking to himself
    if message.author == client.user:
        return


    response = random.choice(quotes)
    await client.send_message(message.channel, response)
    # print(f'{message.author}@{message.channel}: {message.content}')


keep_alive()
token = os.environ.get("DISCORD_BOT_SECRET")
client.run(token)