Giter VIP home page Giter VIP logo

derpybot's People

Contributors

ineptvirus avatar otakumegane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

derpybot's Issues

Syntax error, \discord_client\config.py

Hi

Running the client I am presented with the following lines on startup:

===== RESTART: C:\Users\menja01\Desktop\bot\DerpyBot-master\derpybot.py =====
[DerpyBot] DerpyBot version 0.9.3.4
[DerpyBot] Loading markov...
[DerpyMarkov] Loading DerpyMarkov...
[DerpyMarkov] DerpyMarkov version 0.9.3.4
[DerpyMarkov] I know 1 lines containing a total of 1 words.
[DerpyMarkov] 1 of those words are unique.
[DerpyMarkov] We are currently using a state size of 1 which generated 2 contexts.
[DerpyMarkov] Normal reply rate is 2.0 and bot name reply rate is 100.0.
[DerpyBot] Loading chat client...
Traceback (most recent call last):
  File "C:\Users\menja01\Desktop\bot\DerpyBot-master\derpybot.py", line 131, in <module>
    client_load(False)
  File "C:\Users\menja01\Desktop\bot\DerpyBot-master\derpybot.py", line 88, in client_load
    chat_client = importlib.import_module('clients.discord_client.discord_client')
  File "C:\Users\menja01\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\menja01\Desktop\bot\DerpyBot-master\clients\discord_client\discord_client.py", line 8, in <module>
    from . import config
  File "C:\Users\menja01\Desktop\bot\DerpyBot-master\clients\discord_client\config.py", line 8
    command_alias = "#"
                ^
SyntaxError: invalid syntax
>>> 

The arrow is pointing to the s on the end of alias btw.

I thought okay lets have a look at the \discord_client\config.py file it looks like it is trying to load, I have it setup as follows with the bot info taken out:

from configparser import SafeConfigParser
import common

config = SafeConfigParser()
bot_token = "REDACTED"
discord_playing = "playing with AI"
owner_ids = [Ineptvirus#1337]
command_alias = "#"
discord_channels = [general]
discord_markov_channels = [general]
chat_to_console = None
#TODO: config.has_section, sanity checks

The error occuring on command alias, I changed the previous line to;
owner_ids = ["Ineptvirus#1337"]

I think this fixes it because it passes that line but then it gets stuck on line 9 next time I run it with the following error:

===== RESTART: C:\Users\menja01\Desktop\bot\DerpyBot-master\derpybot.py =====
[DerpyBot] DerpyBot version 0.9.3.4
[DerpyBot] Loading markov...
[DerpyMarkov] Loading DerpyMarkov...
[DerpyMarkov] DerpyMarkov version 0.9.3.4
[DerpyMarkov] I know 1 lines containing a total of 1 words.
[DerpyMarkov] 1 of those words are unique.
[DerpyMarkov] We are currently using a state size of 1 which generated 2 contexts.
[DerpyMarkov] Normal reply rate is 2.0 and bot name reply rate is 100.0.
[DerpyBot] Loading chat client...
Traceback (most recent call last):
  File "C:\Users\menja01\Desktop\bot\DerpyBot-master\derpybot.py", line 131, in <module>
    client_load(False)
  File "C:\Users\menja01\Desktop\bot\DerpyBot-master\derpybot.py", line 88, in client_load
    chat_client = importlib.import_module('clients.discord_client.discord_client')
  File "C:\Users\menja01\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\menja01\Desktop\bot\DerpyBot-master\clients\discord_client\discord_client.py", line 8, in <module>
    from . import config
  File "C:\Users\menja01\Desktop\bot\DerpyBot-master\clients\discord_client\config.py", line 9, in <module>
    discord_channels = [general]
NameError: name 'general' is not defined
>>> 

Not sure where to go from here.

Edit:
I changed owner ID to
= 0
Just like in defaults. And when run again I get the second error (line 9, general is not defined)

Amazing, but can AI be improved?

I love the bot! He used to be a little baby, but now he knows ALOT more words, and some of the things people dont understand, Like if I say:
Hello

He says:
hello bot is so the research and they couldn’t afford to learn anything

So... He kinda repeats what I say with some other random sentance, is it possible to make him act like better? I dont want to use chatty cathy or anything like that.. I think this one is the best. But I need him to kinda learn the meaning of the words, so he can say it back better, or something like that idk, Anything to make him speak better would be helpful.

Thank you for making this bot :)

No discord messages sent

Hi,

The lastest release seems to not be sending any messages to the discord channels, and occasionally gives an error as per test below. Of note is I have my mention replay rate set to 100 so the bot (In my setup named Mirai) should respond to all of these messages

`

D:\Mirai\DerpyBot-v0.9.3.8>C:\Users\Jake\AppData\Local\Programs\Python\Python37\python.exe D:\Mirai\DerpyBot-v0.9.3.8\derpybot.py
D:\Mirai\DerpyBot-v0.9.3.8\derpybot.py:14: DeprecationWarning: The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions. Use ConfigParser directly instead.
config = SafeConfigParser(allow_no_value = True)
[DerpyBot] DerpyBot version 0.9.3.8
[DerpyBot] Loading markov...
[DerpyMarkov] DerpyMarkov version 0.9.3.10
[DerpyMarkov] Loading main dictionary...
[DerpyMarkov] I know 1436 lines containing a total of 5802 words.
[DerpyMarkov] 1802 of those words are unique.
[DerpyMarkov] We are currently using a state size of 1 which generated 1803 contexts.
[DerpyMarkov] Normal reply rate is 10.0 and bot name reply rate is 100.0.
[DerpyBot] Loading chat client...
[Discord Client] Discord Client version 0.9.2.9
[Discord Client] We have logged in to Discord!
[Discord Client] Name: Mirai
[Discord Client] ID: 417657851587330051
[Discord Client] Could not set 'Playing' status for some reason.
[Discord Client]
[DerpyBot] Entering command mode...

[Discord Client] Message from #testing-channel: Mirai hi
[Discord Client] Message from #testing-channel: Mirai hi
[Discord Client] Message from #testing-channel: Mirai hi
[Discord Client] Message from #testing-channel: Mirai hi
[Discord Client] Message from #testing-channel: Mirai hi
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\Jake\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\client.py", line 255, in _run_event
await coro(*args, **kwargs)
File "D:\Mirai\DerpyBot-v0.9.3.8\clients\discord_client\discord_client.py", line 88, in on_message
if message.channel.is_private:
AttributeError: 'TextChannel' object has no attribute 'is_private'
`

I have solved this in my fork, which I opened a thread for (issue #5 )

I'm not a frequent user of githut and I'm not sure how requesting to pull the fork works but I'll give it a shot

Tia

bot unable to send discord messages / crash

Firstly, sorry OtakuMegane for opening a load of issues in the past few days.

Anyway, The issue I'm having is the bot crashes when attempting to send a message to the discord. The bot loads up fine, enters command mode, and waits. I have set my respond rate to 100 and artificially fed it lots of text in lines.txt to give it something to play with. I've also turned off "random_on_key_fail = false" to true in an attempt to get more messages that I can verify it works. I can message the chat with the bot in and nothing is said. I have to type something in the open console (literally any command, in the below example I dont even type anything I just hit enter. This seems to prompt the bot to update the console and also attempt to send a message (which it forms just fine), however I never see the message in the server and the bot immediately goes offline as if it has crashed. No message in cinsole to verify crash. console example below:

Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> 
===== RESTART: C:\Users\Jake\Desktop\Mirai\DerpyBot-v0.9.3.4\derpybot.py =====
[DerpyBot] DerpyBot version 0.9.3.4
[DerpyBot] Loading markov...
[DerpyMarkov] Loading DerpyMarkov...
[DerpyMarkov] DerpyMarkov version 0.9.3.4
[DerpyMarkov] I know 125 lines containing a total of 874 words.
[DerpyMarkov] 454 of those words are unique.
[DerpyMarkov] We are currently using a state size of 1 which generated 455 contexts.
[DerpyMarkov] Normal reply rate is 100.0 and bot name reply rate is 100.0.
[DerpyBot] Loading chat client...
[Discord]  We have logged in to Discord!
[Discord]   Name: Mirai
[Discord]   ID: 417657851587330051
[Discord]   Playing: with AI
[DerpyBot] Entering command mode...
>> 
[Discord] Message from #vault: I think it works now>> 

[Discord] Message to #vault: I'm bad at coping with all the guy who plays jean valjean in 10 minutes, and I wanna do but i know what are you yet. That I have about an ADL suggestion, Plan my boring ass course[DerpyMarkov] Saving lines...>> 

If I type in further commands it seems to respond to them badly but does run them. However the discord side of the bot is rather dead still.

shutdown
[Discord] Message from #vault: it should do anyway[DerpyMarkov] Lines saved![DerpyBot] Shutting everything down...


[Discord] Message to #vault: And I'm bad at coping with it is home[DerpyMarkov] DerpyMarkov is shutting down now.

[Discord] Message from #vault: it will have to learn for a while yet even though I gave it a couple hundred messages[Discord] Logging out...

Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 307, in _run_event
    yield from getattr(self, event)(*args, **kwargs)
  File "C:\Users\Jake\Desktop\Mirai\DerpyBot-v0.9.3.4\clients\discord_client\discord_client.py", line 74, in on_message
    reply = markov.incoming_message(message.clean_content, discord_client.user.name, markov_learn)
  File "C:\Users\Jake\Desktop\Mirai\DerpyBot-v0.9.3.4\modules\derpymarkov\markov.py", line 165, in incoming_message
    learn(prepared_message)
  File "C:\Users\Jake\Desktop\Mirai\DerpyBot-v0.9.3.4\modules\derpymarkov\markov.py", line 292, in learn
    parsed_sentences = list(model.generate_corpus(text))
NameError: name 'model' is not defined
Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\client.py", line 198, in _request
    conn = yield from self._connector.connect(req)
  File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\connector.py", line 304, in connect
    yield from self._create_connection(req)
  File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\connector.py", line 578, in _create_connection
    transport, proto = yield from self._create_direct_connection(req)
  File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\connector.py", line 601, in _create_direct_connection
    local_addr=self._local_addr)
  File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\asyncio\base_events.py", line 764, in create_connection
    yield from self.sock_connect(sock, address)
  File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\asyncio\selector_events.py", line 450, in sock_connect
    return (yield from fut)
concurrent.futures._base.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 307, in _run_event
    yield from getattr(self, event)(*args, **kwargs)
  File "C:\Users\Jake\Desktop\Mirai\DerpyBot-v0.9.3.4\clients\discord_client\discord_client.py", line 84, in on_message
    await discord_client.send_message(message.channel, reply)
  File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 1152, in send_message
    data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
  File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\http.py", line 137, in request
    r = yield from self.session.request(method, url, **kwargs)
[Discord] We are logged out now!
  File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\client.py", line 555, in __iter__
    resp = yield from self._coro
[Discord] Shutting down client...
  File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\client.py", line 198, in _request
    conn = yield from self._connector.connect(req)
[DerpyBot] Good night!
  File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\async_timeout\__init__.py", line 35, in __exit__
    self._do_exit(exc_type)
>>>   File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\async_timeout\__init__.py", line 80, in _do_exit
    raise asyncio.TimeoutError
concurrent.futures._base.TimeoutError
Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 307, in _run_event
    yield from getattr(self, event)(*args, **kwargs)
  File "C:\Users\Jake\Desktop\Mirai\DerpyBot-v0.9.3.4\clients\discord_client\discord_client.py", line 84, in on_message
    await discord_client.send_message(message.channel, reply)
  File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 1152, in send_message
    data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
  File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\http.py", line 137, in request
    r = yield from self.session.request(method, url, **kwargs)
  File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\client.py", line 555, in __iter__
    resp = yield from self._coro
  File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\client.py", line 161, in _request
    raise RuntimeError('Session is closed')
RuntimeError: Session is closed

AttributeError: 'TextChannel' object has no attribute 'is_private'

Hi,
I have updated python to 3.7 along with downloading latest of all modules. I believe discord.py had updated to v1.0 which changed a buuunch of stuff as shown here:

https://discordpy.readthedocs.io/en/latest/migrating.html#migrating-1-0

The first error I'm getting is as such:

>> [Discord] Message from #testing-channel: mirai show me the error please
Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\Jake\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\client.py", line 255, in _run_event
    await coro(*args, **kwargs)
  File "D:\Mirai\DerpyBot-v0.9.3.7_dev\clients\discord_client\discord_client.py", line 91, in on_message
    if message.channel.is_private:
AttributeError: 'TextChannel' object has no attribute 'is_private'
[Discord] Message from #testing-channel: thanks

The problem is discord_client.py line 91 as shown in the error:

if message.channel.is_private:

This is old and apparently should be replaced with something like:

if message.channel.isinstance(channel, discord.abc.PrivateChannel)

But doesn't seem to be working in any way I try.. I'm pretty meh at writing code, I usually do disassembly so I'm using this program you made as a bit of practise :)

I'm going to keep working on a fix in my fork and I'll update this issue thread if I find one

-IneptV

file: '<string>', line: 1 error

I get a error when running bot:
n 3.2. This alias will be removed in future versions. Use ConfigParser directly instead.
config = SafeConfigParser(allow_no_value = True)
[DerpyBot] DerpyBot version 0.9.3.7
[DerpyBot] Loading markov...
[DerpyMarkov] Loading DerpyMarkov...
[DerpyMarkov] DerpyMarkov version 0.9.3.9
[DerpyMarkov] I know 1 lines containing a total of 1 words.
[DerpyMarkov] 1 of those words are unique.
[DerpyMarkov] We are currently using a state size of 1 which generated 2 contexts.
[DerpyMarkov] Normal reply rate is 2.0 and bot name reply rate is 100.0.
[DerpyBot] Loading chat client...
Exception in thread Thread-2:
Traceback (most recent call last):
File "C:\Python37\lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "C:\Python37\lib\threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\zaras.LAPTOP-NPONEGMA\Desktop\folders\chatbot\DerpyBot\clients\discord_client\discord_client.py", line 116, in launch
discord_commands.load_custom_commands(False, parent_location)
File "C:\Users\zaras.LAPTOP-NPONEGMA\Desktop\folders\chatbot\DerpyBot\clients\discord_client\discord_commands.py", line 71, in load_custom_commands
config.read_string(commands_input)
File "C:\Python37\lib\configparser.py", line 722, in read_string
self.read_file(sfile, source)
File "C:\Python37\lib\configparser.py", line 717, in read_file
self._read(f, source)
File "C:\Python37\lib\configparser.py", line 1079, in _read
raise MissingSectionHeaderError(fpname, lineno, line)
configparser.MissingSectionHeaderError: File contains no section headers.
file: '', line: 1
'derp'

AttributeError: 'TextChannel' object has no attribute 'respond'

@bot.slash_command()
async def balance(ctx, user: discord.User = None):
    if user != None:
        userid = user.id
    else:
        userid = ctx.author.id
    with open("users.json", "r+") as f:
        data = json.load(f)
    if str(userid) in data:
        balance = data[str(userid)]["balance"]
        await ctx.channel.respond(
            f"{ctx.author.mention} has **⏣{balance}** in their wallet."
        )

KeyError: ('___BEGIN__',)

Hi,
I'm a bit of a noob at this stuff but I'm stuck on an error with your program.
When running 'derpybot.py' using IDLE and F5 I get the following text:

========= RESTART: C:\Users\Jake\Mirai\DerpyBot-v0.9.3.2\derpybot.py =========
[DerpyBot] DerpyBot version 0.9.3.2
[DerpyBot] Loading markov...
[DerpyMarkov] Loading DerpyMarkov...
[DerpyMarkov] DerpyMarkov version 0.9.3.2
Traceback (most recent call last):
File "C:\Users\Jake\Mirai\DerpyBot-v0.9.3.2\derpybot.py", line 130, in
markov_load(False)
File "C:\Users\Jake\Mirai\DerpyBot-v0.9.3.2\derpybot.py", line 109, in markov_load
markov.activate(reload)
File "C:\Users\Jake\Mirai\DerpyBot-v0.9.3.2\modules\derpymarkov\markov.py", line 58, in activate
model = derpymodel.DerpyText(input_text, state_size = config.state_size1)
File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\markovify\text.py", line 37, in init
self.chain = chain or Chain(self.parsed_sentences, state_size)
File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\markovify\chain.py", line 45, in init
self.precompute_begin_state()
File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\markovify\chain.py", line 80, in precompute_begin_state
choices, weights = zip(*self.model[begin_state].items())
KeyError: ('_BEGIN',)

From googling the issue it seems to be a Markovify issue, but I have not been able to find a fix yet as there is only two threads on the issue which is a little bit different to mine

Exception in thread Thread-2:

Really sorry if its me doing something dumb but ive come across this error which by my best efforts i cant fix, any help is really appreciated because so far this is the only bot ive been able to find that does this

Error
py_2018-10-09_18-38-00

System Specs:
inkedapplicationframehost_2018-10-08_19-57-56_li

Python Version:
pythonw_2018-10-09_18-41-43

Edit: here it is with Markov disabled in config.py
cmd_2018-10-09_18-51-00

Bot dosent save text correctly

I noticed it never saved people being pinged as <@id>, but just as if it copised and pasted their username, is this an intentional bit in the code to prevent the bot from pinging people or the byproduct of something else.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.